private void IniSystemButtons() { bool isShowMaxButton = _owner.MaximizeBox; bool isShowMinButton = _owner.MinimizeBox; //Colse SystemButton closeBtn = new SystemButton(); SystemButtonArray[0] = closeBtn; closeBtn.ToolTip = "关闭"; if (isShowCloseButton) { closeBtn.NormalImg = ServiceStationClient.ComponentUI.Properties.Resources.close_normal; // CommonMethod.GetImageFormResourceStream("ControlExs.FormEx.Res.SystemButtons.close_normal.png"); closeBtn.HighLightImg = ServiceStationClient.ComponentUI.Properties.Resources.close_highlight; //CommonMethod.GetImageFormResourceStream("ControlExs.FormEx.Res.SystemButtons.close_highlight.png"); closeBtn.DownImg = ServiceStationClient.ComponentUI.Properties.Resources.close_down; //CommonMethod.GetImageFormResourceStream("ControlExs.FormEx.Res.SystemButtons.close_down.png"); closeBtn.LocationRect = new Rectangle( _owner.Width - closeBtn.NormalImg.Width, -1, closeBtn.NormalImg.Width, closeBtn.NormalImg.Height); //注册事件 closeBtn.OnMouseDownEvent += new MouseDownEventHandler(this.CloseButtonEvent); } //Max SystemButton MaxBtn = new SystemButton(); SystemButtonArray[1] = MaxBtn; MaxBtn.ToolTip = "最大化"; if (isShowMaxButton) { MaxBtn.NormalImg = ServiceStationClient.ComponentUI.Properties.Resources.max_normal; // CommonMethod.GetImageFormResourceStream("ControlExs.FormEx.Res.SystemButtons.max_normal.png"); MaxBtn.HighLightImg = ServiceStationClient.ComponentUI.Properties.Resources.max_highlight; // CommonMethod.GetImageFormResourceStream("ControlExs.FormEx.Res.SystemButtons.max_highlight.png"); MaxBtn.DownImg = ServiceStationClient.ComponentUI.Properties.Resources.max_down; // CommonMethod.GetImageFormResourceStream("ControlExs.FormEx.Res.SystemButtons.max_down.png"); MaxBtn.OnMouseDownEvent += new MouseDownEventHandler(this.MaxButtonEvent); MaxBtn.LocationRect = new Rectangle( closeBtn.LocationRect.X - MaxBtn.NormalImg.Width, -1, MaxBtn.NormalImg.Width, MaxBtn.NormalImg.Height); } else { MaxBtn.LocationRect = Rectangle.Empty; } //Min SystemButton minBtn = new SystemButton(); SystemButtonArray[2] = minBtn; minBtn.ToolTip = "最小化"; if (!isShowMinButton) { minBtn.LocationRect = Rectangle.Empty; return; } minBtn.NormalImg = ServiceStationClient.ComponentUI.Properties.Resources.min_normal; //CommonMethod.GetImageFormResourceStream("ControlExs.FormEx.Res.SystemButtons.min_normal.png"); minBtn.HighLightImg = ServiceStationClient.ComponentUI.Properties.Resources.min_highlight; //CommonMethod.GetImageFormResourceStream("ControlExs.FormEx.Res.SystemButtons.min_highlight.png"); minBtn.DownImg = ServiceStationClient.ComponentUI.Properties.Resources.min_down; //CommonMethod.GetImageFormResourceStream("ControlExs.FormEx.Res.SystemButtons.min_down.png"); minBtn.OnMouseDownEvent += new MouseDownEventHandler(this.MinButtonEvent); if (isShowMaxButton) { minBtn.LocationRect = new Rectangle( MaxBtn.LocationRect.X - minBtn.NormalImg.Width, -1, minBtn.NormalImg.Width, minBtn.NormalImg.Height); } else { minBtn.LocationRect = new Rectangle( closeBtn.LocationRect.X - minBtn.NormalImg.Width, -1, minBtn.NormalImg.Width, minBtn.NormalImg.Height); } }
private void IniSystemButtons() { bool isShowMaxButton = _owner.MaximizeBox; bool isShowMinButton = _owner.MinimizeBox; //Colse SystemButton closeBtn = new SystemButton(); SystemButtonArray[0] = closeBtn; closeBtn.ToolTip = "关闭"; if (isShowCloseButton) { closeBtn.NormalImg = ServiceStationClient.ComponentUI.Properties.Resources.close_normal;// CommonMethod.GetImageFormResourceStream("ControlExs.FormEx.Res.SystemButtons.close_normal.png"); closeBtn.HighLightImg = ServiceStationClient.ComponentUI.Properties.Resources.close_highlight;//CommonMethod.GetImageFormResourceStream("ControlExs.FormEx.Res.SystemButtons.close_highlight.png"); closeBtn.DownImg = ServiceStationClient.ComponentUI.Properties.Resources.close_down;//CommonMethod.GetImageFormResourceStream("ControlExs.FormEx.Res.SystemButtons.close_down.png"); closeBtn.LocationRect = new Rectangle( _owner.Width - closeBtn.NormalImg.Width, -1, closeBtn.NormalImg.Width, closeBtn.NormalImg.Height); //注册事件 closeBtn.OnMouseDownEvent += new MouseDownEventHandler(this.CloseButtonEvent); } //Max SystemButton MaxBtn = new SystemButton(); SystemButtonArray[1] = MaxBtn; MaxBtn.ToolTip = "最大化"; if (isShowMaxButton) { MaxBtn.NormalImg = ServiceStationClient.ComponentUI.Properties.Resources.max_normal;// CommonMethod.GetImageFormResourceStream("ControlExs.FormEx.Res.SystemButtons.max_normal.png"); MaxBtn.HighLightImg = ServiceStationClient.ComponentUI.Properties.Resources.max_highlight;// CommonMethod.GetImageFormResourceStream("ControlExs.FormEx.Res.SystemButtons.max_highlight.png"); MaxBtn.DownImg = ServiceStationClient.ComponentUI.Properties.Resources.max_down;// CommonMethod.GetImageFormResourceStream("ControlExs.FormEx.Res.SystemButtons.max_down.png"); MaxBtn.OnMouseDownEvent += new MouseDownEventHandler(this.MaxButtonEvent); MaxBtn.LocationRect = new Rectangle( closeBtn.LocationRect.X - MaxBtn.NormalImg.Width, -1, MaxBtn.NormalImg.Width, MaxBtn.NormalImg.Height); } else { MaxBtn.LocationRect = Rectangle.Empty; } //Min SystemButton minBtn = new SystemButton(); SystemButtonArray[2] = minBtn; minBtn.ToolTip = "最小化"; if (!isShowMinButton) { minBtn.LocationRect = Rectangle.Empty; return; } minBtn.NormalImg = ServiceStationClient.ComponentUI.Properties.Resources.min_normal;//CommonMethod.GetImageFormResourceStream("ControlExs.FormEx.Res.SystemButtons.min_normal.png"); minBtn.HighLightImg = ServiceStationClient.ComponentUI.Properties.Resources.min_highlight;//CommonMethod.GetImageFormResourceStream("ControlExs.FormEx.Res.SystemButtons.min_highlight.png"); minBtn.DownImg = ServiceStationClient.ComponentUI.Properties.Resources.min_down;//CommonMethod.GetImageFormResourceStream("ControlExs.FormEx.Res.SystemButtons.min_down.png"); minBtn.OnMouseDownEvent += new MouseDownEventHandler(this.MinButtonEvent); if (isShowMaxButton) { minBtn.LocationRect = new Rectangle( MaxBtn.LocationRect.X - minBtn.NormalImg.Width, -1, minBtn.NormalImg.Width, minBtn.NormalImg.Height); } else { minBtn.LocationRect = new Rectangle( closeBtn.LocationRect.X - minBtn.NormalImg.Width, -1, minBtn.NormalImg.Width, minBtn.NormalImg.Height); } }