Windows Develop Bookmark and Share   
 index > Windows Forms Designer > Drawing over a user control
 

Drawing over a user control

In VB.net how do you use GDI+ (in the onpaint sub) of a parent form to draw over a user control on that form?

I have a User control which acts just like the windows calendar control, but exposes and allows setting of various attributes for each of the days. I want to draw rectangles over some of the days from the Form which hosts the Usercontrol, but anything drawn in the area occupied by the UC is invisible. 

Any help much appreciated
MigrationUser 1  Sunday, February 16, 2003 8:45 AM
I would suggest, as a better model, to have the user control expose some methods that cause it to draw on it self.
MigrationUser 1  Monday, February 17, 2003 9:31 AM
Use the paint event of the User Control itself. If there is anything that needs to be communicated to that control from the client form, you can do in the client form's Paint Event or you could simply create an instance of the client form <u>within</u> the user control with events. Actually, that last suggestion would be the most direct answer to your question. If you'd like a piece of sample code, let me know. I've done exactly that with one of my user controls. Good Luck!
MigrationUser 1  Saturday, August 30, 2003 11:03 PM

You can use google to search for other answers

Custom Search

More Threads

• Design Time Settings of Size Does Not Stay At Run Time
• How can I add my custom control the DataSource properties
• Laying out my form, equivelant to BorderLayout.
• child controls of custom control disappear at run-time
• Debugging a VB.NET "Windows control"
• Extend default context menu
• RichTextBox font not displaying Arial 11, displays Arial 11.5
• My Class shows the class name as text not the text i give it
• Access folder
• VS2005 Express Edition