示例#1
0
        } // DisposeManagedResources

        #endregion

        #region Draw

        /// <summary>
        /// Prerender the control into the control's render target.
        /// </summary>
        protected override void DrawControl(Rectangle rect)
        {
            if (mode == ButtonMode.PushButton && pushed)
            {
                SkinLayer l = SkinInformation.Layers["Control"];
                Renderer.DrawLayer(l, rect, l.States.Pressed.Color, l.States.Pressed.Index);
                if (l.States.Pressed.Overlay)
                {
                    Renderer.DrawLayer(l, rect, l.Overlays.Pressed.Color, l.Overlays.Pressed.Index);
                }
            }
            else
            {
                base.DrawControl(rect);
            }

            SkinLayer layer = SkinInformation.Layers["Control"];
            int ox = 0; int oy = 0;

            if (ControlState == ControlState.Pressed)
            {
                ox = 1; oy = 1;
            }
            if (glyph != null)
            {
                Margins cont = layer.ContentMargins;
                Rectangle r = new Rectangle(rect.Left + cont.Left, rect.Top + cont.Top, rect.Width - cont.Horizontal, rect.Height - cont.Vertical);
                Renderer.DrawGlyph(glyph, r);
            }
            else
            {
                Renderer.DrawString(this, layer, Text, rect, true, ox, oy);
            }
        } // DrawControl