469,613 Members | 1,940 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,613 developers. It's quick & easy.

draw box

I am new to VB.net, can anybody help me how to create a form that ask
user to enter the "WIDTH" and "HEIGHT" and draw a box display in the
textbox?

thanks
Jul 21 '05 #1
1 1658
Hi dunkonu,

This sounds a bit like homework assignment so I will explain in general
terms.
I apologize if I am wrong.

I wouldn't use a TextBox to draw the rectangle. You can draw it directly on
the form the user is inputting the width and height on. I would probably
use
a panel as a drawing control.

When the user has finished entering the size put some code in click event on
a button marked "Draw". In this event obtain a graphics object of either
the
form or the panel (the control you want to draw on).

You can use Graphics.DrawRectangle on this control.
Remember that the rectangle will be cleared if you move something in front
of the control. To keep the rectangle put the drawing code inside the
control's
Paint event or call the drawing code from the Paint event.

Tell us if you want more detailed description.

Happy Coding!
Morten Wennevik [C# MVP]
Jul 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Matt | last post: by
reply views Thread by Florida Draw | last post: by
5 posts views Thread by Matt | last post: by
2 posts views Thread by dan heskett | last post: by
3 posts views Thread by Daniel Mark | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.