话说好久没有写了,呵呵,这几周太忙了,写好的新皮肤也没有整合完成,还得让大家再等两周,表示抱歉了,皮肤在使用中存在一些问题和解决方法请大家参才
皮肤使用须知 (New) 一文章,有什么好的建议或是意见也希望大家提出来,希望能让更多的人参与的皮肤的设计和开发上。
今天主要是看一下MainForm的实现而Main的实现与之相同,大家可以自己看一下源代码,或者我会在下次文章里提到一些,这个窗体是一个很重要的窗体,因为关于换肤的方法要在这里引用,使用皮肤的前提也是要使用这个窗体,所以是一个很重要的窗体,算是一个使用皮肤控件的基础吧;
我们先看 一下它的布局吧
大家应该能看的出来,左上角是一个 Panel是用来做窗体的标题的,而右面的三个CommandButton是用来实现,最小化,最大化和关闭按钮的,
定部的Panel是工具一栏,而下面而是窗体 的主体部分了
实现之后的效果是这样的
在这里还要感谢一位网友提供的图片素材,在这里谢谢了,最新的皮肤不会带有这些图片,但是上面具有这具功能 ,大家可以直接添加,因是作者留有版权,呵呵
我们来看实现吧 所用的到图片大家可以在源代码里找到,我这里给出引用的图片代码大家可以根据代码查找
{
partial class Main
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.pnlCaption = new System.Windows.Forms.Panel();
this.btnClose = new CRD.WinUI.Misc.CommandButton();
this.btnMaxResore = new CRD.WinUI.Misc.CommandButton();
this.btnMin = new CRD.WinUI.Misc.CommandButton();
this.btnMenu = new CRD.WinUI.Misc.CommandButton();
this.btnSkin = new CRD.WinUI.Misc.CommandButton();
this.lblText = new System.Windows.Forms.Label();
this.ptbTopRight = new System.Windows.Forms.PictureBox();
this.ptbTopMiddle = new System.Windows.Forms.PictureBox();
this.ptbTopLeft = new System.Windows.Forms.PictureBox();
this.pnlBottom = new System.Windows.Forms.Panel();
this.ptbBottomRight = new System.Windows.Forms.PictureBox();
this.ptbBottomMiddle = new System.Windows.Forms.PictureBox();
this.ptbBottomLeft = new System.Windows.Forms.PictureBox();
this.pnlLeft = new System.Windows.Forms.Panel();
this.ptbLeft = new System.Windows.Forms.PictureBox();
this.pnlRight = new System.Windows.Forms.Panel();
this.ptbRight = new System.Windows.Forms.PictureBox();
this.GCtimer = new System.Windows.Forms.Timer(this.components);
this.pnlBackground = new CRD.WinUI.Misc.panel();
this.pnlCaption.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.ptbTopRight)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.ptbTopMiddle)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.ptbTopLeft)).BeginInit();
this.pnlBottom.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.ptbBottomRight)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.ptbBottomMiddle)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.ptbBottomLeft)).BeginInit();
this.pnlLeft.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.ptbLeft)).BeginInit();
this.pnlRight.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.ptbRight)).BeginInit();
this.SuspendLayout();
//
// pnlCaption
//
this.pnlCaption.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.pnlCaption.Controls.Add(this.btnClose);
this.pnlCaption.Controls.Add(this.btnMaxResore);
this.pnlCaption.Controls.Add(this.btnMin);
this.pnlCaption.Controls.Add(this.btnMenu);
this.pnlCaption.Controls.Add(this.btnSkin);
this.pnlCaption.Controls.Add(this.lblText);
this.pnlCaption.Controls.Add(this.ptbTopRight);
this.pnlCaption.Controls.Add(this.ptbTopMiddle);
this.pnlCaption.Controls.Add(this.ptbTopLeft);
this.pnlCaption.Dock = System.Windows.Forms.DockStyle.Top;
this.pnlCaption.Location = new System.Drawing.Point(0, 0);
this.pnlCaption.Name = "pnlCaption";
this.pnlCaption.Size = new System.Drawing.Size(592, 112);
this.pnlCaption.TabIndex = 0;
//
// btnClose
//
this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnClose.ImageTransparentColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(255)))));
this.btnClose.Location = new System.Drawing.Point(548, 0);
this.btnClose.MouseDownImage = null;
this.btnClose.MouseMoveImage = null;
this.btnClose.Name = "btnClose";
this.btnClose.NormalImage = null;
this.btnClose.Size = new System.Drawing.Size(37, 22);
this.btnClose.TabIndex = 3;
this.btnClose.ToolTip = "关闭";
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
//
// btnMaxResore
//
this.btnMaxResore.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnMaxResore.ImageTransparentColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(255)))));
this.btnMaxResore.Location = new System.Drawing.Point(516, 0);
this.btnMaxResore.MouseDownImage = null;
this.btnMaxResore.MouseMoveImage = null;
this.btnMaxResore.Name = "btnMaxResore";
this.btnMaxResore.NormalImage = null;
this.btnMaxResore.Size = new System.Drawing.Size(32, 22);
this.btnMaxResore.TabIndex = 3;
this.btnMaxResore.ToolTip = "最大化";
this.btnMaxResore.Click += new System.EventHandler(this.btnMaxResore_Click);
//
// btnMin
//
this.btnMin.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnMin.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.btnMin.ImageTransparentColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(255)))));
this.btnMin.Location = new System.Drawing.Point(485, 0);
this.btnMin.MouseDownImage = null;
this.btnMin.MouseMoveImage = null;
this.btnMin.Name = "btnMin";
this.btnMin.NormalImage = null;
this.btnMin.Size = new System.Drawing.Size(31, 22);
this.btnMin.TabIndex = 3;
this.btnMin.ToolTip = "最小化";
this.btnMin.Click += new System.EventHandler(this.btnMin_Click);
//
// btnMenu
//
this.btnMenu.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnMenu.BackColor = System.Drawing.Color.Transparent;
this.btnMenu.ImageTransparentColor = System.Drawing.Color.Empty;
this.btnMenu.Location = new System.Drawing.Point(428, 6);
this.btnMenu.MouseDownImage = null;
this.btnMenu.MouseMoveImage = null;
this.btnMenu.Name = "btnMenu";
this.btnMenu.NormalImage = null;
this.btnMenu.Size = new System.Drawing.Size(40, 14);
this.btnMenu.TabIndex = 5;
this.btnMenu.ToolTip = null;
this.btnMenu.MouseClick += new System.Windows.Forms.MouseEventHandler(this.btnMenu_MouseClick);
//
// btnSkin
//
this.btnSkin.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnSkin.BackColor = System.Drawing.Color.Transparent;
this.btnSkin.ImageTransparentColor = System.Drawing.Color.Empty;
this.btnSkin.Location = new System.Drawing.Point(374, 6);
this.btnSkin.MouseDownImage = null;
this.btnSkin.MouseMoveImage = null;
this.btnSkin.Name = "btnSkin";
this.btnSkin.NormalImage = null;
this.btnSkin.Size = new System.Drawing.Size(40, 14);
this.btnSkin.TabIndex = 5;
this.btnSkin.ToolTip = null;
this.btnSkin.Click += new System.EventHandler(this.btnSkin_Click);
//
// lblText
//
this.lblText.BackColor = System.Drawing.Color.Transparent;
this.lblText.Location = new System.Drawing.Point(16, 2);
this.lblText.Name = "lblText";
this.lblText.Size = new System.Drawing.Size(283, 26);
this.lblText.TabIndex = 0;
this.lblText.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.lblText.DoubleClick += new System.EventHandler(this.Caption_DouClick);
this.lblText.MouseMove += new System.Windows.Forms.MouseEventHandler(this.lblText_MouseMove);
this.lblText.MouseUp += new System.Windows.Forms.MouseEventHandler(this.Caption_MouseUp);
//
// ptbTopRight
//
this.ptbTopRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.ptbTopRight.Dock = System.Windows.Forms.DockStyle.Right;
this.ptbTopRight.Location = new System.Drawing.Point(584, 0);
this.ptbTopRight.Name = "ptbTopRight";
this.ptbTopRight.Size = new System.Drawing.Size(8, 112);
this.ptbTopRight.TabIndex = 2;
this.ptbTopRight.TabStop = false;
this.ptbTopRight.DoubleClick += new System.EventHandler(this.Caption_DouClick);
this.ptbTopRight.MouseMove += new System.Windows.Forms.MouseEventHandler(this.ptbTopRight_MouseMove);
this.ptbTopRight.MouseUp += new System.Windows.Forms.MouseEventHandler(this.Caption_MouseUp);
//
// ptbTopMiddle
//
this.ptbTopMiddle.BackColor = System.Drawing.SystemColors.Control;
this.ptbTopMiddle.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.ptbTopMiddle.Dock = System.Windows.Forms.DockStyle.Fill;
this.ptbTopMiddle.Location = new System.Drawing.Point(0, 0);
this.ptbTopMiddle.Name = "ptbTopMiddle";
this.ptbTopMiddle.Size = new System.Drawing.Size(592, 112);
this.ptbTopMiddle.TabIndex = 1;
this.ptbTopMiddle.TabStop = false;
this.ptbTopMiddle.DoubleClick += new System.EventHandler(this.Caption_DouClick);
this.ptbTopMiddle.MouseMove += new System.Windows.Forms.MouseEventHandler(this.ptbTopMiddle_MouseMove);
this.ptbTopMiddle.MouseUp += new System.Windows.Forms.MouseEventHandler(this.Caption_MouseUp);
//
// ptbTopLeft
//
this.ptbTopLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.ptbTopLeft.Dock = System.Windows.Forms.DockStyle.Left;
this.ptbTopLeft.Location = new System.Drawing.Point(0, 0);
this.ptbTopLeft.Name = "ptbTopLeft";
this.ptbTopLeft.Size = new System.Drawing.Size(0, 112);
this.ptbTopLeft.TabIndex = 0;
this.ptbTopLeft.TabStop = false;
this
请发表评论