gpt4 book ai didi

c# - 处理TabControl中的upDown分页按钮OnClick事件

转载 作者:太空宇宙 更新时间:2023-11-03 15:01:27 24 4
gpt4 key购买 nike

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

enter image description here

如果单击一个控件,我想重绘整个控件。

最佳答案

您可以添加自己的事件来处理它。来自 TabControl event when scrolling through tab headers :

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,则“滚动”事件将可用。

关于c# - 处理TabControl中的upDown分页按钮OnClick事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45997466/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com