Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
I have a panel with autoscroll set to true, and I would like to set the scroll position. I cut and pasting some examples from online using the API calls, but nothing worked. Can anybody help me out?
  • Administrators
Posted

Could you give a bit more detail about what you are trying to do - is it set the scroll to an absolute position or simply allow a particular control to be visible? If the latter then the panel has a ScrollControlIntoView method which does it for you.

If you need to set it to a particular position how are you attempting this? Could you post your existing code? Also is there a reason why you are resorting to API calls rather than the native .Net functionality to achieve this?

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted
Could you give a bit more detail about what you are trying to do - is it set the scroll to an absolute position or simply allow a particular control to be visible? If the latter then the panel has a ScrollControlIntoView method which does it for you.

If you need to set it to a particular position how are you attempting this? Could you post your existing code? Also is there a reason why you are resorting to API calls rather than the native .Net functionality to achieve this?

 

I'm attempting the former.

I've resorted to the API calls, because the native .NET functionality, which I assume means the AutoScrollPosition property, didn't work either.

  • Administrators
Posted

What do you mean by didn't work? Just had a quick play with the autoscrollposition property and it certainly scrolled the control around okay.

Could you post your code and a brief description of what it should do - it's a lot easier to see problems when the code is visible.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted
What do you mean by didn't work? Just had a quick play with the autoscrollposition property and it certainly scrolled the control around okay.

Could you post your code and a brief description of what it should do - it's a lot easier to see problems when the code is visible.

 

panel1.AutoScrollPosition = new Point(0, 300);

  • Administrators
Posted
Worked perfectly well here - are you trying to scroll vertically or horizontally? Your code will scroll it vertically down by 300 pixels from it's start position - if the scroll bar is already 300 pixels down then it will not appear to move.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted
Worked perfectly well here - are you trying to scroll vertically or horizontally? Your code will scroll it vertically down by 300 pixels from it's start position - if the scroll bar is already 300 pixels down then it will not appear to move.

 

I am trying to scroll vertically.

The default position of the scroll bars is 0,0. So I'm assuming this means the scroll bar is not 300 pixels down.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...