Click here to Skip to main content
15,894,343 members
Home / Discussions / C#
   

C#

 
GeneralRe: use shellexecute to create an email Pin
Heath Stewart1-Jan-05 6:33
protectorHeath Stewart1-Jan-05 6:33 
Generalbits Pin
Tyrus18231-Dec-04 16:37
Tyrus18231-Dec-04 16:37 
GeneralRe: bits Pin
Heath Stewart31-Dec-04 22:58
protectorHeath Stewart31-Dec-04 22:58 
GeneralSIMPLE SIMPLE QUESTION Pin
...---...31-Dec-04 9:44
...---...31-Dec-04 9:44 
GeneralRe: SIMPLE SIMPLE QUESTION Pin
SimonS31-Dec-04 10:29
SimonS31-Dec-04 10:29 
GeneralRe: SIMPLE SIMPLE QUESTION Pin
Heath Stewart31-Dec-04 10:46
protectorHeath Stewart31-Dec-04 10:46 
GeneralRe: SIMPLE SIMPLE QUESTION Pin
...---...31-Dec-04 10:50
...---...31-Dec-04 10:50 
GeneralRe: SIMPLE SIMPLE QUESTION Pin
Heath Stewart31-Dec-04 11:06
protectorHeath Stewart31-Dec-04 11:06 
1. Because the line is being painted on the form, not the button. Invalidate invalidates a region of a window (controls are windows, too, BTW) and the next time a paint message (WM_PAINT) is sent to the window the line is painted.

2. using compiles to the following:
Graphics g = e.Graphics;
try
{
  // Do stuff with g
}
finally
{
  g.Dispose();
}
The using block is documented in the C# Language specification.

As I said in my reply, though, do not dispose the Graphics object. You only dispose Graphics objects (and pretty much anything else, for that matter) that you create. Since your code did not create the Graphics object via Control.CreateGraphics, Graphics.FromImage, or several other methods you should not dispose it yourself. The default implementation will dispose of the Graphics it created (which is actually from Graphics.FromHdc internally) when the OnPaint method (and any event handlers attached to the Paint event) return.

This posting is provided "AS IS" with no warranties, and confers no rights.

Software Design Engineer
Developer Division Sustained Engineering
Microsoft

[My Articles] [My Blog]
GeneralRe: SIMPLE SIMPLE QUESTION Pin
SimonS31-Dec-04 11:39
SimonS31-Dec-04 11:39 
GeneralRe: SIMPLE SIMPLE QUESTION Pin
Heath Stewart31-Dec-04 12:22
protectorHeath Stewart31-Dec-04 12:22 
GeneralALMOST WORKS! BUT.... Pin
...---...31-Dec-04 15:39
...---...31-Dec-04 15:39 
GeneralRe: ALMOST WORKS! BUT.... Pin
Matt Gerrans3-Jan-05 8:43
Matt Gerrans3-Jan-05 8:43 
GeneralCPU Usage and thread problem Pin
aswanee31-Dec-04 9:37
aswanee31-Dec-04 9:37 
GeneralRe: CPU Usage and thread problem Pin
leppie31-Dec-04 10:23
leppie31-Dec-04 10:23 
GeneralSending an email message through windows C#... Pin
new_phoenix31-Dec-04 6:21
new_phoenix31-Dec-04 6:21 
GeneralRe: Sending an email message through windows C#... Pin
Dennis C. Dietrich31-Dec-04 6:36
Dennis C. Dietrich31-Dec-04 6:36 
GeneralRe: Sending an email message through windows C#... Pin
new_phoenix31-Dec-04 6:47
new_phoenix31-Dec-04 6:47 
GeneralRe: Sending an email message through windows C#... Pin
Heath Stewart31-Dec-04 6:57
protectorHeath Stewart31-Dec-04 6:57 
GeneralRe: Sending an email message through windows C#... Pin
new_phoenix31-Dec-04 7:57
new_phoenix31-Dec-04 7:57 
GeneralRe: Sending an email message through windows C#... Pin
Heath Stewart31-Dec-04 8:10
protectorHeath Stewart31-Dec-04 8:10 
GeneralRe: Sending an email message through windows C#... Pin
Heath Stewart1-Jan-05 7:06
protectorHeath Stewart1-Jan-05 7:06 
GeneralMicrophone Input Level Indicator Pin
GTWebb31-Dec-04 3:50
GTWebb31-Dec-04 3:50 
GeneralRe: Microphone Input Level Indicator Pin
Heath Stewart31-Dec-04 7:44
protectorHeath Stewart31-Dec-04 7:44 
GeneralRe: Microphone Input Level Indicator Pin
GTWebb2-Jan-05 12:04
GTWebb2-Jan-05 12:04 
GeneralCardinal Splines Pin
thepersonof30-Dec-04 23:59
thepersonof30-Dec-04 23:59 

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.