Click here to Skip to main content
15,920,217 members
Home / Discussions / C#
   

C#

 
GeneralRe: working with https Pin
Heath Stewart14-Jul-04 4:37
protectorHeath Stewart14-Jul-04 4:37 
GeneralRe: working with https Pin
Anonymous14-Jul-04 6:31
Anonymous14-Jul-04 6:31 
QuestionHow to use UdpClient class? Pin
skywen13-Jul-04 17:00
skywen13-Jul-04 17:00 
AnswerRe: How to use UdpClient class? Pin
Heath Stewart14-Jul-04 4:24
protectorHeath Stewart14-Jul-04 4:24 
GeneralChild Control Painting problem(For the last time) Pin
Jon_Slaughter13-Jul-04 13:54
Jon_Slaughter13-Jul-04 13:54 
GeneralRe: Child Control Painting problem(For the last time) Pin
Heath Stewart14-Jul-04 4:12
protectorHeath Stewart14-Jul-04 4:12 
GeneralRe: Child Control Painting problem(For the last time) Pin
Jon_Slaughter14-Jul-04 5:28
Jon_Slaughter14-Jul-04 5:28 
GeneralRe: Child Control Painting problem(For the last time) Pin
Heath Stewart14-Jul-04 6:01
protectorHeath Stewart14-Jul-04 6:01 
I understand the problem. In your override to OnPaint, just don't call base.OnPaint. In the base class, WM_PAINT is already being caught and OnPaint (indirectly) is being called. In Control.WndProc, after calling the internal WmPaint (which calls OnPaint after some setup code) execution is returned to the caller. Since WndProc is the WindowProc for the window class, WM_PAINT shouldn't be sent to the control without first going through OnPaint, which means you control all painting. As I said before, just don't call base.OnPaint and all the painting is done by you.

There are many articles here on CodeProject about painting your own buttons. If all you're trying to do is avoid having the black rectangle painted, 1) drawing a button yourself (completely) wouldn't be that hard (if you want the raised look, use state variables that you set in the mouse event handlers by overriding the respective OnEventName methods), and 2) you should be able to set the clipping region within your implementation. Since you now control all the painting, you decide what gets drawn and what doesn't.

If you were to set the clipping region this way, then you could eliminate the area that the black border would cover and then call base.OnPaint. OnPaintBackground isn't necessary since setting ControlStyles.AllPaintingInWmPaint to true using SetStyle directs all painting to be done in the WM_PAINT handler.

 

Microsoft MVP, Visual C#
My Articles
GeneralBigger ImageList Pin
blankg13-Jul-04 11:50
blankg13-Jul-04 11:50 
GeneralRe: Bigger ImageList Pin
Heath Stewart14-Jul-04 4:01
protectorHeath Stewart14-Jul-04 4:01 
Generaldisable network card throw c# Pin
vipervip13-Jul-04 11:06
vipervip13-Jul-04 11:06 
Generalconfig file in console app to store connection string help Pin
mtbjr13-Jul-04 10:25
mtbjr13-Jul-04 10:25 
GeneralRe: config file in console app to store connection string help Pin
Heath Stewart14-Jul-04 3:56
protectorHeath Stewart14-Jul-04 3:56 
GeneralPointers and dereferencing Pin
frank29713-Jul-04 8:01
frank29713-Jul-04 8:01 
GeneralRe: Pointers and dereferencing Pin
Heath Stewart13-Jul-04 8:34
protectorHeath Stewart13-Jul-04 8:34 
Generalcapturing events when application closes Pin
vista2713-Jul-04 7:59
vista2713-Jul-04 7:59 
GeneralRe: capturing events when application closes Pin
Heath Stewart13-Jul-04 9:07
protectorHeath Stewart13-Jul-04 9:07 
GeneralArray of Struct within Struct Pin
Uday Shastri13-Jul-04 7:58
Uday Shastri13-Jul-04 7:58 
GeneralRe: Array of Struct within Struct Pin
Heath Stewart13-Jul-04 9:21
protectorHeath Stewart13-Jul-04 9:21 
GeneralRe: Array of Struct within Struct Pin
Uday Shastri13-Jul-04 9:47
Uday Shastri13-Jul-04 9:47 
GeneralRe: Array of Struct within Struct Pin
Heath Stewart13-Jul-04 10:19
protectorHeath Stewart13-Jul-04 10:19 
Generalupload files Pin
Steven M Hunt13-Jul-04 7:03
Steven M Hunt13-Jul-04 7:03 
GeneralRe: upload files Pin
Heath Stewart13-Jul-04 9:17
protectorHeath Stewart13-Jul-04 9:17 
GeneralRe: upload files Pin
Steven M Hunt14-Jul-04 14:31
Steven M Hunt14-Jul-04 14:31 
GeneralRe: upload files Pin
Heath Stewart19-Jul-04 2:02
protectorHeath Stewart19-Jul-04 2:02 

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.