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)
        {
            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 #3
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 #4
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 #5
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);
                }
            };
        }