Drawing Issue

G

Guest

I have created a transparent control and I am using to to create drawing objects Inside the transparent objects I have created I am trying to using the draw shapes oval, rectangle etc. An example would be like in word are when you drag an oval onto the screen, the drawing resizes as the control does. The problem I am running into is actually drawing the rectangle. I am attempting to use this code here:

Rect = new Rectangle(this.Bounds.X - 10, (this.Bounds.Y -10), (this.Bounds.Width - 10), (this.Bounds.Height - 10))

I have placed this code in the Resize event. It does draw, however it seems to be reponsive to the bounds of it's container rather then the form itself. What I could like is if someone can help me figure out how to draw a rectangle close to the edges of the custom control and the drawing would resize itself as the form does. Please help!!! If anyone has any examples please email them (e-mail address removed)
 
E

Ed Kaim [MSFT]

How are you acquiring the Graphics object? You'll probably need to call
this.Parent.CreateGraphics() if you want to draw on the container.

Mike Starkey said:
I have created a transparent control and I am using to to create drawing
objects Inside the transparent objects I have created I am trying to using
the draw shapes oval, rectangle etc. An example would be like in word are
when you drag an oval onto the screen, the drawing resizes as the control
does. The problem I am running into is actually drawing the rectangle. I
am attempting to use this code here:
Rect = new Rectangle(this.Bounds.X - 10, (this.Bounds.Y -10),
(this.Bounds.Width - 10), (this.Bounds.Height - 10));
I have placed this code in the Resize event. It does draw, however it
seems to be reponsive to the bounds of it's container rather then the form
itself. What I could like is if someone can help me figure out how to draw
a rectangle close to the edges of the custom control and the drawing would
resize itself as the form does. Please help!!! If anyone has any examples
please email them (e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top