Control Postion

V

VJ

I have a form with a Panel. The Panel will have scroll bars. There is one
control in the form who's Y is fixed, but I want the X to be always to the
left edge of the screen. How do I do that?

Vijay
 
V

VJ

Ok my bad.. I was not clear on that need. I want the control to display
within the left edge of the screen.

Vijay
 
P

Peter Oliphant

Ok, the obvious answer:

Control->Left = 0 ; // or like 10 for spacing...

Since a control's Left (which is its X) position is relative to it's
parent's left edge. And I'm unclear as to what the Panel has to do with
anything here?

[==P==]
 
V

VJ

oops really my bad again.. the control is in the panel and its Y is fixed.
I want it to appear within the right edge of the panel always i.e even as
the user scrolls, the X should dynamically change

For a moment I was like how did I miss that..

VJ

Peter Oliphant said:
Ok, the obvious answer:

Control->Left = 0 ; // or like 10 for spacing...

Since a control's Left (which is its X) position is relative to it's
parent's left edge. And I'm unclear as to what the Panel has to do with
anything here?

[==P==]

VJ said:
Ok my bad.. I was not clear on that need. I want the control to display
within the left edge of the screen.

Vijay
 
P

Peter Oliphant

I have to run, but a quick pointing in hopefully the right direction:

You want to add a handler for the Scroll event of the Panel class that finds
out how much the panel has been scrolled vertically and/or horizontally and
position your control relative to the upper left hand corner of the panel
based on the amount that has been scrolled...

http://msdn2.microsoft.com/en-us/library/system.windows.forms.scrollablecontrol.scroll.aspx

[==P==]


VJ said:
oops really my bad again.. the control is in the panel and its Y is
fixed. I want it to appear within the right edge of the panel always i.e
even as the user scrolls, the X should dynamically change

For a moment I was like how did I miss that..

VJ

Peter Oliphant said:
Ok, the obvious answer:

Control->Left = 0 ; // or like 10 for spacing...

Since a control's Left (which is its X) position is relative to it's
parent's left edge. And I'm unclear as to what the Panel has to do with
anything here?

[==P==]

VJ said:
Ok my bad.. I was not clear on that need. I want the control to display
within the left edge of the screen.

Vijay

I have a form with a Panel. The Panel will have scroll bars. There is
one control in the form who's Y is fixed, but I want the X to be always
to the left edge of the screen. How do I do that?

Vijay
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top