I have knocked together a little test piece that draws a jpg, a rectangle, a Ellipse and a line to screen.
But what i want to do is be able to draw all these things within a Tab Control... any idea how i get the dc of the TabControl or how to draw to it?
or alternatively, is there a way i can embed a Form into a TabControl?
the code i used for the initial drawing is below..
Thanks in advance!!
protected override void OnPaint(PaintEventArgs e)
{
// Draws BMP
Piccy =
Image.FromFile("c:\\photo.jpg");
Rectangle rect = new Rectangle(50, 50, 450, 300);
Graphics dc = e.Graphics;
dc.DrawImage(Piccy, rect);
base.OnPaint(e);
// Draws Rectangle and Ellipse
dc = this.CreateGraphics();
this.Show();
Pen BluePen = new Pen(Color.Blue, 3);
dc.DrawRectangle(BluePen, 0, 0, 50, 50);
Pen RedPen = new Pen(Color.Red, 2);
dc.DrawEllipse(RedPen, 0, 50, 80, 60);
// LineTO
Pen GreenPen = new Pen(Color.Green, 2);
System.Drawing.Graphics formGraphics = this.CreateGraphics();
formGraphics.DrawLine(GreenPen, 40, 40, 200, 200); // Equivalent LineTo?!
}