Re: Drawing in a user control
- From: "Bob Powell [MVP]" <bob@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 29 May 2006 00:54:44 +0200
You seem to be suffering from the classic problem of one who is trying to
resolve message driven architecture with an encapsulated window.
You should set boolean variables at the class level to state whether or not
the particular drawing should take place and ONLY draw in the OnPaint
override.
You should also consider whether UserControl is the correct base class or
whether Control or ScrollableControl is a better base.
Ah, also NEVER create a control that handles it's own events.
--
Bob Powell [MVP]
Visual C#, System.Drawing
Ramuseco Limited .NET consulting
http://www.ramuseco.com
Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
<feripar@xxxxxxxxx> wrote in message
news:1148761288.551983.121160@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello!
I am creating a user control with several methods, each method should
draw something in my user control; from a winform, I should use:
myControl.ShowBands or myControl.ShowLabels, etc.; but I don't know how
to do that, because all the logic to draw should be in the Paint event,
but each method does very differents things. I tried to create all the
methods I need, but I don't have the Graphics reference. SO, my
question is how can I draw different things, using my custom methods
using the correct Graphics object.
Thanks,
Fernando.
.
- Follow-Ups:
- Re: Drawing in a user control
- From: feripar
- Re: Drawing in a user control
- References:
- Drawing in a user control
- From: feripar
- Drawing in a user control
- Prev by Date: Re: Drawing in a user control
- Next by Date: Re: Drawing in a user control
- Previous by thread: Re: Drawing in a user control
- Next by thread: Re: Drawing in a user control
- Index(es):
Relevant Pages
|