Example #1
0
        public override void Draw(IDrawingGraphics drawingGraphics)
        {
            if (m_pressed)
            {
                drawingGraphics.Color(this.BorderColor);
                drawingGraphics.FillRectangle(0, 0, 40, 40);
            }
            else
            if (m_checked)
            {
                drawingGraphics.Color(this.BorderColor);
                drawingGraphics.PenWidth(2);
                drawingGraphics.DrawRectangle(0, 0, 40, 40);

                drawingGraphics.FillRectangle(5, 5, 35, 35);
            }
            else
            {
                // unchecked unpressed
                drawingGraphics.Color(this.BackgroundColor);
                drawingGraphics.FillRectangle(0, 0, 40, 40);

                drawingGraphics.Color(this.BorderColor);
                drawingGraphics.PenWidth(2);
                drawingGraphics.DrawRectangle(0, 0, 40, 40);
            }

            drawingGraphics.Style(this.Style);

            switch (this.AutoSizeMode)
            {
                case AutoSizeModeOptions.None:
                case AutoSizeModeOptions.OneLineAutoHeight:
                    drawingGraphics.MoveX(60).DrawText(m_text);
                    break;
                case AutoSizeModeOptions.WrapText:
                    drawingGraphics.MoveX(60).DrawMultiLineText(m_text, this.Size.Width, this.Size.Height);
                    break;
            }
        }
Example #2
0
        public override void Draw(IDrawingGraphics drawingGraphics)
        {
            if (m_pressed)
            {
                drawingGraphics.Color(BorderColor);
                drawingGraphics.FillRectangle(0, 0, this.Size.Width, this.Size.Height);

                drawingGraphics.Style(new TextStyle(Style.FontFamily, Style.FontSize, BackgroundColor));
            }
            else
            {
                drawingGraphics.Color(BackgroundColor);
                drawingGraphics.FillRectangle(0, 0, this.Size.Width, this.Size.Height);

                drawingGraphics.Color(this.BorderColor);
                drawingGraphics.PenWidth(3);
                drawingGraphics.DrawRectangle(0, 0, this.Size.Width, this.Size.Height);
                drawingGraphics.PenWidth(1);

                drawingGraphics.Style(this.Style);
            }

            switch (this.AutoSizeMode)
            {
                case AutoSizeModeOptions.None:
                case AutoSizeModeOptions.OneLineAutoHeight:
                    {
                        int width = drawingGraphics.CalculateTextWidth(m_text);
                        drawingGraphics.MoveX((this.Size.Width - width) / 2).DrawText(m_text);
                        break;
                    }
                case AutoSizeModeOptions.WrapText:
                    drawingGraphics.DrawMultiLineText(m_text, this.Size.Width, this.Size.Height);
                    break;
            }
        }