不用劳师动众的重写,只要处理一下该控件的MouseDown(MouseUp)事件就能搞定了呀

解决方案 »

  1.   

    // 以下 Copy来得代码,希望能给你点思路
    自己写个button控件
    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Drawing;
    using System.Data;
    using System.Windows.Forms;namespace ControlLibrary
    {
     /// <summary>
     /// UserControl2 的摘要说明。
     /// </summary>
     public class M_button : System.Windows.Forms.Button
     {
      /// <summary> 
      /// 必需的设计器变量。
      /// </summary>
      private System.ComponentModel.Container components = null;
      
      protected override void OnMouseMove(MouseEventArgs e)
      {      
     
      
       base.OnMouseUp (e);//把这行注释掉就可以啦,其他的事件也这样重写就可以了
      }  public M_button()
      {
       // 该调用是 Windows.Forms 窗体设计器所必需的。
       InitializeComponent();   // TODO: 在 InitializeComponent 调用后添加任何初始化  }  /// <summary> 
      /// 清理所有正在使用的资源。
      /// </summary>
      protected override void Dispose( bool disposing )
      {
       if( disposing )
       {
        if(components != null)
        {
         components.Dispose();
        }
       }
       base.Dispose( disposing );
      }  #region 组件设计器生成的代码
      /// <summary> 
      /// 设计器支持所需的方法 - 不要使用代码编辑器 
      /// 修改此方法的内容。
      /// </summary>
      private void InitializeComponent()
      {
       // 
       // M_button
       // 
       this.Size = new System.Drawing.Size(100, 25);  }
      #endregion
     }
    }