Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

Search Results for "scrollbar" in [All]

user32

.
Summary
.

static extern bool EnableScrollBar(IntPtr hWnd, uint wSBflags, uint wArrows);

.

Private Shared Function EnableScrollBar(ByVal hWnd As IntPtr, <MarshalAs(UnmanagedType.U4)>wSBflags As SBFlags, <MarshalAs(UnmanagedType.U4)>wArrows As SBArrows) As <MarshalAs(UnmanagedType.Bool)>Boolean

.

Public Declare Function EnableScrollBar Lib "user32" _

.

    static extern bool EnableScrollBar(IntPtr hWnd, uint wSBflags, uint wArrows);

.

    private void DisableHScrollBar(Control control)

.

        EnableScrollBar(control.Handle, (uint)SBTYPES.SB_HORZ, (uint)SBArrows.ESB_DISABLE_BOTH);

.
Documentation
[EnableScrollBar] on MSDN
.

/// <param name="parentControl">The parent window of the scrollbar.</param>

.

/// <returns>Handle to the scrollbar window.</returns>

.

private IntPtr GetHandleToHorizontalScrollBar(Control parent)

.

        "WindowsForms10.SCROLLBAR.app.0." + appDomainHexedHash, // Class name to seek (viewable in the Spy++ tool)

.

/// <param name="parentControl">The parent window of the scrollbar.</param>

.

/// <returns>Handle to the scrollbar window.</returns>

.

private IntPtr GetHandleToHorizontalScrollBar(Control parent)

.

        "WindowsForms10.SCROLLBAR.app.0." + appDomainHexedHash, // Class name to seek (viewable in the Spy++ tool)

.
Summary
.

[DllImport( "user32.dll", SetLastError=true,  EntryPoint="GetScrollBarInfo")]

.

private static extern int GetScrollBarInfo(IntPtr hWnd, uint idObject, ref SCROLLBARINFO psbi);

.

public struct SCROLLBARINFO

.

    public Rectangle rcScrollBar;

.

This didn't work for me with the Rectangle type for SCROLLBARINFO.rcScrollBar. To rectify this I altered this declaration to type RECT using the following standard definition.

.

SCROLLBARINFO psbi = new SCROLLBARINFO();

.

int nResult = GetScrollBarInfo(this.Handle, OBJID_CLIENT, ref psbi); // "this" is a scrollbar

.

if you have a reference to a System.Windows.Forms.ScrollBar, use it's properties. otherwise,

.

SystemInformation.HorizontalScrollbar*

.

SystemInformation.VerticalScrollbar*

.
Documentation
[GetScrollBarInfo] on MSDN
. .

Declare Function GetScrollInfo Lib "user32" (ByVal hWnd As IntPtr, ByVal fnBar As ScrollBarDirection, ByRef lpsi As SCROLLINFO) As Integer

.

//  such that no horizontal scrollbar will be needed

.

      int SCROLLBARWIDTH = SystemInformation.VerticalScrollBarWidth;

.

      GetScrollInfo( RichTextBox1.Handle, (int) ScrollBarDirection.SB_HORZ, ref si );

.

      int iWidth = si.nMax - si.nMin + 2 * BORDERWIDTH + SCROLLBARWIDTH + 2;    

.

    Private Function GetScrollBarPageSize(ByVal hWnd As IntPtr, ByVal fnBar As Integer) As Integer

.
Summary
Gets the ScrollBar Position for a given Control/Window.
.
SystemColors.ScrollBar CTLCOLOR_MSGBOX, COLOR_SCROLLBAR
.
SystemColors.Window CTLCOLOR_SCROLLBAR, COLOR_WINDOW
.

This allows you to smoothly increment the scrollbar, instead of relying on the inconsistent wheel delta,

.

unsafe private void hScrollBar1_Scroll( object sender, ScrollEventArgs e )

.

   ScrollDelta = FPosition - e.NewValue; // FPosition is the previous scrollbar position

.

      ScrollRect.Right = this.Width - SystemInformation.VerticalScrollBarWidth;

.
Summary
.

public static extern bool ShowScrollBar(IntPtr hWnd, int wBar, [MarshalAs(UnmanagedType.Bool)] bool bShow);

.

Private Declare Function ShowScrollBar Lib "user32" (ByVal hwnd As Long, ByVal wBar As Long, ByVal bShow As Long) As Long

.

http://www.vb-helper.com/howto_show_hide_text_scrollbar.html

.

http://www.vb-helper.com/howto_show_hide_both_scrollbars.html

.
Title
Show a TextBox's vertical scrollbar only when it is necessary
.
Keywords
.

In the TextBox's Change event handler, use the PictureBox's TextHeight function to see how tall the text is. If the text is too big to fit in the TextBox, we need to display the scrollbar. If the need for the scrollbar has changed, use the ShowScrollBar API function to show or hide it.

.

Private m_ScrollBarVisible As Boolean

.

Private Declare Function ShowScrollBar Lib "user32" (ByVal _

.

Dim needs_scrollbar As Boolean

.

    ' See if we need the scrollbar.

.

    needs_scrollbar = _

.

    If needs_scrollbar <> m_ScrollBarVisible Then

.

    ' Show or hide the scrollbar.

.

    m_ScrollBarVisible = needs_scrollbar

.

    ShowScrollBar txtValue.hwnd, SB_VERT, _

.

        m_ScrollBarVisible

.
Documentation
[ShowScrollBar] on MSDN
.

Public Shared Function ShowScrollBar(ByVal hWnd As System.IntPtr, ByVal wBar As Integer, ByVal bShow As Boolean) As Boolean

.

Call ShowScrollBar(hWnd1, SB_VERT, mytrue)

uxtheme

.

    // Horizontal Scrollbar States

.

    // Vertical Scrollbar States

Constants

12: COLOR_
.

            COLOR_SCROLLBAR = 0,

.

        SCROLLBAR = 0,

.

    COLOR_SCROLLBAR = 0

13: EM_
.
EM_SHOWSCROLLBAR WM_USER + 96 TODO
.

    SHOWSCROLLBAR = WM.USER + 96,

.

        public const uint WS_EX_LEFTSCROLLBAR     = 0x00004000;

.

        public const uint WS_EX_RIGHTSCROLLBAR    = 0x00000000;

.

    WS_EX_LEFTSCROLLBAR    = 0x00004000,

.

    WS_EX_RIGHTSCROLLBAR   = 0x00000000,

.

  WS_EX_LEFTSCROLLBAR = 16384

.

  WS_EX_RIGHTSCROLLBAR = 0

.

        public const int ERROR_NO_SCROLLBARS = 1447;

.

        public const int ERROR_INVALID_SCROLLBAR_RANGE = 1448;

16: WM
.
WM_CTLCOLORSCROLLBAR 0x137 The WM_CTLCOLORSCROLLBAR message is sent to the parent window of a scroll bar control when the control is about to be drawn. By responding to this message, the parent window can use the display context handle to set the background color of the scroll bar control.
.

private const UInt32 WM_CTLCOLORSCROLLBAR      = 0x0137;

.

   WM_CTLCOLORSCROLLBAR = &H137

.

WM_CTLCOLORSCROLLBAR      equ 137h

coredll

.

Thanks to: http://www.codeproject.com/Articles/10839/How-to-change-scrollbars-position-in-a-multiline-t

.

    public static void set_scrollbar(IntPtr Handle, int Row)

.

    /// 0 COLOR_SCROLLBAR Color of the gray area of a scroll bar.

.

    public const int COLOR_SCROLLBAR = (0 | SYS_COLOR_INDEX_FLAG);

.

            COLOR_SCROLLBAR,            

.

            Color.Transparent.ToArgb() & 0x00ffffff,     //COLOR_SCROLLBAR

Structures

.
Summary
SCROLLINFO - Scrollbar information
.
      • COLOR_SCROLLBAR
.
      • COLOR_SCROLLBAR

Enums

.
Summary
SBArrows - Scrollbar Arrow settings
.
Summary
SBFlags - Scrollbar flags
.

public enum ScrollBarCommands {

.

Enum ScrollBarCommands

.
Documentation
[ScrollBarCommands] on MSDN
.

public enum ScrollBarConstants {

.

Public Enum ScrollBarConstants

.
Documentation
[ScrollBarConstants] on MSDN
.

    /// The WM_CTLCOLORSCROLLBAR message is sent to the parent window of a scroll bar control when the control is about to be drawn. By responding to this message, the parent window can use the display context handle to set the background color of the scroll bar control.

.

    CTLCOLORSCROLLBAR = 0x0137,

.

    '''The WM_CTLCOLORSCROLLBAR message is sent to the parent window of a scroll bar control when the control is about to be drawn. By responding to this message the parent window can use the display context handle to set the background color of the scroll bar control.

.

    WM_CTLCOLORSCROLLBAR = &H137

.

    WS_EX_LEFTSCROLLBAR = 0x00004000,

.

    WS_EX_RIGHTSCROLLBAR = 0x00000000,

.

    WS_EX_LEFTSCROLLBAR = 0x00004000,

.

    WS_EX_RIGHTSCROLLBAR = 0x00000000,

.

    WS_EX_LEFTSCROLLBAR = &H4000

.

    WS_EX_RIGHTSCROLLBAR = &H0

.

    WS_EX_LEFTSCROLLBAR As Long = &H4000

.

    WS_EX_RIGHTSCROLLBAR As Long = &H0

.

    WS_EX_LEFTSCROLLBAR = 0x00004000,

.

    WS_EX_RIGHTSCROLLBAR = 0x00000000,

.

    WS_EX_LEFTSCROLLBAR = &H4000

.

    WS_EX_RIGHTSCROLLBAR = &H0

.

    WS_EX_LEFTSCROLLBAR As Long = &H4000

.

    WS_EX_RIGHTSCROLLBAR As Long = &H0


 
Access PInvoke.net directly from VS: