Esempio n. 1
0
        protected virtual void Draw(Graphics g, Image i)
        {
            if (i == null)
            {
                return;
            }

            ThemedDrawing.DrawThemed(g, i, this.ClientRectangle, ts, bs, rs, ls);
        }
Esempio n. 2
0
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            // Set : smooth drawing
            e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

            // Paint disabled state
            if (!this.Enabled && _disabled != null)
            {
                // Paint the image
                Rectangle r = new Rectangle(0, 0, Width, Height);
                ThemedDrawing.DrawThemed(e.Graphics, _disabled, r, ThemeSlices);
                return;
            }

            // Paint - depending on the state
            if (_pressed || _isSelected)
            {
                if (_pressedImage != null)
                {
                    Rectangle r = new Rectangle(0, 0, Width, Height);
                    ThemedDrawing.DrawThemed(e.Graphics, _pressedImage, r, ThemeSlices);
                }
            }
            else
            {
                if (_highlight)
                {
                    if (_highlightImage != null)
                    {
                        Rectangle r = new Rectangle(0, 0, Width, Height);
                        ThemedDrawing.DrawThemed(e.Graphics, _highlightImage, r, ThemeSlices);
                    }
                }
                else
                {
                    if (_faceImage != null)
                    {
                        Rectangle r = new Rectangle(0, 0, Width, Height);
                        ThemedDrawing.DrawThemed(e.Graphics, _faceImage, r, ThemeSlices);
                    }
                }
            }
        }