Results 1 to 10 of 10

Thread: [2005] Panel Vertical Scrollbar: scrolling it to zero or top

  1. #1

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Arrow [2005] Panel Vertical Scrollbar: scrolling it to zero or top

    When a panel's AutoScroll is set True then it will add scrollbars for navigation of the entire size of its content. What I want is to be able to set the vertical scrollbar to go to top or zero so its contents top controls will be viewable.

    Anyone who can guide me on how should this be done?

    Thank you so much!
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  2. #2
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,950

    Re: [2005] Panel Vertical Scrollbar: scrolling it to zero or top

    I think this will do it;

    Code:
    Me.AutoScrollPosition = New Point(0, 0)
    To keep a scroll in position I have used;
    Code:
            Dim ScrollPosition As Point = Me.AutoScrollPosition
            'Do stuff
            Me.AutoScrollPosition = New Point( _
            Math.Abs(ScrollPosition.X), Math.Abs(ScrollPosition.Y))

  3. #3

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: [2005] Panel Vertical Scrollbar: scrolling it to zero or top

    Thanks Bulldog, that should come in handy.

    I have searched for a method that I could use in the Panel and ScrollControlIntoView did the trick for me.
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  4. #4

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: [2005] Panel Vertical Scrollbar: scrolling it to zero or top

    Arrrggg... Its not working 100% as I've expected.

    I am actually trying to tame this bug of a ComponentOne control (DockingTab) wherein upon clicking the tabs then it will scroll the panel to body of the tab where its caption will not be visible anymore.

    This is my workaround which partially works:
    Code:
    private void c1DockingTab1_SelectedIndexChanged(object sender, EventArgs e)
            {
                panelBuilding.ScrollControlIntoView(c1DockingTab1);
            }
    But the sad thing is it will not work the first time I select a different tab but will work on succeeding tabs. And again, it will behave as stated earlier when the application lost focus! What a pain... =(

    Could anyone suggest some further workarounds I could try? One I idea that I have in mind is to 'lock' the scrolling of the panel if the scrolling was not executed by a user but that would be difficult I guess. I could try hooking some messages like mousescroll or something but perhaps there could be some other way which is more elegant.

    EDIT:
    Attach is a screenshot of what I am trying to fix.
    Attached Images Attached Images  
    Last edited by dee-u; Feb 16th, 2009 at 09:08 AM.
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  5. #5
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,950

    Re: [2005] Panel Vertical Scrollbar: scrolling it to zero or top

    Apologies if Im missing the point but cant you set;

    Panel1.AutoScrollPosition to a "point" which is equal to where you want the panel displayed?

  6. #6

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: [2005] Panel Vertical Scrollbar: scrolling it to zero or top

    Care to elaborate? It is behaving oddly even when the application just loses focus so I am not sure what event should I use.
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  7. #7
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,950

    Re: [2005] Panel Vertical Scrollbar: scrolling it to zero or top

    So what happens if when you open the tab (or whatever control it is), in that event you put;

    YourControl.AutoScrollPosition = New Point(0, 0)

  8. #8

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: [2005] Panel Vertical Scrollbar: scrolling it to zero or top

    The code I posted in post #4 behaves the same as your suggestion. I have put it in the SelectedIndexChanged of the DockingTab control. I even tried your code if it will make a difference but it did not since it will just be the same as the one I currently have.
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  9. #9
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,950

    Re: [2005] Panel Vertical Scrollbar: scrolling it to zero or top

    Since it looks like you have a small gap in H and V, then is it a Margin issue? So if in your panel you set YourControl.Margin = New Padding(0) do the scrollbars grow a little?

  10. #10

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: [2005] Panel Vertical Scrollbar: scrolling it to zero or top

    Those are not small gaps but rather two different versions where on image 1 the tab captions are still showing and on image2 the captions are now hidden since the panel has autoscrolled for some reason I am not aware of.

    In an attempt to determine what causes the scrollbar to autoscroll like that I have tried using this panel and yet both ScrollVertical and ScrollMouseWheel was not fired when it autoscrolled!

    Code:
    private void panelBuilding_ScrollVertical(object sender, ScrollEventArgs e)
    {
        Console.WriteLine(e.Type.ToString() + ':' + e.NewValue.ToString());
    }
    
    private void panelBuilding_ScrollMouseWheel(object sender, MouseEventArgs e)
    {
        Console.WriteLine("Scroll " + e.Delta.ToString() + ':' + this.panelBuilding.AutoScrollHPos.ToString());
    }
    Last edited by dee-u; Feb 16th, 2009 at 09:13 AM.
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width