📄 scroll_widget.cs
字号:
ms_host_procscrolls_map.get_Item(this.m_host.Handle).hscroll = null;
}
if ((ms_host_procscrolls_map.get_Item(this.m_host.Handle).vscroll == null) && (ms_host_procscrolls_map.get_Item(this.m_host.Handle).hscroll == null))
{
win32api_wrapper.SetWindowLong(this.m_host.Handle, -4, ms_host_procscrolls_map.get_Item(this.m_host.Handle).hostproc);
ms_host_procscrolls_map.Remove(this.m_host.Handle);
}
}
this.m_host = null;
}
if (((host != null) && host.IsHandleCreated) && (IntPtr.Zero != host.Handle))
{
if (!ms_host_procscrolls_map.ContainsKey(host.Handle))
{
ms_host_procscrolls_map.set_Item(host.Handle, new hostproc_scrolls(win32api_wrapper.SetWindowLong(host.Handle, -4, ms_host_wndproc)));
}
if (this.vertical)
{
ms_host_procscrolls_map.get_Item(host.Handle).vscroll = this;
}
else
{
ms_host_procscrolls_map.get_Item(host.Handle).hscroll = this;
}
this.m_host = host;
this.on_update_pos(false);
}
}
protected abstract void on_click_back_button();
protected abstract void on_click_prev_button();
protected void on_drag_thumb(Point pt)
{
if (this.m_host != null)
{
IntPtr handle = this.m_host.Handle;
}
else
{
return;
}
uint num = !this.m_for_pane ? 4 : 5;
if (this.m_hook_host)
{
win32api_wrapper.SCROLLINFO si = new win32api_wrapper.SCROLLINFO();
si.cbSize = 0x1c;
si.fMask = 0x17;
win32api_wrapper.GetScrollInfo(this.m_host.Handle, this.vertical ? 1 : 0, ref si);
if ((0 <= si.nMax) && (si.nMax >= si.nPage))
{
Rectangle rcPrevArrow = new Rectangle();
Rectangle rcBackArrow = new Rectangle();
this.calculate_arrows_rect(ref rcPrevArrow, ref rcBackArrow);
if (this.vertical)
{
int num2 = ((base.ClientRectangle.Height - rcPrevArrow.Height) - rcBackArrow.Height) - this.m_thumb_rect.Height;
if (0 < num2)
{
int num3 = pt.Y - (this.m_thumb_rect.Top + this.m_last_hit_thumb_pos);
int nPos = si.nPos + ((int) ((num3 * ((si.nMax - si.nPage) + 1)) / ((double) num2)));
if (nPos < 0)
{
nPos = 0;
}
else if (nPos > ((si.nMax - si.nPage) + 1))
{
nPos = (si.nMax - ((int) si.nPage)) + 1;
}
int num5 = nPos << 0x10;
win32api_wrapper.SendMessage(this.m_host.Handle, 0x115, (IntPtr) (num5 + num), IntPtr.Zero);
win32api_wrapper.SetScrollPos(this.m_host.Handle, 1, nPos, true);
}
}
else
{
int num6 = ((base.ClientRectangle.Width - rcPrevArrow.Width) - rcBackArrow.Width) - this.m_thumb_rect.Width;
if (0 < num6)
{
int num7 = pt.X - (this.m_thumb_rect.Left + this.m_last_hit_thumb_pos);
int num8 = si.nPos + ((int) ((num7 * ((si.nMax - si.nPage) + 1)) / ((double) num6)));
if (num8 < 0)
{
num8 = 0;
}
else if (num8 > ((si.nMax - si.nPage) + 1))
{
num8 = (si.nMax - ((int) si.nPage)) + 1;
}
int num9 = num8 << 0x10;
win32api_wrapper.SendMessage(this.m_host.Handle, 0x114, (IntPtr) (num9 + num), IntPtr.Zero);
win32api_wrapper.SetScrollPos(this.m_host.Handle, 0, num8, true);
}
}
}
}
}
protected void on_end_drag_thumb(Point pt)
{
if (this.m_host != null)
{
IntPtr handle = this.m_host.Handle;
}
else
{
return;
}
if (this.m_hook_host)
{
if (this.vertical)
{
win32api_wrapper.SendMessage(this.m_host.Handle, 0x115, (IntPtr) 8, IntPtr.Zero);
}
else
{
win32api_wrapper.SendMessage(this.m_host.Handle, 0x114, (IntPtr) 8, IntPtr.Zero);
}
}
}
protected void on_host_destroy()
{
this.host = null;
}
protected abstract void on_scroll_line_back();
protected abstract void on_scroll_line_prev();
protected void on_slide_tick(object sender, EventArgs args)
{
if (this.m_host != null)
{
IntPtr handle = this.m_host.Handle;
}
else
{
return;
}
switch (this.m_togglingpos)
{
case toggleingpos_type.prev_button:
if (!this.m_hook_host)
{
this.on_scroll_line_prev();
return;
}
if (!this.vertical)
{
win32api_wrapper.SendMessage(this.m_host.Handle, 0x114, IntPtr.Zero, IntPtr.Zero);
return;
}
win32api_wrapper.SendMessage(this.m_host.Handle, 0x115, IntPtr.Zero, IntPtr.Zero);
return;
case toggleingpos_type.back_button:
if (!this.m_hook_host)
{
this.on_scroll_line_back();
return;
}
if (!this.vertical)
{
win32api_wrapper.SendMessage(this.m_host.Handle, 0x114, (IntPtr) 1, IntPtr.Zero);
return;
}
win32api_wrapper.SendMessage(this.m_host.Handle, 0x115, (IntPtr) 1, IntPtr.Zero);
return;
case toggleingpos_type.tunnel:
this.click_tunnel(base.PointToClient(Control.MousePosition));
return;
}
this.m_slide_timer.Enabled = false;
}
protected void on_startup_tick(object sender, EventArgs args)
{
this.m_startup_timer.Enabled = false;
this.m_slide_timer.Enabled = true;
}
protected void on_update_pos(bool fForceVisable)
{
if (this.m_host != null)
{
win32api_wrapper.RECT rcWnd = new win32api_wrapper.RECT();
if (win32api_wrapper.GetWindowRect(this.m_host.Handle, ref rcWnd))
{
win32api_wrapper.RECT rcClient = new win32api_wrapper.RECT();
if (win32api_wrapper.GetClientRect(this.m_host.Handle, ref rcClient))
{
win32api_wrapper.POINT ptOut = new win32api_wrapper.POINT();
ptOut.x = rcWnd.left;
ptOut.y = rcWnd.top;
if (win32api_wrapper.ScreenToClient(win32api_wrapper.GetParent(this.m_host.Handle), ref ptOut))
{
win32api_wrapper.POINT point2 = new win32api_wrapper.POINT();
point2.x = rcWnd.right;
point2.y = rcWnd.bottom;
if (win32api_wrapper.ScreenToClient(win32api_wrapper.GetParent(this.m_host.Handle), ref point2))
{
int windowLong = (int) win32api_wrapper.GetWindowLong(this.m_host.Handle, -16);
int num2 = (int) win32api_wrapper.GetWindowLong(this.m_host.Handle, -20);
bool flag = fForceVisable || win32api_wrapper.IsWindowVisible(this.m_host.Handle);
int systemMetrics = win32api_wrapper.GetSystemMetrics(2);
int num4 = win32api_wrapper.GetSystemMetrics(3);
bool flag2 = fForceVisable || ((0x200000 & windowLong) == 0x200000);
bool flag3 = fForceVisable || ((0x100000 & windowLong) == 0x100000);
Point point3 = new Point();
Size size = new Size();
if (this.vertical)
{
if (flag && !flag2)
{
flag = false;
}
if (flag)
{
if (this.m_cover_host)
{
if ((0x4000 & num2) == 0x4000)
{
point3.X = ptOut.x + ((((rcWnd.right - rcWnd.left) - systemMetrics) - (rcClient.right - rcClient.left)) / 2);
}
else
{
point3.X = (point2.x - systemMetrics) - ((((rcWnd.right - rcWnd.left) - systemMetrics) - (rcClient.right - rcClient.left)) / 2);
}
if (flag3)
{
point3.Y = ptOut.y + ((((rcWnd.bottom - rcWnd.top) - num4) - (rcClient.bottom - rcClient.top)) / 2);
if (point3.Y < ptOut.y)
{
point3.Y += num4 / 2;
}
}
else
{
point3.Y = ptOut.y + (((rcWnd.bottom - rcWnd.top) - (rcClient.bottom - rcClient.top)) / 2);
}
size.Width = systemMetrics;
if (this.m_stylized_mode)
{
size.Height = (rcClient.bottom - rcClient.top) + point3.Y;
point3.Y = 0;
}
else
{
size.Height = rcClient.bottom - rcClient.top;
}
if ((rcWnd.right - rcWnd.left) < ((systemMetrics + rcClient.right) - rcClient.left))
{
flag = false;
}
}
else
{
if ((0x4000 & num2) == 0x4000)
{
point3.X = ptOut.x - systemMetrics;
}
else
{
point3.X = point2.x;
}
point3.Y = ptOut.y;
size.Width = systemMetrics;
size.Height = rcWnd.bottom - rcWnd.top;
}
}
}
else
{
if (flag && !flag3)
{
flag = false;
}
if (flag)
{
if (this.m_cover_host)
{
bool flag5 = (0x4000 & num2) == 0x4000;
if (flag2)
{
if (flag5)
{
point3.X = (ptOut.x + ((((rcWnd.right - rcWnd.left) - (rcClient.right - rcClient.left)) - num4) / 2)) + num4;
}
else
{
point3.X = ptOut.x + ((((rcWnd.right - rcWnd.left) - (rcClient.right - rcClient.left)) - num4) / 2);
if (point3.X < ptOut.x)
{
point3.X += num4 / 2;
}
}
}
else
{
point3.X = ptOut.x + (((rcWnd.right - rcWnd.left) - (rcClient.right - rcClient.left)) / 2);
}
point3.Y = (point2.y - num4) - ((((rcWnd.bottom - rcWnd.top) - (rcClient.bottom - rcClient.top)) - num4) / 2);
if (this.m_stylized_mode)
{
size.Width = (rcClient.right - rcClient.left) + point3.X;
point3.X = 0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -