aewarnick Posted February 15, 2003 Posted February 15, 2003 I have a form that has text boxes on it and labels that I would like to resize, but when they are resized I need the other boxes to move down so that they can be seen. I know that I can manually do this by using Location=new Point(); but that will take a long time. Is there an easier way? Quote C#
*Gurus* Derek Stone Posted February 16, 2003 *Gurus* Posted February 16, 2003 I suggest you take a look at the Anchor and Dock properties which are available for each control on your form. Quote Posting Guidelines
*Gurus* Derek Stone Posted February 17, 2003 *Gurus* Posted February 17, 2003 You're going to have to do it manually, since the repositioning and resizing you're attempting is rather awkward. Quote Posting Guidelines
TechnoTone Posted February 17, 2003 Posted February 17, 2003 Create a panel to contain all the textboxes that you want to align together. Set each of them to Dock = Top and as you resize each, the ones below will move accordingly. You can then do the same thing with the labels which will go into another panel to the left of the first. Quote TT (*_*) There are 10 types of people in this world; those that understand binary and those that don't.
*Gurus* Derek Stone Posted February 17, 2003 *Gurus* Posted February 17, 2003 The problem is he's also resizing (and from what I can tell moving) the TextBoxes, meaning that a panel would only partially work. Then again, I'm not sure I completely understand what he's trying to do, so you might have hit the nail on the head. *Shrug* Quote Posting Guidelines
aewarnick Posted February 17, 2003 Author Posted February 17, 2003 You are right Derek, I am moving the other boxes down when one above it is resized because if they did not move then the user could not see the boxes under it. So, I have to do it manually in that case? And, it is awkward to do it the way I am? It seems reasonable to me? I would think alot of people would do it this way. But what do I know, I just started. Quote C#
*Gurus* Derek Stone Posted February 17, 2003 *Gurus* Posted February 17, 2003 You should take a shot at the method TechnoTone mentioned above, before you go ahead with doing it manually. But yes, what you're doing is beyond the ordinary. I'd strongly suggest organizing your data input methodology differently, either using a tabbed dialog control or a ListBox menu/panel system. Nowhere in a professionally designed business application will you see TextBoxes doing what you're having them do. It's fine, and it might work for you, but it is not the standard. Quote Posting Guidelines
aewarnick Posted February 17, 2003 Author Posted February 17, 2003 I wouldn't mind using panels but I didn't think that they would act the same as they will my way, will they? Quote C#
Cywizz Posted February 18, 2003 Posted February 18, 2003 (edited) Why don't you just add a splitter bar between each textbox, or the panels TT suggested? This will handle to resizing for you. (Set the dock style of the splitter also to top) EDIT: To clarify - use a panel to hold a label and textbox. Dock the label to left and the textbox to fill. Add this panel (which dock is set to top) to your container and add a splitter afterwards (dock set to top). Note that you will have to add these controls in reverse order to what you want to see on the screen.. Edited February 18, 2003 by Cywizz Quote Howzit??
TechnoTone Posted February 18, 2003 Posted February 18, 2003 You are right Derek, I am moving the other boxes down when one above it is resized because if they did not move then the user could not see the boxes under it. That's exactly what I thought - and that's exactly what I described with the panels. I have attached a form demonstrating what I mean: Quote TT (*_*) There are 10 types of people in this world; those that understand binary and those that don't.
*Gurus* divil Posted February 18, 2003 *Gurus* Posted February 18, 2003 Did you forget to attach it? Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
TechnoTone Posted February 18, 2003 Posted February 18, 2003 Oops! I'm sure I attached it last time. Edit: I've figured out what went wrong with my attachment. When you preview a message the attachement dissapears!resizeexample.zip Quote TT (*_*) There are 10 types of people in this world; those that understand binary and those that don't.
aewarnick Posted February 20, 2003 Author Posted February 20, 2003 Panels work exactly the way I wanted them to. Thanks, guys!! (or girls). Quote C#
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.