|
|
 |
 |
 |
 |
Deriving from forms
In the base form you must change the button's "Modifiers" attribute to "Public" (or "Protected", etc). Since it defaults to "Private", you cannot change it in the derived class. Hence the UI Designer blocks you from changing it there too. "Jayme.Pechan" <j @pechan.us> wrote in message news:9DFEEE03-E219-46D8-8E55-BD695F9E3243@microsoft.com...
> Is it possible to allow derived forms to change the layout of the buttons > and UI elements on a form? For example, I make Form1 with a button in the > top left corner. I then make a Form2 that derives or inherits from Form1 > and we see the button in the top left corner. I can not change the > position of the button in Form2 without changing it in Form1. I suppose > this is probably how it is supposed to work but I'd like to be able to > reposition the items on the form in Form2. Is this possible? How? > Thanks. > Jayme
On Tue, 05 Jun 2007 11:35:03 -0700, Jayme.Pechan <j @pechan.us> wrote: > Is it possible to allow derived forms to change the layout of the > buttons and UI elements on a form? For example, I make Form1 with a > button in the top left corner. I then make a Form2 that derives or > inherits from Form1 and we see the button in the top left corner. I can > not change the position of the button in Form2 without changing it in > Form1. I suppose this is probably how it is supposed to work but I'd > like to be able to reposition the items on the form in Form2. Is this > possible? How? Thanks. Not at design time, no. The base form defines the default location for the control, and this can only be changed in the base form. But your derived form certainly can rearrange things at run-time if you like. If you have a good way of programmatically determining where you want the button, then moving it in the constructor or the Load event handler may be a good alternative for you. Pete
-----------------------------------------------Reply-----------------------------------------------
On Tue, 05 Jun 2007 11:52:31 -0700, Peter Duniho <NpOeStPe @nnowslpianmk.com> wrote: > [...] > Not at design time, no. Sigh...yes, I'm a goof. Please ignore the above. Obviously you *can* have the derived class initialize the control in a new place, as long as the access to the control is set correctly. -----------------------------------------------Reply-----------------------------------------------
I believe this is incorrect: if you change the "Modifiers" on the control, in the base form, then the designer will let you move it in the derived form. Then, you can change other attributes of the control in the derived form as well (e.g. Enabled, etc). "Peter Duniho" <NpOeStPe @nnowslpianmk.com> wrote in message news:op.ttgpdtvq8jd0ej@petes-computer.local...
> On Tue, 05 Jun 2007 11:35:03 -0700, Jayme.Pechan <j @pechan.us> wrote: >> Is it possible to allow derived forms to change the layout of the >> buttons and UI elements on a form? For example, I make Form1 with a >> button in the top left corner. I then make a Form2 that derives or >> inherits from Form1 and we see the button in the top left corner. I can >> not change the position of the button in Form2 without changing it in >> Form1. I suppose this is probably how it is supposed to work but I'd >> like to be able to reposition the items on the form in Form2. Is this >> possible? How? Thanks. > Not at design time, no. The base form defines the default location for > the control, and this can only be changed in the base form. But your > derived form certainly can rearrange things at run-time if you like. If > you have a good way of programmatically determining where you want the > button, then moving it in the constructor or the Load event handler may be > a good alternative for you. > Pete
On Tue, 05 Jun 2007 11:59:47 -0700, Fred Mellender <nospamPlease_fr @frontiernet.net> wrote: > I believe this is incorrect I believe I beat you to pointing that out. :) Yes, my post was wrong...trying to do too many things at once is not good for thinking things through before posting, apparently. :) Sorry for the confusion. Pete
-----------------------------------------------Reply-----------------------------------------------
If I had a nickel for every incorrect post I made, I could buy a new computer. I happened to know the answer to this question because I spent quite a few minutes trying to figure out how to do this in a previous project. BTW, our series reinforces something I *thought* I had learned: wait a few moments before replying to a post :-) "Peter Duniho" <NpOeStPe @nnowslpianmk.com> wrote in message news:op.ttgp1xi68jd0ej@petes-computer.local...
> On Tue, 05 Jun 2007 11:59:47 -0700, Fred Mellender > <nospamPlease_fr @frontiernet.net> wrote: >> I believe this is incorrect > I believe I beat you to pointing that out. :) > Yes, my post was wrong...trying to do too many things at once is not good > for thinking things through before posting, apparently. :) Sorry for the > confusion. > Pete
That worked. thanks. Jayme "Fred Mellender" <nospamPlease_fr @frontiernet.net> wrote in message news:Mei9i.9773$B25.4425@news01.roc.ny...
> In the base form you must change the button's "Modifiers" attribute to > "Public" (or "Protected", etc). Since it defaults to "Private", you > cannot change it in the derived class. Hence the UI Designer blocks you > from changing it there too. > "Jayme.Pechan" <j@pechan.us> wrote in message > news:9DFEEE03-E219-46D8-8E55-BD695F9E3243@microsoft.com... >> Is it possible to allow derived forms to change the layout of the buttons >> and UI elements on a form? For example, I make Form1 with a button in >> the top left corner. I then make a Form2 that derives or inherits from >> Form1 and we see the button in the top left corner. I can not change the >> position of the button in Form2 without changing it in Form1. I suppose >> this is probably how it is supposed to work but I'd like to be able to >> reposition the items on the form in Form2. Is this possible? How? >> Thanks. >> Jayme
Try MyBaseControlName.Location = New Point (0, 0) MyBaseControlName.Size = new Size(100, 40)
"Jayme.Pechan" wrote: > Is it possible to allow derived forms to change the layout of the buttons > and UI elements on a form? For example, I make Form1 with a button in the > top left corner. I then make a Form2 that derives or inherits from Form1 > and we see the button in the top left corner. I can not change the position > of the button in Form2 without changing it in Form1. I suppose this is > probably how it is supposed to work but I'd like to be able to reposition > the items on the form in Form2. Is this possible? How? Thanks. > Jayme
|
 |
 |
 |
 |
|