C# .NET - custom user control in win forms C#

Asked By Bhavin Gandhi on 18-Jul-02 11:16 AM
Hello again!!..
I have a form which needs several circles. These circles are actually graphic representation of led's so will change colors on on/off basis. Now as i need several of them and also use it on diff forms all the time, i want to create a user control which draws that so that i can only drag and drop it on the form i need and no matter the number of them i drop just like a button. I added a new usercontrol item and in the contructor i do this
                                                Bitmap b;
                                                 Graphics g;
                                                 b = new Bitmap(30,30);
			g = Graphics.FromImage(b);
			Pen p = new Pen(Color.Black,2);
			Rectangle rec = new Rectangle(0,30,30,30);
			g.DrawEllipse(p,rec);
thats it.
shouldn't it draw circle on the form i drag and drop when i run that form. Please throw light
thanks
Bhavin

The easy way

Asked By Peter Bromberg on 18-Jul-02 07:30 PM
Is to just put PictureBoxes on your form of the correct size and load a BMP image
either from a resource or from the file system into the picturebox.
Your code can have methods that turn the picture on or off by either setting the
visibility or swapping for another image.
The hard way: Learn to write a custom LED - type usercontrol