Click here to Skip to main content
15,892,199 members
Home / Discussions / C#
   

C#

 
Generalusercontrol and lostfocus Pin
Roger Alsing5-Feb-03 20:53
Roger Alsing5-Feb-03 20:53 
GeneralRe: usercontrol and lostfocus Pin
Jeff J6-Feb-03 10:19
Jeff J6-Feb-03 10:19 
QuestionHow can you detect if User IS ONLINE? Pin
cdengler5-Feb-03 20:45
cdengler5-Feb-03 20:45 
AnswerRe: How can you detect if User IS ONLINE? Pin
Anonymous6-Feb-03 2:19
Anonymous6-Feb-03 2:19 
AnswerRe: How can you detect if User IS ONLINE? Pin
John Mautari11-Feb-03 5:08
John Mautari11-Feb-03 5:08 
QuestionHow to autoredraw if I use "graphics" Pin
clarkwuzhe5-Feb-03 17:30
clarkwuzhe5-Feb-03 17:30 
AnswerRe: How to autoredraw if I use "graphics" Pin
Paresh Gheewala5-Feb-03 18:08
Paresh Gheewala5-Feb-03 18:08 
AnswerRe: How to autoredraw if I use "graphics" Pin
Jeff J5-Feb-03 21:56
Jeff J5-Feb-03 21:56 
Since you are only painting/drawing the image once, the PictureBox will redraw over it with whatever contents it knows about, if any. That is, the PictureBox has no way to know that you painted a specific image in its client area, so it cannot redraw it when the system tells it to repaint its contents.

I assume you have a specific reason not to just set the PictureBox's Image property, and instead need to custom draw. Perhaps the easiest way would be to handle the control's Paint event, as you did with menuItem2's Click event. VS.Net will create a function like:

private void pictureBox_Paint(object sender, PaintEventArgs e)
{
   e.Graphics.DrawImage(mybmp, position);  //put your drawing code here
}


You will need to store mybmp and position somewhere the Paint handler can see it, and keep the code in your menuItem2_Click handler that sets the Bitmap and Rectangle. Since the Graphics object is already supplied by the PaintEventArgs object here, do not destroy it.

Windows will fire your Paint handler anytime the control needs to be redrawn.

Cheers
GeneralRe: How to autoredraw if I use "graphics" Pin
clarkwuzhe6-Feb-03 6:23
clarkwuzhe6-Feb-03 6:23 
GeneralRe: How to autoredraw if I use "graphics" Pin
Jeff J6-Feb-03 9:52
Jeff J6-Feb-03 9:52 
GeneralRe: How to autoredraw if I use "graphics" Pin
clarkwuzhe7-Feb-03 7:08
clarkwuzhe7-Feb-03 7:08 
GeneralRe: How to autoredraw if I use "graphics" Pin
Jeff J7-Feb-03 7:58
Jeff J7-Feb-03 7:58 
GeneralGetting Started in Software Dev. Pin
jtmtv185-Feb-03 14:40
jtmtv185-Feb-03 14:40 
GeneralRe: Getting Started in Software Dev. Pin
Taka Muraoka5-Feb-03 15:12
Taka Muraoka5-Feb-03 15:12 
GeneralRe: Getting Started in Software Dev. Pin
jtmtv185-Feb-03 15:24
jtmtv185-Feb-03 15:24 
GeneralRe: Getting Started in Software Dev. Pin
Taka Muraoka5-Feb-03 15:35
Taka Muraoka5-Feb-03 15:35 
GeneralRe: Getting Started in Software Dev. Pin
jtmtv185-Feb-03 15:47
jtmtv185-Feb-03 15:47 
GeneralRe: Getting Started in Software Dev. Pin
Taka Muraoka5-Feb-03 15:51
Taka Muraoka5-Feb-03 15:51 
Questionhow to get all the files names in one folder? Pin
clarkwuzhe5-Feb-03 11:59
clarkwuzhe5-Feb-03 11:59 
AnswerRe: how to get all the files names in one folder? Pin
Paresh Gheewala5-Feb-03 12:30
Paresh Gheewala5-Feb-03 12:30 
AnswerRe: how to get all the files names in one folder? Pin
Paresh Gheewala5-Feb-03 13:13
Paresh Gheewala5-Feb-03 13:13 
QuestionHow to tell whether a string is a number? Pin
clarkwuzhe5-Feb-03 11:30
clarkwuzhe5-Feb-03 11:30 
AnswerRe: How to tell whether a string is a number? Pin
Paresh Gheewala5-Feb-03 11:37
Paresh Gheewala5-Feb-03 11:37 
GeneralRe: How to tell whether a string is a number? Pin
clarkwuzhe5-Feb-03 11:39
clarkwuzhe5-Feb-03 11:39 
GeneralRe: How to tell whether a string is a number? Pin
Paresh Gheewala5-Feb-03 11:42
Paresh Gheewala5-Feb-03 11:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.