コード例 #1
0
        /// <summary>
        /// 绘制控制按钮
        /// </summary>
        /// <param name="e"></param>
        protected override void OnRenderSkinFormControlBox(
            SkinFormControlBoxRenderEventArgs e)
        {
            SkinForm        form   = e.Form;
            Graphics        g      = e.Graphics;
            Rectangle       rect   = e.ClipRectangle;
            ControlBoxState state  = e.ControlBoxtate;
            bool            active = e.Active;

            bool minimizeBox = form.ControlBox && form.MinimizeBox;
            bool maximizeBox = form.ControlBox && form.MaximizeBox;

            switch (e.ControlBoxStyle)
            {
            case ControlBoxStyle.Close:
                RenderSkinFormCloseBoxInternal(
                    g,
                    rect,
                    state,
                    active,
                    minimizeBox,
                    maximizeBox);
                break;

            case ControlBoxStyle.Maximize:
                RenderSkinFormMaximizeBoxInternal(
                    g,
                    rect,
                    state,
                    active,
                    minimizeBox,
                    form.WindowState == FormWindowState.Maximized);
                break;

            case ControlBoxStyle.Minimize:
                RenderSkinFormMinimizeBoxInternal(
                    g,
                    rect,
                    state,
                    active);
                break;
            }
        }
コード例 #2
0
        //绘制背景颜色
        protected override void OnRenderSkinFormBackground(
            SkinFormBackgroundRenderEventArgs e)
        {
            Graphics  g    = e.Graphics;
            Rectangle rect = e.ClipRectangle;
            SkinForm  form = e.SkinForm;

            using (AntiAliasGraphics antiGraphics = new AntiAliasGraphics(g))
            {
                //g.FillRectangle(Brushes.LightBlue, rect);
                //e.SkinForm.BackgroundImageLayout = ImageLayout.Stretch;

                //string imagei = Temp.Image;
                //Bitmap bt;
                //if (Temp.Image == "")
                //{
                //    bt = new Bitmap(Resource1.background);// new Bitmap(Image.FromFile(Globals.AppPath + "\\resource\\image\\background.jpg"));
                //}
                //else
                //{
                //    bt = new Bitmap(INIClass.GetImage(imagei), rect.Width, rect.Height);
                //}

                //g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
                ////using (Brush brush = new  TextureBrush(Image.FromFile(imagei)))
                //using (Brush brush = new TextureBrush(bt))
                //{
                //    rect.X -= 1;
                //    rect.Y -= 1;
                //    rect.Width += 1;
                //    rect.Height += 1;
                //    using (GraphicsPath path = GraphicsPathHelper.CreatePath(
                //       rect, form.Radius, form.RoundStyle, false))
                //    {
                //        g.FillPath(brush, path);
                //    }
                //}
            }
            // InitSkinForm(e.SkinForm);
        }
コード例 #3
0
 public void Dispose()
 {
     _owner = null;
 }
コード例 #4
0
 public ControlBoxManager(SkinForm owner)
 {
     _owner = owner;
 }
コード例 #5
0
ファイル: SkinFormRenderer.cs プロジェクト: Jackjet/BIP
 public abstract void InitSkinForm(SkinForm form);
コード例 #6
0
ファイル: SkinFormRenderer.cs プロジェクト: Jackjet/BIP
 // 创建一个Region,提供给SkinForm使用
 public abstract Region CreateRegion(SkinForm form);
コード例 #7
0
        //绘制标题栏(包括标题栏图片,标题栏文字,标题栏背景色)
        protected override void OnRenderSkinFormCaption(
            SkinFormCaptionRenderEventArgs e)
        {
            Graphics  g        = e.Graphics;      //新建一个画刷
            Rectangle rect     = e.ClipRectangle; //矩形
            SkinForm  form     = e.SkinForm;
            Rectangle iconRect = form.IconRect;   //标题栏图标位置宽度
            Rectangle textRect = Rectangle.Empty;

            bool closeBox    = form.ControlBox;                     //标题栏关闭按钮
            bool minimizeBox = form.ControlBox && form.MinimizeBox; //最大化最小化按钮
            bool maximizeBox = form.ControlBox && form.MaximizeBox;

            int textWidthDec = 0;

            if (closeBox)
            {
                textWidthDec += form.CloseBoxSize.Width + form.ControlBoxOffset.X;
            }

            if (maximizeBox)
            {
                textWidthDec += form.MaximizeBoxSize.Width + form.ControlBoxSpace;
            }

            if (minimizeBox)
            {
                textWidthDec += form.MinimizeBoxSize.Width + form.ControlBoxSpace;
            }

            textRect = new Rectangle(
                iconRect.Right + 3,
                form.BorderWidth,
                rect.Width - iconRect.Right - textWidthDec - 6,
                rect.Height - form.BorderWidth);

            using (AntiAliasGraphics antiGraphics = new AntiAliasGraphics(g))
            {
                //DrawCaptionBackground(//重绘标题栏背景颜色,暂时过滤掉标题栏背景颜色,用图片作为整体的背景,当需要时放开即可
                //    g,
                //    rect,
                //    e.Active);
                //绘制标题图片
                if (form.ShowIcon && form.Icon != null)
                {
                    DrawIcon(g, iconRect, form.Icon);
                }
                //绘制文字
                if (!string.IsNullOrEmpty(form.Text))
                {
                    DrawCaptionText(
                        g,
                        textRect,
                        form.Text,
                        form.CaptionFont);
                }
            }
            //实时监控背景颜色的改变
            InitSkinForm(e.SkinForm);

            //监控透明度的变化
            double value = 100;

            if (Temp.Open == "True")
            {
                value = double.Parse(Temp.Opacity);
                e.SkinForm.Opacity = (100 - value) / 100.0;
            }
            else
            {
                e.SkinForm.Opacity = 1;
            }
        }
コード例 #8
0
 /// <summary>
 /// 窗体的背景颜色
 /// </summary>
 /// <param name="form"></param>
 public override void InitSkinForm(SkinForm form)
 {
     //form.BackColor = Color.LightBlue;// ColorTable.Back;
 }