Beispiel #1
0
 public static AeroText CreateWithGlow(Graphics g, string text, Font font, Padding internalBounds, Rectangle bounds, Color color, TextFormatFlags formatFlags, int glowSize)
 {
     return(AeroText.Create(g, text, font, internalBounds, bounds, color, formatFlags, AeroLabelMode.Aero, new IThemeTextOption[]
     {
         new GlowOption(glowSize)
     }));
 }
Beispiel #2
0
 protected override void OnHandleDestroyed(EventArgs e)
 {
     if (this._hText != null)
     {
         this._hText.Dispose();
     }
     this._hText = null;
     base.OnHandleDestroyed(e);
 }
Beispiel #3
0
        public static AeroText Create(Graphics g, string text, Font font, Padding internalBounds, Rectangle bounds, Color color, TextFormatFlags formatFlags, AeroLabelMode mode, IThemeTextOption[] options)
        {
            IntPtr outputHdc = g.GetHdc();
            IntPtr DIB;
            IntPtr compatHdc = AeroText.CreateNewHDC(outputHdc, bounds, out DIB);

            AeroText.DrawOnHDC(compatHdc, text, font, internalBounds, bounds, color, formatFlags, mode, options);
            AeroText.CleanUpHDC(DIB);
            g.ReleaseHdc(outputHdc);
            return(new AeroText(compatHdc, bounds, mode));
        }
Beispiel #4
0
 protected override void OnPaint(PaintEventArgs e)
 {
     base.OnPaint(e);
     if (base.Visible)
     {
         if (this._hText == null)
         {
             this._hText = AeroText.Create(e.Graphics, this.Text, this.Font, this.Padding, new Rectangle(0, 0, base.Size.Width, base.Size.Height), this.ForeColor, this.CreateFormatFlags(), this._mode, this.CreateOptions());
         }
         if (this._needsUpdate)
         {
             this._hText.Draw(e.Graphics, new Rectangle(0, 0, base.Size.Width, base.Size.Height));
             this._hText.Update(e.Graphics, this.Text, this.Font, this.Padding, new Rectangle(0, 0, base.Size.Width, base.Size.Height), this.ForeColor, this.BackColor, this.CreateFormatFlags(), this.CreateOptions());
             this._needsUpdate = false;
             base.Invalidate();
             return;
         }
         this._hText.Draw(e.Graphics, new Rectangle(0, 0, base.Size.Width, base.Size.Height));
     }
 }
Beispiel #5
0
        public void Update(Graphics g, string text, Font font, Padding internalBounds, Rectangle bounds, Color color, Color backColor, TextFormatFlags formatFlags, IThemeTextOption[] options)
        {
            IntPtr compatHdc = this._TextHDC;

            if (bounds.Equals(this._TextHDCBounds))
            {
                IntPtr hClearBrush = NativeMethod.CreateSolidBrush(ColorTranslator.ToWin32(backColor));
                RECT   cleanRect   = new RECT(bounds);
                NativeMethod.FillRect(compatHdc, ref cleanRect, hClearBrush);
                NativeMethod.DeleteObject(hClearBrush);
            }
            else
            {
                IntPtr outputHdc = g.GetHdc();
                IntPtr DIB;
                compatHdc           = AeroText.CreateNewHDC(outputHdc, bounds, out DIB);
                this._TextHDC       = compatHdc;
                this._TextHDCBounds = bounds;
                AeroText.CleanUpHDC(DIB);
                g.ReleaseHdc(outputHdc);
            }
            AeroText.DrawOnHDC(compatHdc, text, font, internalBounds, bounds, color, formatFlags, this._mode, options);
        }