scrollbar positionning in form

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sam

    scrollbar positionning in form

    Hi,
    When I load my form my scrollbar is always positionned automatically at
    the bottom for some reasons...
    top?

    I've used user32.dll:


    Private Const SB_VERT As Integer = 1


    Private Declare Function GetScrollPos Lib "user32.dll " ( _
    ByVal hWnd As IntPtr, _
    ByVal nBar As Integer) As Integer


    Private Declare Function SetScrollPos Lib "user32.dll " ( _
    ByVal hWnd As IntPtr, _
    ByVal nBar As Integer, _
    ByVal nPos As Integer, _
    ByVal bRedraw As Boolean) As Integer


    Public Property VScrollPos(ByVa l f As Form) As Integer
    Get
    Return GetScrollPos(CT ype(f.Handle, IntPtr), SB_VERT)
    End Get
    Set(ByVal Value As Integer)
    SetScrollPos(CT ype(f.Handle, IntPtr), SB_VERT, Value, True)

    End Set
    End Property

    Although the scrollbar is positionned correctely, the form however is
    not refresh, so the form position doesn' t correspond to my
    scrollbar's.
    I've tried a me.Refresh but it wouldn't do either...
    Can you help?


    Thx

  • Herfried K. Wagner [MVP]

    #2
    Re: scrollbar positionning in form

    "Sam" <samuel.berthel ot@voila.fr> schrieb:[color=blue]
    > When I load my form my scrollbar is always positionned automatically at
    > the bottom for some reasons...[/color]

    Take a look at the 'AutoScrollPosi tion' property.

    --
    M S Herfried K. Wagner
    M V P <URL:http://dotnet.mvps.org/>
    V B <URL:http://classicvb.org/petition/>

    Comment

    • Sam

      #3
      Re: scrollbar positionning in form

      Thanks. However that is to auto-position the scrollbar on the control
      that has the focus. What I'm doing is different as I position the
      scrollbar manually but the form doesn't 'move'.

      Can you help further ?

      Comment

      Working...