Hi all,
I have a form that inherits from another form.
I want to change the location of a specific control. For this I have a
method in the base form which does only this:
public virtual void SetLocation(int x, int y)
{
myControl.Location = new Point(x, y);
}
I call this method from the inheriting form, like this: base.SetLocation(0,
0);

It doesn't work. The control's location changes but not to (0,0).
When I call this method from inside the base form it does work(changes to
0,0).
It looks like the inheriting form can't touch some certain area.

Can anybody explain to me what may cause this issue, and how to solve it?
Thank you very much

Re: change location of control by Kevin

Kevin
Mon Oct 01 05:23:33 PDT 2007

The location of the Control is always relative to its container Control.
Could this be the problem?

--
HTH,

Kevin Spencer
Microsoft MVP

DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"gol" <gol@discussions.microsoft.com> wrote in message
news:19EC2F76-12B7-41E9-8AC1-555CF42342B7@microsoft.com...
> Hi all,
> I have a form that inherits from another form.
> I want to change the location of a specific control. For this I have a
> method in the base form which does only this:
> public virtual void SetLocation(int x, int y)
> {
> myControl.Location = new Point(x, y);
> }
> I call this method from the inheriting form, like this:
> base.SetLocation(0,
> 0);
>
> It doesn't work. The control's location changes but not to (0,0).
> When I call this method from inside the base form it does work(changes to
> 0,0).
> It looks like the inheriting form can't touch some certain area.
>
> Can anybody explain to me what may cause this issue, and how to solve it?
> Thank you very much
>



Re: change location of control by gol

gol
Mon Oct 01 11:18:02 PDT 2007

Thanks Kevin,
yes, I know that, but still don't know what happens here.
when reducing the size of the control, it succeeds.
It's probably something I made wrong with inheritance...
thanks anyway

"Kevin Spencer" wrote:

> The location of the Control is always relative to its container Control.
> Could this be the problem?
>
> --
> HTH,
>
> Kevin Spencer
> Microsoft MVP
>
> DSI PrintManager, Miradyne Component Libraries:
> http://www.miradyne.net
>
> "gol" <gol@discussions.microsoft.com> wrote in message
> news:19EC2F76-12B7-41E9-8AC1-555CF42342B7@microsoft.com...
> > Hi all,
> > I have a form that inherits from another form.
> > I want to change the location of a specific control. For this I have a
> > method in the base form which does only this:
> > public virtual void SetLocation(int x, int y)
> > {
> > myControl.Location = new Point(x, y);
> > }
> > I call this method from the inheriting form, like this:
> > base.SetLocation(0,
> > 0);
> >
> > It doesn't work. The control's location changes but not to (0,0).
> > When I call this method from inside the base form it does work(changes to
> > 0,0).
> > It looks like the inheriting form can't touch some certain area.
> >
> > Can anybody explain to me what may cause this issue, and how to solve it?
> > Thank you very much
> >
>
>
>