gpt4 book ai didi

c# - 两个富文本框的相同滚动条

转载 作者:太空狗 更新时间:2023-10-30 01:24:07 26 4
gpt4 key购买 nike

是否有任何第三方工具可用,它有两个富文本框,但两者只有一个共享滚动条。我需要用两种不同的语言实现一些文本,但两个文本框应该同时滚动。

最佳答案

    public enum ScrollBarType : uint
{
SbHorz = 0,
SbVert = 1,
SbCtl = 2,
SbBoth = 3
}

public enum Message : uint
{
WM_VSCROLL = 0x0115
}

public enum ScrollBarCommands : uint
{
SB_THUMBPOSITION = 4
}

[DllImport("User32.dll")]
public extern static int GetScrollPos(IntPtr hWnd, int nBar);

[DllImport("User32.dll")]
public extern static int SendMessage(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam);
// Set the dual scrolling on the richTextbox1 and affects richTextbox2

private void richTextBox1_VScroll(object sender, EventArgs e)
{
int nPos = GetScrollPos(richTextBox1.Handle, (int)ScrollBarType.SbVert);
nPos <<= 16;
uint wParam = (uint)ScrollBarCommands.SB_THUMBPOSITION | (uint)nPos;
SendMessage(richTextBox2.Handle, (int)Message.WM_VSCROLL, new IntPtr(wParam), new IntPtr(0));
}

关于c# - 两个富文本框的相同滚动条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10266625/

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