|
After going back in Petzold's book, he states that overriding OnPaint also overrides the Controls (ToolStrip, etc.). I read that if one calls Invalidate(false), the child controls will not get the message. Anyway, I made the client area a Panel and made event handlers for mouse moves, paint, etc. This was actually easier to paint to because now I do not have to determine the offsets for the tool bar, status bar, and menu.
Now I need to find an example for StatusStrip instead of using StatusBar.
|
|
|
|
|
Christian, thanks for the advise. If I already have the png files, how to I add the png files as a resource so they are included in the executable? Also, how do I load them into the application?
|
|
|
|
|
Simple question but I guess no one knows the answer.
I finally figured it out.
1) Add a bmp, ico, etc. to your project.
2) Select properties on bmp, ico, etc. and make Build Action - Embedded Resourse
3) Select properties on project, and make Default namespace: - Tools.Test
4) If the code in not in a namespace, then you can loose the Tools prefix.
using System;
using System.Drawing;
using System.Windows.Forms;
namespace Tools
{
class Test : Form
{
public static void Main()
{
Application.Run(new Test());
}
public Test()
{
Text = "Test";
Icon = new Icon(GetType(), "Test.Test.ico");
}
}
}
|
|
|
|
|
I'm trying to implement a software registration in my application. When the user registers, it checks our server for the software license they entered to see if its' valid.
From what I've read on the web, I needed to do this using FTP. I'm still using VS2003 so webclients are not available.
Everything seemed to work fine until one of our customers was behind a well protected firewall. For datasocket transmission I'm using PASV mode, but they still can't register. In fact, they can't even log into our FTP server.
My question is: Is using FTP the best way of sending files and data between server and client with C# .NET 1.0? If so, how would this customer register if behind a firewall. Would they need to have their IT guys allow access to our IP address?
Thanks,
Brian
|
|
|
|
|
Another good idea would be to implement a registration service via http. You have a 99% chance that you clients would have port 80 open. Perhaps in you VS app you can have a link to your server which will allow then to register from there.
|
|
|
|
|
I want to have one thread generate a point location (bouncing ball) and then have a second thread draw the point on a panel. Do I have to use a producer/consumer relationship? What if I wanted to do multiple points...lets say 10?
Bruce Zelenka
|
|
|
|
|
You probably want to make a thread safe collection to hold the balls, and just have your painting thread paint whenever the rest of the app is idle.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
We have a software product developed in c# (.net 2005). We installed Vista onto a test computer to try it out, and we are experiencing some problems with UI colors. None of us are really up to speed on Vista yet, so we are looking for a little direction.
As an example, the (default) Vista color scheme changes the forecolor of command buttons in our application when executed (IDE not installed on Vista). In Win2K and XP the colors are displayed according to how we have defined them in our code. However, in Vista it appears that text for disabled controls is brighter than for enabled ones. We have a picture box defined with a white background, but for some reason it appears black in Vista.
Perhaps it's something obvious that we're missing, but we have not found anything posted. Can someone offer some advice?
Many thanks in advance!
Ron Birkelbach
Kennebec, Inc.
|
|
|
|
|
If you modified the controls' colours in the designer then there'll be a line inserted in the InitializeComponent method which sets the colour. If you delete these lines the colours will revert to the default and this will hopefully be the correct one for Vista. Alternatively if you're setting colours in code you should look at the SystemColors class.
|
|
|
|
|
hi all,
this is my problem
i used this code
Graphics grfx = this.createGraphics();
grfx.DrawLine(Pens.Black,p1,p2);
in the Mouse_Move EventHandler but it draw alot of lines
so i want to use XOR mode to draw only the last one
thanx in advance
Generator
|
|
|
|
|
Hi!
You could use ControlPaint.DrawReversibleLine() to get something like an "XOR" mode.
But are you sure you know what you're doing?
Usually creating a graphics object in a mouse event handler to do some painting is a bad idea.
Do you dispose of every Graphics object you create? Beginners usually forget about it and then get ressource leaks. And what if the surface you're drawing your lines on gets hidden by another window and redrawn? All your lines will be gone...
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
hi mav,
actually i didnot draw in mouse move
i put every drawing in OnPaint() but it make some problems
in other parts of code so i decided to draw it in mouse move
(iam just trying to solve my problem so i didnot think in Dispose)
and thanx for remembering me of Dispose as i think u solve to me the problem of my program stop(Resources leak)
thanx again(i will try ControlPaint.DrawReversibleLine())
Generator
|
|
|
|
|
hi mav,
i read about ControlPaint.DrawReversibleLine in MSDN and if my understanding(it deletes the first draw if drawen again by same coordinates) is right so i think it will not be true to use it as i tried it and nothing changed
thanx
Generator
|
|
|
|
|
Hi mav,
thanx for ur efforts but i think i made actually not good solution but i think it work at this time
this is the code(please tell me if any notes)
Graphics grfx = this.CreateGraphics();
Pen pen = new Pen(mainScreen.DefaultBackColor);
if (counter == 0)
{
lastPntOfLine = e.Location;
counter++;
}
else
grfx.DrawLine(pen, mLineBeginPnt, lastPntOfLine);
mLineEndPnt = e.Location;
grfx.DrawLine(Pens.Black, mLineBeginPnt, mLineEndPnt);
lastPntOfLine = e.Location;
grfx.Dispose();
pen.Dispose();
Invalidate();
i felt very stubid to write that but this is my thinking until now
Generator
|
|
|
|
|
Hello,
I've made a new version of my app,I want the setup project to upgrade any previous versions or remove them for the new installation.
Dad
|
|
|
|
|
What are you using to build installers ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
thanks for reply
I use a .net setup project
Dad
|
|
|
|
|
How to move the cursor on some position(coordinates x and y).
C#
|
|
|
|
|
Cursor.Location = whatever ( I think, I know the property exists, not sure if it's settable )
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I've gotten as far with this as using getDC to draw to the desktop and some window picker code I found on this site. What I've yet to discover are:
i) How to trigger a handler every time the flash window has finished updating so that I can capture the bitmap at that point.
ii) How to blit to the desktop only after the flash window (or all windows) have updated, but still while the monitor beam is at the top of the screen.
(The directx full screen support addition to the latest flash won't help in this case -- i.e. for existing swf's. The task is to resize existing non-interactive animations at a decent frame rate..)
Any help appreciated, thanks.
-- modified at 15:34 Saturday 17th March, 2007
|
|
|
|
|
The biggest problem your facing is that you can't determine when the Flash window finishes it's painting. There is no notification given that signals the painting completion. You also can't determine when the scan is at the top of the monitor. Hardware interaction isn't available to your app without you writing driver-level code.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thanks for the reply, I'm about to use it to try and get out of the task
|
|
|
|
|
I need a help here.
How to create dial-up setting for web browser I have create in visual C#. How to call in form with button click the New Connection Wizard like in IE.
Another question:
How to craete proxy setting form like in IE. This is also enough, can tell me how to call the Local Area Network(LAN) setting form when click button.
Another question:
How to display history of page have I been visit in a form and a botton fof delete it.
I'm realy in trouble please help me. Tq very much.
|
|
|
|
|
hi ..
i want to get image from scanner in my vc#2005 app, how to do ?
thanks
|
|
|
|
|
TWAIN is the mechanism most scanners use, although some may use WIA, I guess. There is no built in TWAIN support, but there are commercial and ( I think ) free libraries around. CP has at least one free C++ TWAIN library, and perhaps some .NET ones.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|