示例#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();
        }
示例#2
0
        public override void Render(G3Canvas g)
        {
            {
                if (Image != null)
                {
                    Graphics gx = g.Surface.WindowsGraphics;
                    gx.DrawImageTransparent(Image, this.Bound);
                }
            }

            if (!string.IsNullOrEmpty(Text) || _pressed)
            {
                g.BeginDrawing();

                g.DrawText(Text, Parent.Encoding, FontStyle.Font, FontStyle.FontColor, FontStyle.HaloColor,
                    this.TextAlign, this.Bound);

                if (_pressed)
                {
                    g.DarkBox(Location.X, Location.Y, Size.Width, Size.Height, 9);
                }

                g.EndDrawing();
            }
        }
示例#3
0
        public override void Render(G3Canvas g)
        {
            {
                Graphics gx = g.Surface.WindowsGraphics;

                if (this.Checked)
                {
                    if (CheckedImage != null)
                    {
                        gx.DrawImage(CheckedImage, Location.X, Location.Y + ((Size.Height - CheckedImage.Height) / 2));
                    }
                }
                else
                {
                    if (UncheckedImage != null)
                    {
                        gx.DrawImage(UncheckedImage, Location.X, Location.Y + ((Size.Height - UncheckedImage.Height) / 2));
                    }
                }
            }

            g.BeginDrawing();

            Rectangle r = this.Bound;
            r.Offset(CheckedImage.Width, 0);

            g.DrawText(Text, Parent.Encoding, FontStyle.Font, FontStyle.FontColor, FontStyle.HaloColor,
                 TextAlign.Left, r);

            g.EndDrawing();
        }
示例#4
0
 public void Draw(G3Canvas canvas, int x, int y, int w, int h)
 {
     if (UseAlpha)
     {
         canvas.Gradient(x, y, w, h, FromColor, ToColor, FromAlpha, ToAlpha);
     }
     else
     {
         canvas.Gradient(x, y, w, h, FromColor, ToColor);
     }
 }
示例#5
0
 public void DrawDarker(G3Canvas canvas, int x, int y, int w, int h, byte level)
 {
     if (UseAlpha)
     {
         canvas.Gradient(x, y, w, h,
             FromColor.Darker(level), ToColor.Darker(level), FromAlpha, ToAlpha);
     }
     else
     {
         canvas.Gradient(x, y, w, h,
             FromColor.Darker(level), ToColor.Darker(level));
     }
 }
        public override void Render(G3Canvas g)
        {
            g.BeginDrawing();

            Gradient.Draw(g, this.Bound);

            if (Border.Enabled)
                Border.Draw(g, this.Bound);

            g.DrawText(Text, Parent.Encoding, FontStyle.Font,
                 FontStyle.FontColor, FontStyle.HaloColor, TextAlign.Center, this.Bound);

            g.EndDrawing();
        }
示例#7
0
        public override void Render(G3Canvas g)
        {
            g.BeginDrawing();

            foreach (var item in LineList)
            {
                for (int k = 0; k < item.Length - 1; k++)
                {
                    g.DrawLineSegmentSafe(item[k].X, item[k].Y, item[k + 1].X, item[k + 1].Y, LineColor);
                }
            }

            g.EndDrawing();
        }
示例#8
0
        public override void Render(G3Canvas g)
        {
            if (Items.Modified)
            {
                CreateMenu();
                Items.Modified = false;
            }

            g.BeginDrawing();

            Gradient.Draw(g, this.Bound);
            Border.Draw(g, this.Bound);

            g.EndDrawing();

            Items.Render(g);
        }
示例#9
0
        public override void Render(G3Canvas g)
        {
            Graphics gx = g.Surface.WindowsGraphics;

            if (Image != null)
            {
                gx.DrawImageTransparentUnstreched(Image, this.Center);
            }

            if (_pressed)
            {
                g.BeginDrawing();

                //g.DrawTextCenter(Text, UICanvas.Encoding, FontStyle.Font, Location.X + (Size.Width / 2),
                //                                          Location.Y + (Size.Height / 2), 0,
                //                                          G3Color.GRAY,
                //                                          G3Color.WHITE);

                g.DarkBox(Location.X, Location.Y, Size.Width, Size.Height, 9);
                g.EndDrawing();
            }
        }
示例#10
0
        public override void Render(G3Canvas g)
        {
            // IMPROVE: Bu kod UIElement içine yapılacak bir eklenti ile BeforeAdd ve AfterRemove işlemleri
            // içerisine taşınacak.
            Parent.UICanvas.DisableAll();
            this.Enable = true;

            g.BeginDrawing();

            g.DarkBox(0, 0,
                System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width,
                System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height, 10);

            int w = this.Size.Width;
            int h = this.Size.Height;

            int x = this.Location.X;
            int y = this.Location.Y;

            // MessageBox
            this.Gradient.Draw(g, x, y + 30, w, h);

            // Title
            this.TitleGradient.Draw(g, x, y, w, 30);

            // Title Text
            g.DrawText(Title, Parent.Encoding, TitleFont, G3Color.BLACK, G3Color.WHITE, TextAlign.Center,
                new Rectangle(x, y, w, 30));

            // Message Text
            g.DrawText(Text, Parent.Encoding, Font, G3Color.GRAY, G3Color.WHITE, TextAlign.Center,
                new Rectangle(x, y + 30, w, h));

            // Border
            g.Rectangle(x, y, w, h + 30, G3Color.GRAY);

            g.EndDrawing();
        }
示例#11
0
        public override void Render(G3Canvas g)
        {
            g.BeginDrawing();

            if (pressed)
            {
                Gradient.DrawDarker(g, this.Bound, 30);
            }
            else
            {
                Gradient.Draw(g, this.Bound);
            }

            g.EndDrawing();

            if (MaskImage != null)
            {
                {
                    Graphics gx = g.Surface.WindowsGraphics;
                    gx.DrawImageTransparent(MaskImage, this.Bound, MaskImageColor.WindowsColor);
                }
            }

            if (!string.IsNullOrEmpty(Text))
            {
                g.BeginDrawing();

                if (Border.Enabled)
                    Border.Draw(g, this.Bound);

                g.DrawText(Text, Parent.Encoding, FontStyle.Font, FontStyle.FontColor, FontStyle.HaloColor,
                     this.TextAlign, this.Bound);

                g.EndDrawing();
            }
        }
示例#12
0
        protected override void OnPaint(PaintEventArgs e)
        {
            // Yoksa yarat
            if (_offScreen == null)
            {
                _offScreen = new G3Canvas(this.Width, this.Height);
            }

            // Resize oldu ise!
            if (_offScreen.Surface.Width != this.Width || _offScreen.Surface.Height != this.Height)
            {
                _offScreen.Dispose();
                _offScreen = new G3Canvas(this.Width, this.Height);
            }

            // Render
            Graphics g = _offScreen.Surface.WindowsGraphics;

            // Background
            if (this.BackgroundImage != null)
            {
                g.DrawImage(this.BackgroundImage, 0, 0);
            }
            else
            {
                _offScreen.BeginDrawing();
                _offScreen.Surface.Clear(BackgroundColor);
                _offScreen.EndDrawing();
            }

            // Render
            _canvas.Render(_offScreen);

            // ExecuteOnce
            // Activity varsa ve Execute edilmemişse.
            if (Activity != null && !_activityExecuted)
            {
                if (Activity.Transition != TransitionEffects.None)
                {
                    // Transition here
                    MakeTransition(Activity.Transition, e.Graphics);
                }
                else
                {
                    // Ekrana çiz
                    _offScreen.Surface.DrawCanvas(e.Graphics, e.ClipRectangle);
                }

                _activityExecuted = true;
                Activity.ExecuteOnce(this);
            }
            else
            {
                // Ekrana çiz
                _offScreen.Surface.DrawCanvas(e.Graphics, e.ClipRectangle);
            }
        }
示例#13
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();
            }
        }
示例#14
0
 public abstract void Render(G3Canvas g);
示例#15
0
 public void Draw(G3Canvas g, Rectangle bound)
 {
     if (Enabled)
         g.Rectangle(bound, Color);
 }
示例#16
0
 public void Draw(G3Canvas canvas, Rectangle bound)
 {
     Draw(canvas, bound.Left, bound.Top, bound.Width, bound.Height);
 }
示例#17
0
        public override void Render(G3Canvas g)
        {
            g.BeginDrawing();

            g.FillRectangle(this.Bound, this.BackgroundColor);

            if (Border.Enabled)
            {
                Border.Draw(g, this.Bound);
            }

            g.EndDrawing();

            Items.Render(g, this);
        }
示例#18
0
 public void DrawDarker(G3Canvas canvas, Rectangle bound, byte level)
 {
     DrawDarker(canvas, bound.Left, bound.Top, bound.Width, bound.Height, level);
 }
示例#19
0
        public override void Render(G3Canvas g)
        {
            if (!_layoutCreated)
            {
                _layoutCreated = true;
                CreateLayout();
            }

            g.BeginDrawing();
            g.FillRectangle(Location.X, Location.Y, Size.Width, Size.Height, G3Color.FromRGB(49, 52, 49));
            g.Rectangle(Location.X, Location.Y, Size.Width - 1, Size.Height, G3Color.GRAY);
            g.EndDrawing();

            if (NumericKeyboard)
            {
                _canvasNum.Render(g);
            }
            else
            {
                _canvasAlfa.Render(g);
            }
        }