如题,设置焦点转移不可以,因为我的Button可以自由拖动,拖动过程中,焦点转移的时候会导致拖动有问题。

解决方案 »

  1.   

    有意义啊,我做的Button显示一个背景图片,但是拖动时显示效果不好看,如此而已。
      

  2.   


            //试试API拖动控件,然后转移焦点,可以达到你所说的效果.
            using System.Runtime.InteropServices;        [DllImport("user32.dll")]
            public static extern bool ReleaseCapture();
            [DllImport("user32.dll")]
            public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
            public const int WM_SYSCOMMAND = 0x0112;
            public const int SC_MOVE = 0xF010;
            public const int HTCAPTION = 0x0002;        private void button1_MouseDown(object sender, MouseEventArgs e)
            {
                this.textBox1.Focus();
                ReleaseCapture();
                SendMessage(this.button1.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
            }
      

  3.   

    不用button,自己画控件
      
    *****************************************************************************
    欢迎使用CSDN论坛专用阅读器 : CSDN Reader(附全部源代码) http://feiyun0112.cnblogs.com/
      

  4.   

    我现在用的圆形Button是老外的写的一个类,现在的唯一的问题就是  按钮有边框,还有一个就是获得焦点时有虚线,明白了吗?
      

  5.   

    不用这么麻烦.新建一个自定义控件,然后继承button,然后把那个属性加进去public class MyButton : System.Windows.Forms.Button
        {
            public bool Selectable
            {
                get { return this.GetStyle(System.Windows.Forms.ControlStyles.FixedHeight); }
                set { this.SetStyle(System.Windows.Forms.ControlStyles.Selectable, value); }
            }
        }