日期:2010-01-06  浏览次数:20811 次

  1. using System; 
  2. using System.Collections.Generic; 
  3. using System.ComponentModel; 
  4. using System.Drawing; 
  5. using System.Drawing.Imaging; 
  6. using System.Drawing.Drawing2D; 
  7. using System.Data; 
  8. using System.Text; 
  9. using System.Windows.Forms; 
  10.  
  11. namespace MyControls 
  12. { 
  13.     public partial class CrystalButton : Button    
  14.     { 
  15.         private enum MouseActionType 
  16.         { 
  17.             None, 
  18.             Hover, 
  19.             Click 
  20.         } 
  21.  
  22.         private MouseActionType mouseAction; 
  23.         private ImageAttributes imgAttr = new ImageAttributes(); 
  24.         private Bitmap buttonBitmap; 
  25.         private Rectangle buttonBitmapRectangle; 
  26.  
  27.         public CrystalButton() 
  28.         { 
  29.             InitializeComponent(); 
  30.  
  31.             mouseAction = MouseActionType.None; 
  32.  
  33.             this.SetStyle(ControlStyles.AllPaintingInWmPaint  
  34.                 ControlStyles.DoubleBuffer  
  35.