CreateParams WS_EX_COMPOSITED隐藏SplitContainer拖动指示器 [英] CreateParams WS_EX_COMPOSITED hide SplitContainer dragging indicator

查看:75
本文介绍了CreateParams WS_EX_COMPOSITED隐藏SplitContainer拖动指示器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我尝试使用  WS_EX_COMPOSITED值,以避免在拖动SplitContainer时SplitContainer控件中出现一些闪烁。但它隐藏了SplitContainer拖动指标。请找到我在我的申请中使用的以下代码。 

I have tried with WS_EX_COMPOSITED value to avoid some flickering in the SplitContainer control while dragging the SplitContainer. But it hides SplitContainer dragging indicator. Please find the below codes i have used in my application. 

this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill;

this.splitContainer.Orientation = Orientation.Vertical;

this.splitContainer.BackColor = System.Drawing.Color.Red;

this.splitContainer.SplitterWidth = 20; 


protected override CreateParams CreateParams
{
      get
      {
          CreateParams cp = base.CreateParams;
          cp.ExStyle |= 0x02000000;  // Turn on WS_EX_COMPOSITED
          return cp;
      }
}


请参阅上述代码和图片以查找问题。

Please refer the above codes and image for the issue.

注意:   我们已经绘制了使用PatBlt NativeWindow方法为我们的自定义控件拖动拆分器指示器。

Note:  We have drawn the Dragging Splitter indicator for our custom control using PatBlt NativeWindow method.

任何人都可以提供解决方案以继续进行此操作吗?

Can anyone please provide solution to proceed further on this?

问候,

Venkateshwaran VR

Venkateshwaran V.R.

打印支持







推荐答案

嗨  Venkateshwaran,

Hi Venkateshwaran,

很抱歉迟到的回复。

>>我尝试使用WS_EX_COMPOSITED值,以避免在拖动SplitContainer时SplitContainer控件中出现一些闪烁。

>>I have tried with WS_EX_COMPOSITED value to avoid some flickering in the SplitContainer control while dragging the SplitContainer.

To避免轻弹,如何使用
SetStyle()方法
而不是?

To avoid flicking, how about using SetStyle() method instead?

    // Set the value of the double-buffering style bits to true.
    this.SetStyle(
        ControlStyles.UserPaint |
        ControlStyles.AllPaintingInWmPaint |
        ControlStyles.OptimizedDoubleBuffer, true);

this方法可以避免轻弹并避免问题,如你所提到的,所以完整的代码:

This method can avoid the flicking and avoid the issue as you mentioned, so the complete code:

        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();

                // Set the value of the double-buffering style bits to true.
                this.SetStyle(
                ControlStyles.UserPaint |
                ControlStyles.AllPaintingInWmPaint |
                ControlStyles.OptimizedDoubleBuffer, true);

                this.splitContainer1.Dock = DockStyle.Fill;
                this.splitContainer1.Orientation = Orientation.Vertical;
                this.splitContainer1.BackColor = Color.DarkGray;
                this.splitContainer1.Panel1.BackColor = Color.Red;
                this.splitContainer1.Panel2.BackColor = Color.Red;
                this.splitContainer1.SplitterWidth = 20;
                this.splitContainer1.BorderStyle = BorderStyle.Fixed3D;
            }
        }

问候,

Stanly


这篇关于CreateParams WS_EX_COMPOSITED隐藏SplitContainer拖动指示器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆