控制文本框的滚动
来源:互联网 发布:西安爱知中学招聘 编辑:程序博客网 时间:2024/05/03 01:04
[System.Runtime.InteropServices.DllImport("user32.dll")]
public static extern int SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
[System.Runtime.InteropServices.DllImport("user32.dll")]
public static extern bool UpdateWindow(IntPtr hWnd); // handle to window
private const int WM_VSCROLL = 0x115;
private const int SB_LINEUP = 0;
private const int SB_LINELEFT = 0;
private const int SB_LINEDOWN = 1;
private const int SB_LINERIGHT = 1;
private const int SB_PAGEUP = 2;
private const int SB_PAGELEFT = 2;
private const int SB_PAGEDOWN = 3;
private const int SB_PAGERIGHT = 3;
private const int SB_THUMBPOSITION = 4;
private const int SB_THUMBTRACK = 5;
private const int SB_TOP = 6;
private const int SB_LEFT = 6;
private const int SB_BOTTOM = 7;
private const int SB_RIGHT = 7;
private const int SB_ENDSCROLL = 8;
private const int WM_PAINT = 0x000F;
private void SelfSrcoll(IntPtr handle, int length)
{
if (length != 0)
{
SendMessage(handle, WM_VSCROLL, SB_LINEUP, 0);
UpdateWindow(handle);
}
else
{
SendMessage(handle, WM_VSCROLL, SB_BOTTOM, 0);
UpdateWindow(handle);
}
}
private void vScrollBar1_Scroll(object sender, ScrollEventArgs e)
{
int lines = e.NewValue - e.OldValue;
if (lines > 0)
{
for (int i = 0; i < lines; i++)
{
SendMessage(this.textBox1.Handle, WM_VSCROLL, SB_LINEUP, 0);
UpdateWindow(this.textBox1.Handle);
}
}
else
{
for (int i = 0; i > lines; i--)
{
SendMessage(this.textBox1.Handle, WM_VSCROLL, SB_LINEDOWN, 0);
UpdateWindow(this.textBox1.Handle);
}
}
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
vScrollBar1.Maximum = textBox1.Lines.Length;
}
- 控制文本框的滚动
- C#控制文本框的光标及滚动条
- 文本框内容的滚动
- 可滚动边框的文本框
- 带滚动条的文本框
- 控制文本框大小的办法
- 控制文本框输入的类型
- JS控制文本框的内容
- 如何控制文本框的宽度
- JS控制文本框的内容
- Xlistview的滚动控制
- UGUI 带垂直滚动条的文本框
- 【TextView】可纵向滚动的文本框
- 文本框控制
- 简单的Jquery控制滚动条滚动
- JS控制滚动条滚动的位置
- 模拟滚动条控制内容的滚动
- VB.NET中控制文本框的输入
- 如果你死掉了,你愿意写上什么样的墓志铭?
- 32位CPU所含有的寄存器
- ORACLE connect by语法的一个妙用
- Linux设备驱动程序设计实例
- 自己动手编写小波信号分解与重构的Matlab程序
- 控制文本框的滚动
- VS.NET 2005中实用的默认键
- .NET(C#) Hashtable Dictionary 探索
- UI(用户界面)的人性设计
- 宏定义中的do...while(0)
- 正则表达式入门教程(有删节)
- Intel CPU 的多媒体指令集
- 如何在sqlserver2008 中传递表值参数
- wtwrtet