Ejemplo n.º 1
0
        public void DrawSkinFormCaption(
            SkinFormCaptionRenderEventArgs e)
        {
            OnRenderSkinFormCaption(e);
            SkinFormCaptionRenderEventHandler handle =
                Events[EventRenderSkinFormCaption]
                as SkinFormCaptionRenderEventHandler;

            if (handle != null)
            {
                handle(this, e);
            }
        }
 protected override void OnRenderSkinFormCaption(SkinFormCaptionRenderEventArgs e)
 {
     throw new NotImplementedException();
 }
        //画标题和ICO
        protected override void OnRenderSkinFormCaption(
            SkinFormCaptionRenderEventArgs e)
        {
            Graphics   g        = e.Graphics;
            Rectangle  rect     = e.ClipRectangle;
            CCSkinMain 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.MaxSize.Width + form.ControlBoxSpace;
            }

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

            foreach (CmSysButton item in form.ControlBoxManager.SysButtonItems)
            {
                if (form.ControlBox && item.Visibale)
                {
                    textWidthDec += item.Size.Width + form.ControlBoxSpace;
                }
            }

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

            using (AntiAliasGraphics antiGraphics = new AntiAliasGraphics(g))
            {
                DrawCaptionBackground(
                    g,
                    rect,
                    e.Active);

                if (form.ShowDrawIcon && form.Icon != null)
                {
                    DrawIcon(g, iconRect, form.Icon);
                }

                if (!string.IsNullOrEmpty(form.Text))
                {
                    Color EfColor    = form.EffectBack;
                    Color TitleColor = form.TitleColor;
                    //判断是否根据背景色适应颜色
                    if (form.TitleSuitColor)
                    {
                        //如果背景色为暗色
                        if (SkinTools.ColorSlantsDarkOrBright(form.BackColor))
                        {
                            TitleColor = Color.White;
                            EfColor    = Color.Black;
                        }
                        else//如果背景色为亮色
                        {
                            TitleColor = Color.Black;
                            EfColor    = Color.White;
                        }
                    }
                    DrawCaptionText(
                        g,
                        textRect,
                        form.Text,
                        form.CaptionFont,
                        form.EffectCaption,
                        EfColor,
                        form.EffectWidth,
                        TitleColor,
                        form.TitleOffset);
                }
            }
        }
Ejemplo n.º 4
0
 protected abstract void OnRenderSkinFormCaption(
     SkinFormCaptionRenderEventArgs e);
 protected override void OnRenderSkinFormCaption(SkinFormCaptionRenderEventArgs e)
 {
     Graphics g = e.Graphics;
     Rectangle rect = e.ClipRectangle;
     CCSkinMain 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;
     bool sysBox = form.ControlBox && form.SysBottomVisibale;
     int textWidthDec = 0;
     if (closeBox)
     {
         textWidthDec += form.CloseBoxSize.Width + form.ControlBoxOffset.X;
     }
     if (maximizeBox)
     {
         textWidthDec += form.MaxSize.Width + form.ControlBoxSpace;
     }
     if (minimizeBox)
     {
         textWidthDec += form.MiniSize.Width + form.ControlBoxSpace;
     }
     if (sysBox)
     {
         textWidthDec += form.SysBottomSize.Width + form.ControlBoxSpace;
     }
     textRect = new Rectangle(iconRect.Right + 3, form.BorderWidth, ((rect.Width - iconRect.Right) - textWidthDec) - 6, rect.Height - form.BorderWidth);
     using (new AntiAliasGraphics(g))
     {
         this.DrawCaptionBackground(g, rect, e.Active);
         if (form.ShowDrawIcon && (form.Icon != null))
         {
             this.DrawIcon(g, iconRect, form.Icon);
         }
         if (!string.IsNullOrEmpty(form.Text))
         {
             this.DrawCaptionText(g, textRect, form.Text, form.CaptionFont, form.EffectCaption, form.EffectBack, form.EffectWidth, form.ForeColor);
         }
     }
 }
 public void DrawSkinFormCaption(SkinFormCaptionRenderEventArgs e)
 {
     this.OnRenderSkinFormCaption(e);
     SkinFormCaptionRenderEventHandler handle = this.Events[EventRenderSkinFormCaption] as SkinFormCaptionRenderEventHandler;
     if (handle != null)
     {
         handle(this, e);
     }
 }
 protected abstract void OnRenderSkinFormCaption(SkinFormCaptionRenderEventArgs e);
        //画标题和ICO
        protected override void OnRenderSkinFormCaption(
            SkinFormCaptionRenderEventArgs e)
        {
            Graphics g = e.Graphics;
            Rectangle rect = e.ClipRectangle;
            CCSkinMain 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.MaxSize.Width + form.ControlBoxSpace;
            }

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

            foreach (CmSysButton item in form.ControlBoxManager.SysButtonItems)
            {
                if (form.ControlBox && item.Visibale)
                {
                    textWidthDec += item.Size.Width + form.ControlBoxSpace;
                }
            }

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

            using (AntiAliasGraphics antiGraphics = new AntiAliasGraphics(g))
            {
                DrawCaptionBackground(
                    g,
                    rect,
                    e.Active);

                if (form.ShowDrawIcon && form.Icon != null)
                {
                    DrawIcon(g, iconRect, form.Icon);
                }

                if (!string.IsNullOrEmpty(form.Text))
                {
                    Color EfColor = form.EffectBack;
                    Color TitleColor = form.TitleColor;
                    //判断是否根据背景色适应颜色
                    if (form.TitleSuitColor)
                    {
                        //如果背景色为暗色
                        if (SkinTools.ColorSlantsDarkOrBright(form.BackColor))
                        {
                            TitleColor = Color.White;
                            EfColor = Color.Black;
                        }
                        else//如果背景色为亮色
                        {
                            TitleColor = Color.Black;
                            EfColor = Color.White;
                        }
                    }
                    DrawCaptionText(
                        g,
                        textRect,
                        form.Text,
                        form.CaptionFont,
                        form.EffectCaption,
                        EfColor,
                        form.EffectWidth,
                        TitleColor,
                        form.TitleOffset);
                }
            }
        }
Ejemplo n.º 9
0
 protected override void OnRenderSkinFormCaption(SkinFormCaptionRenderEventArgs e)
 {
     throw new NotImplementedException();
 }