/// <summary> /// 用默认设置初始化 CharmMessageBox 类的新实例 /// </summary> public CharmMessageBox() { InitializeComponent(); // 设置窗体阴影特效 APIOperation.FormBorderShadow(Handle); // * 设置双缓冲模式 * SetStyle(ControlStyles.AllPaintingInWmPaint | //不擦除背景 ,减少闪烁 ControlStyles.OptimizedDoubleBuffer | //双缓冲 ControlStyles.UserPaint, //使用自定义的重绘事件,减少闪烁 true); UpdateStyles(); // * 初始化属性 * TopMost = true; FormBorderStyle = FormBorderStyle.None; StartPosition = FormStartPosition.CenterParent; Width = 350; mTitleColor = Color.White; mTextColor = Color.Black; // 创建控件集合 CharmControls = new List <CharmControl>(); // 创建用户按钮 mButtons = new CharmButton[3]; for (int i = 0; i < mButtons.Length; i++) { mButtons[i] = new CharmButton(); mButtons[i].ButtonType = ButtonType.Classic_Size_06922; mButtons[i].Visible = false; mButtons[i].MouseClick += new MouseEventHandler(ButtonMouseClick); CharmControls.Add(mButtons[i]); } // 创建检查框 mCheckBox = new CharmCheckBox(); mCheckBox.Visible = false; CharmControls.Add(mCheckBox); // 创建关闭按钮 CharmSysButton btnClose = new CharmSysButton(); btnClose.SysButtonType = SysButtonType.Close; btnClose.Location = new Point(Width - 46, 1); btnClose.MouseClick += new MouseEventHandler(btnClose_MouseClick); CharmControls.Add(btnClose); }
/// <summary> /// 用默认设置初始化 CharmMenu 类的新实例 /// </summary> public CharmMenu() { InitializeComponent(); // 设置窗体阴影特效 APIOperation.FormBorderShadow(Handle); // * 设置双缓冲模式 * SetStyle(ControlStyles.AllPaintingInWmPaint | //不擦除背景 ,减少闪烁 ControlStyles.OptimizedDoubleBuffer | //双缓冲 ControlStyles.UserPaint, //使用自定义的重绘事件,减少闪烁 true); UpdateStyles(); // * 初始化属性 * TopMost = true; ShowInTaskbar = false; FormBorderStyle = FormBorderStyle.None; mItems = new List <MenuItem>(); mSelectedIndex = -1; }