Esempio n. 1
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));
 }
Esempio n. 2
0
 public override void Draw(IDrawingGraphics drawingGraphics)
 {
     this.Children
         .Where(i => i.Bounds.IntersectsWith(drawingGraphics.VisibleRect))
         .ToList()
         .ForEach(e => e.Draw(drawingGraphics.CreateChild(e.Location, e.TransformationScaling, e.TransformationCenter)));
 }
Esempio n. 3
0
        public override void Draw(IDrawingGraphics drawingGraphics)
        {
            if (this.Content == null) return;

            //!! todo - потом можно выделить в какой нибудь класс обертку над drawingGraphics
            var location = this.Location;
            UIElement curElement = this;
            while ((curElement = curElement.Parent) != null)
                location.Offset(curElement.Location.X, curElement.Location.Y);
            drawingGraphics.Graphics.Clip = new Region(new Rectangle(location.X, location.Y, Size.Width, Size.Height).ToPixels());

            this.Content.Draw(drawingGraphics.CreateChild(new Point(this.HorizontalOffset, this.VerticalOffset),
                                                 this.Content.TransformationScaling, this.Content.TransformationCenter));
            if (this.ShowScrollbars)
            {
                this.DoDrawScrollBar(drawingGraphics);
            }

            if (this.DrawShadows)
            {
                DoDrawShadows(drawingGraphics);
            }

            drawingGraphics.Graphics.ResetClip(); //
        }
Esempio n. 4
0
 public override void Draw(IDrawingGraphics drawingGraphics)
 {
     if (DecorateBefore != null)
         DecorateBefore(drawingGraphics);
     Target.Draw(drawingGraphics.CreateChild(Target.Location, Target.TransformationScaling, Target.TransformationCenter));
     if (DecorateAfter != null)
         DecorateAfter(drawingGraphics);
 }
Esempio n. 5
0
        public override void Draw(IDrawingGraphics drawingGraphics)
        {
            this.headers.Location = new Point(this.offsetForPanning + this.offsetForHeaders + HeadersLocation.X, HeadersLocation.Y);
            this.body.Clear();
            this.CurrentItem.Body.Location = new Point(0, 0);
            this.CurrentItem.Body.Size     = this.body.Size;
            this.body.Location             = new Point(BodyLocation.X + this.offsetForBody + (this.offsetForPanning * 2), BodyLocation.Y);
            this.body.AddElement(this.CurrentItem.Body);

            base.Draw(drawingGraphics);

            this.DrawHeaders(drawingGraphics.CreateChild(new Point(HeadersLocation.X - this.headersWidth + this.offsetForHeaders + this.offsetForPanning, HeadersLocation.Y)));
        }
Esempio n. 6
0
 public override void Draw(IDrawingGraphics drawingGraphics)
 {
     if (m_pressed)
     {
         m_image.Location = new Point(2, 2);
         //drawingGraphics.DrawImage(m_image, 2, 2, Size.Width, Size.Height);
     }
     else
     {
         m_image.Location = new Point(0, 0);
         //drawingGraphics.DrawImage(m_image, 0, 0, Size.Width, Size.Height);
     }
     m_image.DrawTransparent(drawingGraphics.CreateChild(m_image.Location));
 }
Esempio n. 7
0
        public override void Draw(IDrawingGraphics drawingGraphics)
        {
            //if (lastVisibleRect != drawingGraphics.VisibleRect
            int ctime   = System.Environment.TickCount;
            var visible = this.Children.Where(i => i.Bounds.IntersectsWith(drawingGraphics.VisibleRect)).ToList();

            ctime     = System.Environment.TickCount - ctime;
            drawtime += ctime;
            foreach (var e in visible)
            {
                e.Draw(drawingGraphics.CreateChild(e.Location, e.TransformationScaling, e.TransformationCenter));
            }
            ;
        }
Esempio n. 8
0
 public override void Draw(IDrawingGraphics drawingGraphics)
 {
     try{
         if (DecorateBefore != null)
             DecorateBefore(drawingGraphics);
     }catch(Exception e)
     {
         FleuxApplication.Log(e);
     }
     if (Target.Visible)
         Target.Draw(drawingGraphics.CreateChild(Target.Location, Target.Transformation));
     try{
         if (DecorateAfter != null)
             DecorateAfter(drawingGraphics);
     }catch(Exception e)
     {
         FleuxApplication.Log(e);
     }
 }
Esempio n. 9
0
File: Pivot.cs Progetto: flts/fleux
        public override void Draw(IDrawingGraphics drawingGraphics)
        {
            this.headers.Location = new Point(this.offsetForPanning + this.offsetForHeaders + HeadersLocation.X, HeadersLocation.Y);
            this.body.Clear();
            this.CurrentItem.Body.Location = new Point(0, 0);
            this.CurrentItem.Body.Size = this.body.Size;
            this.body.Location = new Point(BodyLocation.X + this.offsetForBody + (this.offsetForPanning * 2), BodyLocation.Y);
            this.body.AddElement(this.CurrentItem.Body);

            base.Draw(drawingGraphics);

            this.DrawHeaders(drawingGraphics.CreateChild(new Point(HeadersLocation.X - this.headersWidth + this.offsetForHeaders + this.offsetForPanning, HeadersLocation.Y)));
        }
Esempio n. 10
0
 // fast drawind method instead of double bufferes scrollview's method
 // because we know that height is the full screen and we don't neet cropping
 public override void Draw(IDrawingGraphics drawingGraphics)
 {
     //base.Draw(drawingGraphics); return;
     if (Content == null) return;
     Content.Draw(drawingGraphics.CreateChild(new Point(0, VerticalOffset)));
 }
Esempio n. 11
0
 protected virtual void DrawTileText(IDrawingGraphics drawingGraphics)
 {
     this.text.Draw(drawingGraphics.CreateChild(this.text.Location, this.text.TransformationScaling, this.text.TransformationCenter));
 }
Esempio n. 12
0
        /*
        public bool OnDblClick(Point clickLocation)
        {
            try
            {
                return (Tile != null) && Tile.OnClick(clickLocation);
            }
            catch (Exception)
            {
                return false;
            }
        }
        */
        public override void Draw(IDrawingGraphics drawingGraphics)
        {
            if (drawingGraphics == null)
                return;

            {
                var tileGraphic = _moving
                                      ? drawingGraphics.CreateChild(new Point(0, 0), (100.0 + _movingScale) / 100.0, new Point(Bounds.Width / 2, Bounds.Height / 2))
                                      : drawingGraphics;

                if (Tile != null)
                {
                    (Tile as UIElement).Draw(tileGraphic);
                }
                else
                {
                    // if tile is wrong - draw stub tile with warning text
                    var drawRect = new Rectangle(0, 0, Bounds.Width, Bounds.Height);

                    tileGraphic.Color(MetroTheme.PhoneAccentBrush);
                    tileGraphic.FillRectangle(drawRect);

                    tileGraphic.Color(MetroTheme.PhoneForegroundBrush);
                    tileGraphic.DrawRectangle(drawRect);

                    tileGraphic.Style(MetroTheme.PhoneTextSmallStyle);
                    tileGraphic.DrawText("Tile\nnot\nfound");
                }
            }
        }
Esempio n. 13
0
 // fast drawind method instead of double bufferes scrollview's method
 // because we know that height is the whole screen and we don't neet cropping
 public override void Draw(IDrawingGraphics drawingGraphics)
 {
     Content.Draw(drawingGraphics.CreateChild(new Point(0, VerticalOffset)));
 }
Esempio n. 14
0
File: Canvas.cs Progetto: 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);
                }
            };
        }
Esempio n. 15
0
 public override void Draw(IDrawingGraphics gr)
 {
     int x = this.Location.X.ToPixels();
     for (var column = 0; column < this.columns.Count(); column++)
     {
         int y = this.Location.Y.ToPixels();
         for (var row = 0; row < this.rows.Count(); row++)
         {
             this.cells.Where(c => (c.Column == column) && (c.Row == row)).ToList()
                 .ForEach(c =>
                              {
                                  var childGr = gr.CreateChild(new Point(x, y), c.Content.TransformationScaling, c.Content.TransformationCenter);
                                  c.Content.Draw(childGr);
                                  c.Content.Location = new Point(x, y);
                                  c.Content.Size = new Size(childGr.Right, childGr.Bottom);
                              });
             y += this.Rows[row].Value.ToPixels();
         }
         x += this.Columns[column].Value.ToPixels();
     }
 }
Esempio n. 16
0
 public override void Draw(IDrawingGraphics drawingGraphics)
 {
     //if (lastVisibleRect != drawingGraphics.VisibleRect
     int ctime = System.Environment.TickCount;
     var visible = this.Children.Where(i => i.Bounds.IntersectsWith(drawingGraphics.VisibleRect)).ToList();
     ctime = System.Environment.TickCount-ctime;
     drawtime += ctime;
     foreach(var e in visible)
     {
         e.Draw(drawingGraphics.CreateChild(e.Location, e.TransformationScaling, e.TransformationCenter));
     };
 }