Maybe be a Graphics Question or just a Dumb one.

K

Keith Rebello

I have a program whose main form has a picture box on which concrete column
sections are drawn. Input to the drawing is achieved by filling in data in
various dialog boxes (called by using Form.Showdialog). When a dialog box
is closed the drawing on the picture box is updated.

Everything works fine when I run the program from the VS2005 IDE. However,
when I run the program by clicking on the .exe outside the IDE, I have to
keep minimizing the main form for the drawing to update.

Any ideas on what possibly could be going wrong, will be greatly
appreciated.
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

Keith said:
I have a program whose main form has a picture box on which concrete column
sections are drawn. Input to the drawing is achieved by filling in data in
various dialog boxes (called by using Form.Showdialog). When a dialog box
is closed the drawing on the picture box is updated.

Everything works fine when I run the program from the VS2005 IDE. However,
when I run the program by clicking on the .exe outside the IDE, I have to
keep minimizing the main form for the drawing to update.

Any ideas on what possibly could be going wrong, will be greatly
appreciated.

What do you do in the code to update the image? Do you call the
Invalidate method of the control?
 
H

Herfried K. Wagner [MVP]

Keith Rebello said:
I have a program whose main form has a picture box on which concrete column
sections are drawn. Input to the drawing is achieved by filling in data in
various dialog boxes (called by using Form.Showdialog). When a dialog box
is closed the drawing on the picture box is updated.

Everything works fine when I run the program from the VS2005 IDE.
However, when I run the program by clicking on the .exe outside the IDE, I
have to keep minimizing the main form for the drawing to update.

Where did you place the drawing code? In the picturebox' 'Paint' event
handler or somewhere else?
 
K

Keith Rebello

I placed the code in a subroutine that is calls Paint event of the
picturebox.

Keith
 
K

Keith Rebello

To be precise, I have a class in my program called ColumnSection. It has a
Draw Method. I add a handler in the class to the Paint event of the
PictureBox. The class has a Canvas Property to which this PictureBox is
assigned. So, what I have in the class is:

AddHandler Canvas.Paint, AddressOf Draw

I hope this clarifies things.

Keith Rebello said:
I placed the code in a subroutine that is calls Paint event of the
picturebox.

Keith
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

Keith said:
To be precise, I have a class in my program called ColumnSection. It has a
Draw Method. I add a handler in the class to the Paint event of the
PictureBox. The class has a Canvas Property to which this PictureBox is
assigned. So, what I have in the class is:

AddHandler Canvas.Paint, AddressOf Draw

I hope this clarifies things.

So you are just using the picture box as a panel, not for displaying a
picture?

What code do you have to make the control update itself? Do you call the
Invalidate method for the control?
 
K

Keith Rebello

I do not call the Invalidate method of the control. The drawing is done in
the Paint event of the control. The main question here is - Why does it
work perfectly when run from the IDE and work incorrectly when it is run
from the .exe?

Thanks.
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

Keith said:
I do not call the Invalidate method of the control. The drawing is done in
the Paint event of the control. The main question here is - Why does it
work perfectly when run from the IDE and work incorrectly when it is run
from the .exe?

Thanks.

It doesn't work incorrectly when you run the executable, if you are not
doing anything to make the control redraw itself, you shouldn't see any
updates.

I don't know why it's not working the same when you run it from the IDE.
Are you compiling in debug or release mode?
 
K

Keith Rebello

Goran, I really appreciate you trying to help me. I was under the
impression that the Paint event of the PictureBox control was fired
everytime something over it changed. I will try explicitly invalidating the
control.

I think I have decent coding skills, but I sure am not a programmer. I have
no idea whether I am compiling in debug or release mode. I don't even know
where I need to look to answer that question.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top