📄 notifywindowtemplatebase.cs
字号:
namespace Imps.Client.Pc.BizControls.NotifyWindows.Templates
{
using Imps.Client.Pc.BizControls.NotifyWindows;
using System;
using System.Drawing;
public abstract class NotifyWindowTemplateBase : NotifyWindow
{
private NotifyWindowImage _captionImage;
private NotifyWindowImageButton _closeButton;
private NotifyWindowContent _content;
protected static NotifyWindowStyle _style = new NotifyWindowStyle();
private Image backgroundImage;
protected Image captionImage;
protected string title = "";
public NotifyWindowTemplateBase()
{
Style.StyleChanged += new EventHandler(this.Style_StyleChanged);
}
private void closeButton_Click(object sender, NotifyWindowEventArgs e)
{
e.NotifyWindow.Hide();
}
protected abstract void CreateContent(NotifyWindowContent content);
protected override void Dispose(bool disposing)
{
Style.StyleChanged -= new EventHandler(this.Style_StyleChanged);
base.Dispose(disposing);
}
protected void InitContent()
{
this._content = new NotifyWindowContent();
this._content.BackgroundImage = Style.BackgroundImage;
this._content.Rectangle = new Rectangle(Style.ClientX, Style.ClientY, Style.ClientWidth, Style.ClientHeight);
this.captionImage = Style.CaptionImage;
Rectangle rectangle = new Rectangle(Style.CaptionX, Style.CaptionY, this.captionImage.Width, this.captionImage.Height);
this._captionImage = new NotifyWindowImage(rectangle, this.captionImage);
this._content.Elements.Add(this._captionImage);
Bitmap image = Style.CloseImage;
image.MakeTransparent(Style.TransParentColor);
Rectangle rectangle2 = new Rectangle((this._content.BackgroundImage.Width - Style.CloseX) - (image.Width / 3), Style.CloseY, image.Width / 3, image.Height);
this._closeButton = new NotifyWindowImageButton(image, rectangle2);
this._closeButton.Click += new NotifyWindowEventHandler(this.closeButton_Click);
this._content.Elements.Add(this._closeButton);
this.Text = this.title;
this.CreateContent(this._content);
base.SetContent(this._content);
base.MakeTransparent(Style.TransParentColor);
}
protected override void OnCreateControl()
{
base.OnCreateControl();
base.MakeTransparent(Style.TransParentColor);
}
private void Style_StyleChanged(object sender, EventArgs e)
{
int width = base.Width;
int height = base.Height;
this.InitContent();
base.Width = width;
base.Height = height;
base.Invalidate();
}
public Image BackgroundImageNotify
{
get
{
return this.backgroundImage;
}
set
{
this.backgroundImage = value;
}
}
public static NotifyWindowStyle Style
{
get
{
return _style;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -