Example #1
0
        public override void Draw(IDrawingGraphics drawingGraphics)
        {
            drawingGraphics.Color(MetroTheme.PhoneTextBoxBrush);
            drawingGraphics.FillRectangle(0, 0, Size.Width, Size.Height);

            drawingGraphics.Color(MetroTheme.PhoneTextBoxBorderBrush);
            drawingGraphics.PenWidth(MetroTheme.PhoneBorderThickness.BorderThickness.Pixels);
            drawingGraphics.DrawRectangle(0, 0, Size.Width, Size.Height);

            drawingGraphics.Style(this.Style);

            if (MultiLine)
                drawingGraphics.DrawMultiLineText(this._text, this.Size.Width, this.Size.Height);
            else
                drawingGraphics.DrawText(this._text);
        }
Example #2
0
 public override void Draw(IDrawingGraphics drawingGraphics)
 {
     drawingGraphics.Color(MetroTheme.PhoneAccentBrush);
     drawingGraphics.FillRectangle(0, 0, this.Size.Width, this.Size.Height);
     m_Icon.Draw(drawingGraphics.CreateChild(m_Icon.Location, m_Icon.TransformationScaling, m_Icon.TransformationCenter));
     m_Text.Draw(drawingGraphics.CreateChild(m_Text.Location, m_Text.TransformationScaling, m_Text.TransformationCenter));
 }
Example #3
0
 public void ApplyTo(IDrawingGraphics gr)
 {
     gr.FontName(this.FontFamily);
     gr.FontSize(this.FontSize);
     gr.Color(this.Foreground);
     gr.Bold(this.Bold);
 }
Example #4
0
 public override void Draw(IDrawingGraphics drawingGraphics)
 {
     drawingGraphics.Color(Color.FromArgb(50, 50, 50)).FillRectangle(0, 0, this.Size.Width, this.Size.Height)
         .Color(Color.FromArgb(220, 220, 220))
         .MoveTo(20, this.Size.Height - 65)
         .Style(MetroTheme.PhoneTextNormalStyle);
     this.drawAction(drawingGraphics);
 }
Example #5
0
 public override void Draw(IDrawingGraphics drawingGraphics)
 {
     drawingGraphics.Color(Color.FromArgb(50, 50, 50)).FillRectangle(0, 0, this.Size.Width, this.Size.Height)
     .Color(Color.FromArgb(220, 220, 220))
     .MoveTo(20, this.Size.Height - 65)
     .Style(MetroTheme.PhoneTextNormalStyle);
     this.drawAction(drawingGraphics);
 }
Example #6
0
        public override void Draw(IDrawingGraphics drawingGraphics)
        {
            // field border
            drawingGraphics.Color(MetroTheme.PhoneAccentBrush);
            drawingGraphics.FillRectangle(0, 0, Size.Width, Size.Height);

            // font example
            drawingGraphics.Style(new TextStyle(_textStyle.FontFamily, _textStyle.FontSize, _textStyle.Foreground));
            drawingGraphics.MoveRelX(4).DrawText(Caption());

            base.Draw(drawingGraphics);
        }
Example #7
0
        public void DrawScrollBar(IDrawingGraphics drawingGr)
        {
            drawingGr.DrawAlphaImage("verticalscrollbar.png", new Rectangle(this.Size.Width - this.ScrollBarWidth, 0, this.ScrollBarWidth, this.Size.Height));
            var scrollHeight = 0;
            var scrollBegin  = 0;

            if (this.Content.Size.Height != 0)
            {
                scrollHeight = Math.Max(this.Size.Height * this.Size.Height / this.Content.Size.Height, 20);
                scrollBegin  = this.Size.Height * -this.VerticalOffset / this.Content.Size.Height;
            }
            drawingGr.Color(this.ScrollBarColor).FillRectangle(new Rectangle(this.Size.Width - this.ScrollBarWidth, scrollBegin, this.ScrollBarWidth, scrollHeight));
        }
Example #8
0
        public override void Draw(IDrawingGraphics drawingGraphics)
        {
            drawingGraphics.Color(Color.Gray);
            drawingGraphics.FillRectangle(0, 0, Size.Width, Size.Height - 10);

            base.Draw(drawingGraphics);
        }
Example #9
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 #10
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;
            }
        }
Example #11
0
 public void DrawScrollBar(IDrawingGraphics drawingGr)
 {
     drawingGr.DrawAlphaImage("verticalscrollbar.png", new Rectangle(this.Size.Width - this.ScrollBarWidth, 0, this.ScrollBarWidth, this.Size.Height));
     var scrollHeight = 0;
     var scrollBegin = 0;
     if (this.Content.Size.Height != 0)
     {
         scrollHeight = Math.Max(this.Size.Height * this.Size.Height / this.Content.Size.Height, 20);
         scrollBegin = this.Size.Height * -this.VerticalOffset / this.Content.Size.Height;
     }
     drawingGr.Color(this.ScrollBarColor).FillRectangle(new Rectangle(this.Size.Width - this.ScrollBarWidth, scrollBegin, this.ScrollBarWidth, scrollHeight));
 }
Example #12
0
        public override void Draw(IDrawingGraphics drawingGraphics)
        {
            drawingGraphics.Color(MetroTheme.PhoneTextBoxBrush);
            drawingGraphics.FillRectangle(0, 0, Size.Width, Size.Height);

            drawingGraphics.Color(MetroTheme.PhoneTextBoxBorderBrush);
            drawingGraphics.PenWidth(MetroTheme.PhoneBorderThickness.BorderThickness.Pixels);
            drawingGraphics.DrawRectangle(0, 0, Size.Width, Size.Height);

            base.Draw(drawingGraphics);
        }
Example #13
0
 public void ApplyTo(IDrawingGraphics gr)
 {
     gr.FontName(this.FontFamily);
     gr.FontSize(this.FontSize);
     gr.Color(this.Foreground);
     gr.Bold(this.Bold);
 }
Example #14
0
File: Canvas.cs Project: cail/fleux
        public override void Draw(IDrawingGraphics drawingGraphics)
        {
            //if (lastVisibleRect != drawingGraphics.VisibleRect
            int ctime = System.Environment.TickCount;

            var visible = this.SafeChildren.Where(i => i.Visible && i.Bounds.IntersectsWith(drawingGraphics.VisibleRect));
            #if xDEBUG
            if (this is Fleux.UIElements.Panorama.PanoramaSection)
            {
                var ch = this.Children.Where(i => i.Visible);
            }
            var visible = this.Children.Where(i => i.Visible).ToList();
            #endif
            #if xDEBUG
            if (this.ID == "PanoramaSections"){
                System.Console.WriteLine("section:"+visible.Count + " vrect:"+drawingGraphics.VisibleRect.ToString());
                foreach(var ch in visible)
                    System.Console.WriteLine("child: "+ch.Bounds.ToString());
            }
            #endif

            ctime = System.Environment.TickCount-ctime;
            drawtime += ctime;
            foreach(var e in visible)
            {
                try{
            #if xDEBUG
                    System.Console.WriteLine("Canvas draw " + e.GetType().ToString() + " vis: "+visible.Count + "tot: "+this.ChildrenCount);
            #endif
                    /*if (e.Transformation != null)
                    {
                        //Bitmap b = new Bitmap(e.Size.Width, e.Size.Height);
                        //Graphics g =  Graphics.FromImage(b);
                        //var cdg = DrawingGraphics.FromGraphicsAndRect(g, b, new Rectangle(e.Location.X, e.Location.Y, e.Size.Width, e.Size.Height));
                        e.Draw(cdg);
                        //b.Dispose();
                        //g.Dispose();
                    }else*/
                        e.Draw(drawingGraphics.CreateChild(e.Location, e.Transformation));
            #if xDEBUG
                    drawingGraphics.Color(Color.Red);
                    drawingGraphics.DrawRectangle(e.Location.X, e.Location.Y, e.Size.Width, e.Size.Height);
            #endif
                }catch(Exception ex){
                    System.Console.WriteLine("Canvas draw exception " + ex);
                }
            };
        }
Example #15
0
        protected void DoDrawScrollBar(IDrawingGraphics drawingGraphics)
        {
            if (this.Content.Size.Height == 0) return;

            //if (_imageScrollBar == null)
            //    _imageScrollBar = ResourceManager.Instance.GetIImageFromEmbeddedResource(
            //        "verticalscrollbar.png", Assembly.GetExecutingAssembly());
            //drawingGraphics.DrawAlphaImage(_imageScrollBar, new Rectangle(this.Size.Width - 5, 0, 5, this.Size.Height));
            drawingGraphics.Color(Color.Silver).
                FillRectangle(new Rectangle(this.Size.Width - 5, 0, 5, this.Size.Height));

            var scrollHeight = Math.Max(this.Size.Height * this.Size.Height / this.Content.Size.Height, 20);
            var scrollBegin = this.Size.Height * -this.VerticalOffset / this.Content.Size.Height;
            drawingGraphics.Color(MetroTheme.PhoneForegroundBrush).
                FillRectangle(new Rectangle(this.Size.Width - 5, scrollBegin, 5, scrollHeight));
        }
Example #16
0
 private void DrawColor(IDrawingGraphics drawingGraphics, object arg)
 {
     drawingGraphics.Color(((ColorItem) arg).Color);
     drawingGraphics.FillRectangle(1, 9, 35, 44);
 }