|
|
||||||
|
#1
|
|
|
|
|
I am trying to paint in a custom control "OnPaint" but can not paint over the child controls such as a button or listview. I also want to be able to paint in the "Bounds" region of the control over the scrollbars in a ScollableControl. Any ideas?
-------------------------------- From: Chris Pursley ----------------------- Posted by a user from .NET 247 (http://www.dotnet247.com/) <Id>5ywHB/dgkUStAiKjTE/f5w==</Id> |
|
|
|
#2
|
|
|
|
|
There are two ways to put drawings on top of child controls. The first is to
draw directly on the desktop. The second is to use a layered window and put that on top of everything else. To draw on the desktop you need a wee bit of interop to import the GetDC and ReleaseDC methods. Get a DC for the desktop using null as a window handle, wrap the returned DC in a Graphics object using Graphics.FromHdc, Draw on the desktop, dispose of the Graphics object and release the DC again. If you search in the VB group you'll find an answer I gave someone an answer with a layered window solution. The post was dated 30th march and entitled "Re: Using The NativeWindow Class To Draw A GDI Type Circle On Top Of A DataGrid Possibly In The Override OnPaint" |
|
#3
|
|
|
|
|
One other soluion for the control which are positioned over the control's
client area would be the following: Controls cannot draw over their children because by default all windows have WS_CLIPCHILDREN style set. With this style all space occupied by child controls is clipped off of the control's client area. What one can do in this case is to override CreateParams virtual property and exlude this flag from the styles that the base implenetation returns protected override CreateParams CreateParams { get { CreateParams cp = base.CreateParams; cp.Style &= (~WS_CLIPCHILDREN); return cp; } WS_CLIPCHILDREN is 0x02000000 This won't work though for controls, which are outside the client rectangle such as scrollbars, menu, etc |
|
|
| Similar Threads | |
| Scrollbar paint problem with XP theme - SDI When I use the app wizard in VS 2005 to create a simple SDI application (change view to be a CFormView), the scrollbars on the form view don't seem to paint properly. As you... |
|
| UserControl activation from MFC does not call Paint for children I have an unmanged MFC app that is using CWnd::CreateControl to activate ATL Composite controls. This is an existing production app that is working fine with the ATL... |
|
| Tux Paint 0.9.15 released (Open Source drawing app. for children) November 27, 2005, Mountain View, California -- New Breed Software released Tux Paint 0.9.15 last Friday, adding new features, new translations and numerous other... |
|
| Client Side - click radio button - controls become enabled Can somebody help me please? I have two 'sets' of controls on a page. There are two radio buttons that enable the two sets (when radiobutton A is checked, set A should be... |
|
| MDI Children - Access Controls I have a MDI Children and want to access, lets say a label. I have seen in other posts: DirectCast(????, ????).MyLabel = "Label Text" If MDIMain is the MDI and FormA is... |
|
|
All times are GMT. The time now is 02:43 PM. | Privacy Policy
|