I want to draw a textbox at runtime using mouse. I know I hav to use MouseUp,MouseDown and MouseMove events to do this. But i cant find the way to set textbox's height and width. Can u plz help?
A TextBox is a Windows Forms control. This site has a Windows Forms forum. Please post in the most appropriate forum for the topic. Moved.
You can set the Width property of a TextBox any time but you can't set the Height of a TextBox unless the Multiline property is set to True. You can either set the Height and Width properties individually or you can set the Size property.
[ame="http://www.vbforums.com/showthread.php?t=426684"]This[/ame] shows you how to draw a line that is bounded by a rectangle defined by two points. You can use the same logic but just use that Rectangle to set the Bounds property of your TextBox.
thnx alot. I hav been able to draw it. Now i want to embed this textbox into richtextbox. i hav used rtb.controls.add method to add it. But i want to disable the area of rtb which is under this textbox so that user cant write in this area.
OK. Can u plz tell one more thing. I hav added some code in KeyPress event of rtb. If i add textbox into this rtb, can i somehow use the same code for textbox?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.