本文整理汇总了C#中SCROLLINFO类的典型用法代码示例。如果您正苦于以下问题:C# SCROLLINFO类的具体用法?C# SCROLLINFO怎么用?C# SCROLLINFO使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SCROLLINFO类属于命名空间,在下文中一共展示了SCROLLINFO类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DetailsListView
public DetailsListView()
{
AllowColumnReorder = true;
Dock = DockStyle.Fill;
FullRowSelect = true;
HideSelection = false;
Location = new Point(0, 0);
Margin = new Padding(0);
Name = string.Format("CList{0}", Environment.TickCount);
ShowItemToolTips = true;
Size = new Size(380, 260);
UseCompatibleStateImageBehavior = false;
View = View.Details;
OwnerDraw = true;
VirtualMode = true;
AllowDrop = true;
View = View.Details;
FullRowSelect = true;
HideSelection = false;
DoubleBuffered = true;
_scrollInfo = new SCROLLINFO
{
cbSize = (uint)Marshal.SizeOf(_scrollInfo),
fMask = (uint)ScrollInfoMask.SIF_POS
};
}
示例2: ScrolledToBottom
private bool ScrolledToBottom()
{
Scroll = new SCROLLINFO();
Scroll.size = Convert.ToUInt32(Marshal.SizeOf(Scroll));
Scroll.mask = 7;
if (!GetScrollInfo(Handle, 1, ref Scroll))
return true;
return (Scroll.page == 0) || ((Scroll.page + Scroll.position) >= Scroll.max);
}
示例3: GetScrollInfoStruct
private SCROLLINFO GetScrollInfoStruct(RichTextBox tbb)
{
SCROLLINFO SCInfo = new SCROLLINFO();
SCInfo.cbSize = (uint)Marshal.SizeOf(SCInfo); //この2行は必須
SCInfo.fMask = (int)ScrollInfoMask.SIF_ALL;
GetScrollInfo(tbb.Handle, (int)ScrollBarDirection.SB_VERT, ref SCInfo);
return SCInfo;
}
示例4: IsEndOfScroll
private bool IsEndOfScroll()
{
SCROLLINFO SCInfo = new SCROLLINFO();
SCInfo.cbSize = (uint)Marshal.SizeOf(SCInfo); //この2行は必須
SCInfo.fMask = (int)ScrollInfoMask.SIF_ALL;
GetScrollInfo(rTextBoxOut.Handle, (int)ScrollBarDirection.SB_VERT, ref SCInfo);
if (SCInfo.nPos >= SCInfo.nMax - Math.Max(SCInfo.nPage, 0))
{
return true;
}
return false;
}
示例5: SetScrollBar
public void SetScrollBar(int Position, uint Page, int nMin, int nMax, out int TrackPosition)
{
SCROLLINFO VScrInfo = new SCROLLINFO();
GetScrollInfo(this.Handle, (int)ScrollBarDirection.SB_HORZ, ref VScrInfo);
VScrInfo.cbSize = (uint)Marshal.SizeOf(VScrInfo);
VScrInfo.nPos = Position;
VScrInfo.nPage = Page;
VScrInfo.nMin = nMin;
VScrInfo.nMax = nMax;
TrackPosition = VScrInfo.nTrackPos;
VScrInfo.fMask = (int)ScrollInfoMask.SIF_POS + (int)ScrollInfoMask.SIF_PAGE
+ (int)ScrollInfoMask.SIF_RANGE + (int)ScrollInfoMask.SIF_DISABLENOSCROLL;
SetScrollInfo(this.Handle, (int)ScrollBarDirection.SB_HORZ, ref VScrInfo, true);
}
示例6: GetScrollPosition
public bool GetScrollPosition(out int ScrollY)
{
SCROLLINFO ScrollInfo = new SCROLLINFO();
ScrollInfo.cbSize = Marshal.SizeOf(ScrollInfo);
ScrollInfo.fMask = SIF_ALL;
if(GetScrollInfo(Handle, SB_VERT, ScrollInfo) == 0)
{
ScrollY = 0;
return false;
}
else
{
ScrollY = ScrollInfo.nPos;
return true;
}
}
示例7: Scroll
public void Scroll(int pixels)
{
var si = new SCROLLINFO();
si.cbSize = (uint)Marshal.SizeOf(si);
si.fMask = (uint)ScrollInfoMask.SIF_ALL;
GetScrollInfo(Handle, (int)ScrollBarDirection.SB_VERT, ref si);
si.nPos += pixels;
if (si.nPos < 0)
{
si.nPos = 0; // stop scrolling from wrapping around at the top
}
SetScrollInfo(Handle, (int)ScrollBarDirection.SB_VERT, ref si, true);
var ptrWparam = new IntPtr(SB_THUMBTRACK + 0x10000 * si.nPos);
var ptrLparam = new IntPtr(0);
SendMessage(Handle, WM_VSCROLL, ptrWparam, ptrLparam);
}
示例8: if
// Workaround for only partially visible list view items
/* public static void EnsureVisible(ListView lv, int nIndex, bool bPartialOK)
{
Debug.Assert(lv != null); if(lv == null) return;
Debug.Assert(nIndex >= 0); if(nIndex < 0) return;
Debug.Assert(nIndex < lv.Items.Count); if(nIndex >= lv.Items.Count) return;
int nPartialOK = (bPartialOK ? 1 : 0);
try
{
NativeMethods.SendMessage(lv.Handle, LVM_ENSUREVISIBLE,
new IntPtr(nIndex), new IntPtr(nPartialOK));
}
catch(Exception) { Debug.Assert(false); }
} */
public static int GetScrollPosY(IntPtr hWnd)
{
try
{
SCROLLINFO si = new SCROLLINFO();
si.cbSize = (uint)Marshal.SizeOf(si);
si.fMask = (uint)ScrollInfoMask.SIF_POS;
if(GetScrollInfo(hWnd, (int)ScrollBarDirection.SB_VERT, ref si))
return si.nPos;
Debug.Assert(false);
}
catch(Exception) { Debug.Assert(false); }
return 0;
}
示例9: GetScrollInfo
public static extern int GetScrollInfo(int hwnd, int n, ref SCROLLINFO lpScrollInfo);
示例10: GetScrollInfo
public static extern bool GetScrollInfo(IntPtr hWnd, int fnBar, SCROLLINFO si);
示例11: GetScrollInfo
private static extern bool GetScrollInfo(IntPtr hwnd, int fnBar, ref SCROLLINFO lpsi);
示例12: scrollHoz
void scrollHoz(IntPtr handle, int pixels)
{
scrollLB(handle);
//ShowScrollBar(handle, (int)ScrollBarDirection.SB_HORZ, (bool)false);
// Get current scroller posion
SCROLLINFO si = new SCROLLINFO();
si.cbSize = (uint)Marshal.SizeOf(si);
si.fMask = (uint)ScrollInfoMask.SIF_ALL;
GetScrollInfo(handle, (int)ScrollBarDirection.SB_HORZ, ref si);
// Increase posion by pixles
si.nPos += pixels;
if (si.nPos > (si.nMax - si.nPage) * 1.5) si.nPos = (int)((si.nMax - si.nPage) * 1.5);
if (si.nPos < 0) si.nPos = 0;
/*
if (si.nPos < (si.nMax - si.nPage))
si.nPos += pixels;
else
{
SendMessage(handle, WM_HSCROLL, (IntPtr)ScrollBarCommands.SB_PAGERIGHT, IntPtr.Zero);
}
*/
// Reposition scroller
SetScrollInfo(handle, (int)ScrollBarDirection.SB_HORZ, ref si, true);
// Send a WM_HSCROLL scroll message using SB_THUMBTRACK as wParam
// SB_THUMBTRACK: low-order word of wParam, si.nPos high-order word of wParam
SendMessage(handle, WM_HSCROLL, (IntPtr)(ScrollBarCommands.SB_THUMBTRACK + 0x10000 * si.nPos), IntPtr.Zero);
}
示例13: GetScroll
private SCROLLINFO GetScroll()
{
SCROLLINFO si = new SCROLLINFO();
si.cbSize = Marshal.SizeOf(si);
si.fMask = SIF_PAGE | SIF_POS | SIF_RANGE;
GetScrollInfo(this.Handle, SB_VERT, ref si);
return si;
}
示例14: scroll
// Scrolls a given textbox. handle: an handle to our textbox. pixels: number of pixels to scroll.
long scroll(IntPtr handle, int pixels)
{
long pixelsToEnd = 0;
IntPtr ptrLparam = new IntPtr(0);
IntPtr ptrWparam;
// Get current scroller posion
SCROLLINFO si = new SCROLLINFO();
si.cbSize = (uint)Marshal.SizeOf(si);
si.fMask = (uint)ScrollInfoMask.SIF_ALL;
GetScrollInfo(handle, (int)ScrollBarDirection.SB_VERT, ref si);
// Increase posion by pixles
pixelsToEnd = (si.nMax - si.nPage) - (si.nPos + pixels);
if (si.nPos < (si.nMax - si.nPage))
si.nPos += pixels;
else
{
ptrWparam = new IntPtr(SB_ENDSCROLL);
t.Enabled = false;
SendMessage(handle, WM_VSCROLL, ptrWparam, ptrLparam);
}
// Reposition scroller
SetScrollInfo(handle, (int)ScrollBarDirection.SB_VERT, ref si, true);
// Send a WM_VSCROLL scroll message using SB_THUMBTRACK as wParam
// SB_THUMBTRACK: low-order word of wParam, si.nPos high-order word of wParam
ptrWparam = new IntPtr(SB_THUMBTRACK + 0x10000 * si.nPos);
SendMessage(handle, WM_VSCROLL, ptrWparam, ptrLparam);
return pixelsToEnd;
}
示例15: GetScrollInfo
private static extern bool GetScrollInfo(IntPtr handle, int bar, ref SCROLLINFO info);