Exemplo n.º 1
0
        protected virtual void OnCaptionInformation(CaptionInformationEventArgs e)
        {
            EventHandler <CaptionInformationEventArgs> dlg = (EventHandler <CaptionInformationEventArgs>)Events[CaptionInformationEvent];

            if (dlg != null)
            {
                dlg(this, e);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 描画処理の拡張
        /// </summary>
        /// <param name="e"></param>
        protected override void OnPaint(PaintEventArgs e)
        {
            Brush brush = new SolidBrush(ClickableColor);
            //Pen pen = new Pen(ButtonLabelFocusBackColor);
            Color fc  = ButtonLabelForeColor;
            Color mfc = ButtonLabelForeColor;

            e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;

            int clheight = DisplayRectangle.Height;
            int clwidth  = DisplayRectangle.Width;

            e.Graphics.TranslateTransform(DisplayRectangle.X, DisplayRectangle.Y);


            if (TextVisible)
            {
                if (!string.IsNullOrEmpty(Text) || Foldable)
                {
                    if (Foldable)
                    {
                        GraphicsPath gp;

                        if (FolderOpened)
                        {
                            Rectangle    r   = new Rectangle(6, LabelSize.Height + 6 - 4, clwidth - 12, clheight - LabelSize.Height - 12 + 4);
                            GraphicsPath gpf = CaptionGraphics.CreateRoundRectPath(r, 4, 4, false, true, true, true);

                            CaptionGraphics.DrawShadow(e.Graphics, gpf);

                            e.Graphics.FillPath(new SolidBrush(BackColor), gpf);

                            Pen p = new Pen(ButtonLabelBackColor, 2);
                            e.Graphics.DrawPath(p, gpf);

                            gp = CaptionGraphics.CreateRoundRectPath(new Rectangle(6, 2, LabelSize.Width, LabelSize.Height), 4, 4, true, true, false, false);
                            e.Graphics.FillPath(brush, gp);
                            e.Graphics.DrawPath(new Pen(brush, 2), gp);

                            DrawMarkAndText(e.Graphics, Font, (Focused) ? ButtonLabelFocusBackColor : mfc, fc, new Point(CaptionMargin.Left + 6, CaptionMargin.Top + 2));
                        }
                        else
                        {
                            Rectangle r = new Rectangle(6, 2, clwidth - 12, LabelSize.Height);
                            gp = CaptionGraphics.CreateRoundRectPath(r, 4, 4, true, true, true, true);
                            CaptionGraphics.DrawShadow(e.Graphics, gp);

                            e.Graphics.FillPath(brush, gp);

                            Pen p = new Pen(brush, 2);
                            e.Graphics.DrawPath(p, gp);

                            CaptionInformationEventArgs ev = new CaptionInformationEventArgs(Information);
                            OnCaptionInformation(ev);

                            DrawMarkAndText(e.Graphics, Font, (Focused) ? ButtonLabelFocusBackColor : mfc, fc, new Rectangle(CaptionMargin.Left + 6, CaptionMargin.Top + 2, clwidth - 12 - CaptionMargin.Horizontal, LabelSize.Height), false, ev.Information);
                        }
                    }
                    else
                    {
                        Rectangle    r   = new Rectangle(6, 2, clwidth - 12, clheight - 8);
                        GraphicsPath gpf = CaptionGraphics.CreateRoundRectPath(r, 4, 4, true, true, true, true);
                        CaptionGraphics.DrawShadow(e.Graphics, gpf);

                        e.Graphics.FillPath(new SolidBrush(BackColor), gpf);

                        Pen p = new Pen(ButtonLabelBackColor, 2);
                        e.Graphics.DrawPath(p, gpf);


                        GraphicsPath gp = CaptionGraphics.CreateRoundRectPath(new Rectangle(6, 2, clwidth - 12, LabelSize.Height), 4, 4, true, true, false, false);
                        e.Graphics.FillPath(brush, gp);

                        CaptionInformationEventArgs ev = new CaptionInformationEventArgs(Information);
                        OnCaptionInformation(ev);


                        //DrawMarkAndText(e.Graphics, Font, (Focused) ? ButtonLabelFocusBackColor : mfc, fc, new Point(CaptionMargin.Left + 6, CaptionMargin.Top + 2));
                        DrawMarkAndText(e.Graphics, Font, (Focused) ? ButtonLabelFocusBackColor : mfc, fc, new Rectangle(CaptionMargin.Left + 6, CaptionMargin.Top + 2, clwidth - 12 - CaptionMargin.Horizontal, LabelSize.Height), false, ev.Information);
                    }
                }
                else
                {
                    Rectangle    r   = new Rectangle(6, 6, clwidth - 12, clheight - 12);
                    GraphicsPath gpf = CaptionGraphics.CreateRoundRectPath(r, 4, 4, true, true, true, true);
                    CaptionGraphics.DrawShadow(e.Graphics, gpf);

                    e.Graphics.FillPath(new SolidBrush(BackColor), gpf);

                    Pen p = new Pen(ButtonLabelBackColor, 2);
                    e.Graphics.DrawPath(p, gpf);
                }
            }
            e.Graphics.TranslateTransform(-DisplayRectangle.X, -DisplayRectangle.Y);

            base.OnPaint(e);
        }