Click here to Skip to main content
15,905,504 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi Programmers


I have problem i can able to draw a rectangle now, but my question is i want to name the length and width of the rectangle with its size in windows form

Eg shown in Diagram

200cm
____________________
| |
| |
| |
100cm | |
|___________________|
Posted
Comments
[no name] 26-Aug-13 6:35am    
How is that a problem? Where is the question? What does "name the length" mean?
abbaspirmoradi 26-Aug-13 6:40am    
put your code here. are you use like Rectangle rect = new Rectangle(0, 0, 50, 50); for draw your Rectangle?
kiran murkal 26-Aug-13 6:57am    
Thanks For ur Replay

Yes i am using Rectangle rect = new Rectangle(0, 0, 50, 50); to draw Rectangle

now i want to name the widt=50 on above the width line and length =50 on side of the length line thanku
muneebalikiyani 26-Aug-13 6:41am    
Hi, the details you have provided are not enough , Where are you drawing rectangle ? if you are using Graphics object , this link will help you
http://msdn.microsoft.com/en-us/library/76c5db29.aspx
ZurdoDev 26-Aug-13 7:33am    
Do you mean you want to enter the values in a text box and then generate the rectangle based on what they type in?

1 solution

Exactly how you do this depends to a large extent on how you are drawing your rectangle. If you are handling the paint event of a UserControl, then it's pretty easy - just use the Graphics.DrawString method to add the text (once you have offset the actual rectangle far enough away).

If you are doing it differently, then it may take more work, but we would need a lot more detail about how you are doing it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900