Re: "Sticking" buttons to the Right Margin

  • From: "Donald Marang" <donald.marang@xxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Thu, 25 Mar 2010 08:55:22 -0400

That sounds like such a basic thing. I find it incredulous that Visual Studio can grow controls automatically but can not maintain a constant right margin! I suppose I can handle writing code to tweak these positions for the two events you mentioned. They have so many properties like margin and dock that sound like they should take care of this, I thought I was just getting confused between how to set the correct combination. However, if I manually set the placement of the "Perform OCR" button, I would probably need to go back and readjust the position of the "Browse..." button and readjust the size of the "Filename" text edit field as well. As I consider this, I should need to subtract 14 from the x location properties of these two buttons and from the x size of the text box after the standard code is executed for resize events. Do the event handlers you mentioned get performed after the normal processing, before the normal processing, or do I need to explicitly call the normal event processing within my event handlers?

Don Marang

From: "Martin Slack" <m.g.slack@xxxxxxxxxxxx>
Sent: Thursday, March 25, 2010 3:43 AM
To: <programmingblind@xxxxxxxxxxxxx>
Subject: Re: "Sticking" buttons to the Right Margin

Hi Don,

I guess the simple but boring answer is to read the window size in the form's Resize or ResizeEnd event and then code your spacing calculation on the fly within the same event.

I did think that a control's margin property was intended to keep them from overlapping, but I can't see how to make them honour the setting.


----- Original Message ----- From: "Donald Marang" <donald.marang@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Thursday, March 25, 2010 12:24 AM
Subject: "Sticking" buttons to the Right Margin

In my QuickOCR Visual Basic .Net application I wrote in Visual Studio 2008, I have not been able to get the right side alignment correct. My last message had a little better description of the application. I have the source code and more information available at:

My design layout issue is that the original, and I think minimum size of the main window is 450 x 500. I want it expandable to the full size of the screen if necessary. When expanded I want the "Perform OCR" and "Exit" buttons to stick to the right side of the window, while retaining a 14 pt spacing between the button and the right side of the window. I also want the Text "Results" rich text box and the "Filename" text vbox to grow as well. These boxes grow properly, but I have the same problem with the rich text box as with the buttons. As the window grows, these controls get jammed up against the right side of the window. So far the location and size properties have been calculated to provide the correct spaceing when set the designed size. How should this be accomplished? I have randomly attempted to use other settings, but have not ran across the right combination.

Don Marang
View the list's information and change your settings at

View the list's information and change your settings at

Other related posts: