Beispiel #1
0
 protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
 {
     AdvanceDrawing.DrawBlurryTextAndImage(
         e.Graphics,
         this.ClientRectangle,
         this.Text,
         this.Font,
         this.ForeColor,
         this.blurColor,
         this.TextAlign,
         this.blur,
         this.Image,
         this.ImageAlign);
 }
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs pevent)
        {
            if (DWMNativeMethods.IsCompositionEnable())
            {
                Rectangle clientRectangle = new Rectangle(0, 0, this.Width, this.Height);
                ButtonRenderer.DrawParentBackground(pevent.Graphics, this.Bounds, this.Parent);

                ButtonRenderer.DrawButton(pevent.Graphics, clientRectangle, this.buttonState);

                //Image imgText = AdvanceDrawing.DrawBlurryText(this.Text, this.Font, this.ForeColor, this.BackColor, 1);
                //Point ptText = new Point((this.Width - imgText.Width) / 2, (this.Height - imgText.Height) / 2);
                //pevent.Graphics.DrawImageUnscaled(imgText, ptText);

                //imgText.Dispose();
                Rectangle rect = this.ClientRectangle;
                rect.Inflate(-Margin.Horizontal, -Margin.Vertical);
                //rect.Offset(-Margin.Left, -Margin.Top);

                if (this.Enabled)
                {
                    AdvanceDrawing.DrawTextAndImage(
                        pevent.Graphics,
                        rect,
                        this.Text,
                        this.Font,
                        this.ForeColor,
                        this.BackColor,
                        this.TextAlign,
                        this.Image,
                        this.ImageAlign);
                }
                else
                {
                    AdvanceDrawing.DrawDisabledTextAndImage(
                        pevent.Graphics,
                        rect,
                        this.Text,
                        this.Font,
                        this.ForeColor,
                        this.BackColor,
                        this.TextAlign,
                        this.Image,
                        this.ImageAlign);
                }
            }
            else
            {
                base.OnPaint(pevent);
            }
        }
Beispiel #3
0
        private void DrawLabel(IntPtr handle)
        {
            System.Windows.Forms.Label label = Control.FromHandle(handle) as System.Windows.Forms.Label;
            if (label == null)
            {
                return;
            }

            using (Graphics g = label.CreateGraphics())
            {
                AdvanceDrawing.DrawBlurryTextAndImage(
                    g,
                    label.ClientRectangle,
                    label.Text,
                    label.Font,
                    label.ForeColor,
                    this.BlurColor,
                    label.TextAlign,
                    this.BlurSize,
                    label.Image,
                    label.ImageAlign);
            }
        }