CSkin博客

标题: skinChatRichTextBox 关于滚动条问题 [打印本页]

作者: luckyzhang    时间: 2015-12-29 16:11
标题: skinChatRichTextBox 关于滚动条问题
当skinChatRichTextBox出现滚动条的时候,鼠标拖动滚动条时,滚动条不能随鼠标一起移动,等放开鼠标后,滚动条踩移到对应的位置(skinChatRichTextBox内容是会跟鼠标一起移动的,是正常的),需要怎么设置skinChatRichTextBox,才能使滚动条随鼠标一起移动。

作者: 乔克斯    时间: 2015-12-29 16:29
这个BUG还没有解决。原因未知。。。
作者: luckyzhang    时间: 2015-12-29 17:56
怎么办   我要哭了
作者: azkiki    时间: 2016-3-24 11:05
临时的解决方案,继承SkinChatRichTextBox,在派生类加上:
[C#] 纯文本查看 复制代码

#region 滚动条移动

        public const int WM_HSCROLL = 276;
        public const int WM_VSCROLL = 277;
        public const int WM_SETCURSOR = 32;
        public const int WM_MOUSEWHEEL = 522;
        public const int WM_MOUSEMOVE = 512;
        public const int WM_MOUSELEAVE = 675;
        public const int WM_MOUSELAST = 521;
        public const int WM_MOUSEHOVER = 673;
        public const int WM_MOUSEFIRST = 512;
        public const int WM_MOUSEACTIVATE = 33;

        // Scroll Bar Constants
        private const int SB_HORZ = 0;
        private const int SB_VERT = 1;
        private const int SB_CTL = 2;
        private const int SB_BOTH = 3;

        [DllImport("user32.dll")]
        public static extern int ShowScrollBar(IntPtr hwnd, int wBar, int bShow);

        protected override void WndProc(ref Message m)
        {
            if (m.Msg == WM_VSCROLL)
            {
                ShowScrollBar(this.Handle, SB_VERT, 0);
                ShowScrollBar(this.Handle, SB_VERT, 1);
            }else if(m.Msg== WM_HSCROLL)
            {
                ShowScrollBar(this.Handle, SB_HORZ, 0);
                ShowScrollBar(this.Handle, SB_HORZ, 1);
            }
            base.WndProc(ref m);
        }

        #endregion

作者: 乔克斯    时间: 2016-3-24 11:56
azkiki 发表于 2016-3-24 11:05
临时的解决方案,继承SkinChatRichTextBox,在派生类加上:
[mw_shl_code=csharp,true]
#region 滚动条移动 ...

ok。感觉提供解决方案。新版已加上这段代码。




欢迎光临 CSkin博客 (http://bbs.cskin.net/) Powered by Discuz! X3.2