Ejemplo n.º 1
0
        public override void Render(G3Canvas g)
        {
            if (Text == null)
                Text = string.Empty;

            g.BeginDrawing();

            Rectangle r = this.Bound;
            g.FillRectangle(r, G3Color.WHITE);
            g.Rectangle(r, G3Color.GRAY);

            byte[] chars;

            if (Focused)
            {
                chars = Parent.Encoding.GetBytes(Text + "\u25cf");
            }
            else
            {
                chars = Parent.Encoding.GetBytes(Text);
            }

            chars = CropText(chars, Size.Width);

            g._DrawTextC(chars, FontStyle.Font,
                Location.X + 2 + (FontStyle.Font.TextWidth(chars) / 2),
                Location.Y + (Size.Height / 2),
                FontStyle.FontColor, FontStyle.HaloColor);

            g.EndDrawing();
        }
Ejemplo n.º 2
0
        public override void Render(G3Canvas g)
        {
            Graphics gx = g.Surface.WindowsGraphics;

            if (Selected)
            {
                gx.DrawRoundedRectangle(new Pen(BorderColor.WindowsColor), this.SelectedItemColor.WindowsColor, this.Bound, new Size(10, 10));
            }
            else
            {
                gx.DrawRoundedRectangle(new Pen(BorderColor.WindowsColor), this.ItemColor.WindowsColor, this.Bound, new Size(10, 10));
            }

            if (this.Image == null)
            {
                g.BeginDrawing();

                Rectangle r1 = this.Bound;
                r1.Height = r1.Height / 2;
                r1.Offset(2, 0);

                // DEBUG: g.Rectangle(r1, G3Color.BLUE);

                byte[] chars = Parent.Encoding.GetBytes(Text1);
                chars = CropText(chars, r1.Width, Text1Style);

                if (chars != null)
                {
                    g._DrawTextC(chars, Text1Style.Font,
                        r1.X + 2 + (Text1Style.Font.TextWidth(chars) / 2),
                        r1.Y + (r1.Height / 2),
                        Text1Style.FontColor, Text1Style.HaloColor);
                }

                r1.Offset(0, r1.Height);

                // DEBUG: g.Rectangle(r1, G3Color.GREEN);

                chars = Parent.Encoding.GetBytes(Text2);
                chars = CropText(chars, r1.Width, Text2Style);

                if (chars != null)
                {
                    g._DrawTextC(chars, Text2Style.Font,
                        r1.X + 2 + (Text2Style.Font.TextWidth(chars) / 2),
                        r1.Y + (r1.Height / 2),
                        Text2Style.FontColor, Text2Style.HaloColor);
                }

                //g.DrawText(Text2, UICanvas.Encoding,
                //    Text2Style.Font, Text2Style.FontColor, Text2Style.HaloColor,
                //    TextAlign.Left, r1);

                g.EndDrawing();
            }
            else
            {
                gx.DrawImageTransparent(this.Image, new Rectangle(this.Location.X,
                    this.Location.Y, this.Size.Height, this.Size.Height));

                g.BeginDrawing();

                Rectangle r1 = this.Bound;
                r1.Height = r1.Height / 2;
                r1.Offset(this.Size.Height, 0);
                r1.Width = r1.Width - this.Size.Height;

                byte[] chars = Parent.Encoding.GetBytes(Text1);
                chars = CropText(chars, r1.Width, Text1Style);

                if (chars != null)
                {
                    g._DrawTextC(chars, Text1Style.Font,
                        r1.X + 2 + (Text1Style.Font.TextWidth(chars) / 2),
                        r1.Y + (r1.Height / 2),
                        Text1Style.FontColor, Text1Style.HaloColor);
                }

                r1.Offset(0, r1.Height);

                chars = Parent.Encoding.GetBytes(Text2);
                chars = CropText(chars, r1.Width, Text2Style);

                if (chars != null)
                {
                    g._DrawTextC(chars, Text2Style.Font,
                        r1.X + 2 + (Text2Style.Font.TextWidth(chars) / 2),
                        r1.Y + (r1.Height / 2),
                        Text2Style.FontColor, Text2Style.HaloColor);
                }

                g.EndDrawing();
            }
        }