using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace IntelligentControlForsx.MyControls { public class ImageButton : Button { public ImageButton() { FlatStyle = FlatStyle.Flat;//样式 ForeColor = Color.Transparent;//前景 BackColor = Color.Transparent;//去背景 FlatAppearance.BorderSize = 0;//去边线 FlatAppearance.MouseOverBackColor = Color.Transparent;//鼠标经过 FlatAppearance.MouseDownBackColor = Color.Transparent;//鼠标按下 Size = new System.Drawing.Size(142, 38); Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); ForeColor = System.Drawing.Color.White; BackgroundImage = global::IntelligentControlForsx.Properties.Resources.btn_station1; } protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); } protected override void OnMouseHover(EventArgs e) { FlatAppearance.BorderSize = 1; } protected override void OnMouseLeave(EventArgs e) { FlatAppearance.BorderSize = 0; } } }