是否可以处理TabControl分页按钮的单击事件?当组合tabHeader宽度超过控件的宽度时,将显示这些按钮。

如果单击了一个控件,我想重新绘制整个控件。
发布于 2017-09-01 21:55:14
您可以添加您自己的事件来处理这个问题。来自滚动选项卡标头时发生的TabControl事件
public class TabConrolEx : TabControl {
public event ScrollEventHandler Scrolling;
private const int WM_HSCROLL = 0x114;
private int oldValue = 0;
protected override void WndProc(ref Message m) {
base.WndProc(ref m);
if (m.Msg == WM_HSCROLL) {
this.OnScrolling(new ScrollEventArgs(((ScrollEventType)LoWord(m.WParam)),
oldValue, HiWord(m.WParam), ScrollOrientation.HorizontalScroll));
}
}
protected void OnScrolling(ScrollEventArgs e) {
if (Scrolling != null) {
Scrolling(this, e);
}
if (e.Type == ScrollEventType.EndScroll) {
oldValue = e.NewValue;
}
}
private int LoWord(IntPtr dWord) {
return dWord.ToInt32() & 0xffff;
}
private int HiWord(IntPtr dWord) {
if ((dWord.ToInt32() & 0x80000000) == 0x80000000) {
return (dWord.ToInt32() >> 16);
} else {
return (dWord.ToInt32() >> 16) & 0xffff;
}
}
}如果在表单中使用此TabControl,将出现“滚动”事件。
https://stackoverflow.com/questions/45997466
复制相似问题