Example #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));
 }
Example #2
0
        public override void Draw(IDrawingGraphics drawingGraphics)
        {
            //drawingGraphics.Color(Color.FromArgb(100,100,100));
            //drawingGraphics.DrawRectangle(0, 0, width, height);

            //drawingGraphics.Style(this.Style);
            //drawingGraphics.MoveTo(2,2).Color(Color.FromArgb(64, 64, 64)).DrawText(this.Text);

            //if (homePage != null)
            {
                if (this.Name != null)
                {
                    drawingGraphics
                    .MoveTo(0, 0)
                    .Style(HOBD.theme.PhoneTextSensorDescrStyle)
                    .DrawCenterText(this.Name, width, 20);
                }
                if (this.TUnits != null && this.TUnits.Length > 0)
                {
                    drawingGraphics
                    .MoveTo(0, height - 30)
                    .Style(HOBD.theme.PhoneTextSensorDescrStyle)
                    .DrawCenterText(this.TUnits, width, 20);
                }
            }
            if (this.Text != null)
            {
                drawingGraphics
                .MoveTo(0, 0)
                .Style(this.Style)
                .DrawCenterText(this.Text, width, height);
            }

            //drawingGraphics.MoveTo(0, height-20).Style(HOBD.theme.PhoneTextNormalStyle).DrawText(this.Units);
        }
Example #3
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)));
 }
Example #4
0
 public void ApplyTo(IDrawingGraphics gr)
 {
     gr.FontName(this.FontFamily);
     gr.FontSize(this.FontSize);
     gr.Color(this.Foreground);
     gr.Bold(this.Bold);
 }
Example #5
0
 private void DrawHeaders(IDrawingGraphics gr)
 {
     foreach (var h in this.pivotItems)
     {
         gr.Style(this.HeaderStylePassive).DrawText(h.Title).MoveRelX(this.headerPadding);
     }
 }
        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(); //
        }
Example #7
0
        public void DrawBuffer(IDrawingGraphics drawingGraphics)
        {
            //var dstTop = (drawingGraphics.VisibleRect.Top > 0) ? 0 : drawingGraphics.VisibleRect.Top;
            var dstTop = Math.Max(0, drawingGraphics.CalculateY(0));
            var dstLeft = drawingGraphics.CalculateX(this.Location.X);
            var srcTop = (drawingGraphics.VisibleRect.Top > 0) ? drawingGraphics.VisibleRect.Top : 0;
            var dstWidth = _buffer.Image.Width;
            var height = this.Parent.Size.Height;

            //drawingGraphics.DrawImage(_buffer.Image, 0, 0);
            //return;
            drawingGraphics.Graphics.DrawImage(_buffer.Image,
                dstLeft, dstTop,
                new Rectangle(0, srcTop, dstWidth, height), GraphicsUnit.Pixel);
            return;

            var hSrc = _buffer.Graphics.GetHdc();
            var hDst = drawingGraphics.Graphics.GetHdc();

            /*
            var blendFunction = new BlendFunction
            {
                BlendOp = (byte)BlendOperation.AcSrcOver,
                BlendFlags = (byte)BlendFlags.Zero,
                SourceConstantAlpha = 100,
                AlphaFormat = 0
            };

            DrawingAPI.AlphaBlend(hDst, 0, -drawingGraphics.VisibleRect.Top, Size.Width, Size.Height, hSrc,
                0, 0, Size.Width, Size.Height, blendFunction);

             */

            DrawingAPI.BitBlt(hDst,
                dstLeft, dstTop,
                dstWidth, height,
                hSrc,
                0, srcTop,
                DrawingAPI.SRCCOPY
                );

            //DrawingAPI.BitBlt(hDst, 0, -drawingGraphics.VisibleRect.Top, Size.Width, Size.Height,
            //    hSrc, 0, 0,
            //    DrawingAPI.SRCCOPY
            //    );

            /*
            BitmapData a = _buffer.Image.LockBits(new Rectangle(0, 0, Size.Width, Size.Height), ImageLockMode.ReadOnly,
                                           (PixelFormat) PixelFormatID.PixelFormat32bppARGB);
            var factory = (IImagingFactory)Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("327ABDA8-072B-11D3-9D7B-0000F81EF32E")));
            IImage image;
            factory.CreateImageFromBuffer(a.Scan0, a., BufferDisposalFlag.BufferDisposalFlagNone, image);

            _buffer.Image.UnlockBits(a);
            */

            _buffer.Graphics.ReleaseHdc(hSrc);
            drawingGraphics.Graphics.ReleaseHdc(hDst);
        }
Example #8
0
        public override void Draw(IDrawingGraphics drawingGraphics)
        {
            drawingGraphics.Style(this.Style)
                .DrawText(this.title)
                .MoveTo(0, 0);

            base.Draw(drawingGraphics);
        }
Example #9
0
        public override void Draw(IDrawingGraphics drawingGraphics)
        {
            drawingGraphics.Style(this.Style)
            .DrawText(this.title)
            .MoveTo(0, 0);

            base.Draw(drawingGraphics);
        }
Example #10
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 #11
0
 public override void Draw(IDrawingGraphics g)
 {
     g.Style(this.Style);
     if (clickTimer != null){
     g.Bold(true);
     }
     g.DrawText(this.Text);
 }
Example #12
0
        public override void Draw(IDrawingGraphics drawingGraphics)
        {
            drawingGraphics.Style(MetroTheme.PhoneTextPanoramaSectionTitleStyle)
                .DrawText(this.title)
                .MoveTo(0, 0);

            base.Draw(drawingGraphics);
        }
Example #13
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 #14
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);
 }
Example #15
0
 public override void Draw(IDrawingGraphics g)
 {
     g.Style(this.Style);
     if (clickTimer != null)
     {
         g.Bold(true);
     }
     g.DrawText(this.Text);
 }
Example #16
0
        private void CreateBuffer()
        {
            // create new buffer with new size
            _buffer = new DoubleBuffer(new Size(Size.Width, Size.Height));

            _drawingGraphics = DrawingGraphics.FromGraphicsAndRect(
                _buffer.Graphics, _buffer.Image,
                new Rectangle(0, 0, _buffer.Image.Width, _buffer.Image.Height));
        }
Example #17
0
 public ClipBuffer(Image image, Graphics imageGraphics, Rectangle region, Graphics ownerGraphics)
 {
     this.image = image;
     this.region = region;
     this.ownerGraphics = ownerGraphics;
     this.graphics = imageGraphics;
     this.drawingGraphics = DrawingGraphics.FromGraphicsAndRect(this.graphics,
         this.image,
         new Rectangle(0, 0, this.image.Width, this.image.Height));
 }
Example #18
0
 public ClipBuffer(Image image, Graphics imageGraphics, Rectangle region, Graphics ownerGraphics)
 {
     this.image           = image;
     this.region          = region;
     this.ownerGraphics   = ownerGraphics;
     this.graphics        = imageGraphics;
     this.drawingGraphics = DrawingGraphics.FromGraphicsAndRect(this.graphics,
                                                                this.image,
                                                                new Rectangle(0, 0, this.image.Width, this.image.Height));
 }
 public override void Draw(IDrawingGraphics drawingGraphics)
 {
     if (m_pressed)
     {
         drawingGraphics.DrawAlphaImage(this.image, 2, 2, Size.Width - 4, Size.Height - 4);
     }
     else
     {
         drawingGraphics.DrawAlphaImage(this.image, 0, 0, Size.Width, Size.Height);
     }
 }
Example #20
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 #21
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));
     };
 }
Example #22
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 #23
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)));
        }
Example #24
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));
            }
            ;
        }
Example #25
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));
 }
Example #26
0
        public override void Draw(IDrawingGraphics drawingGraphics)
        {
            drawingGraphics.Style(this.Style);

            switch (this.AutoSizeMode)
            {
                case AutoSizeModeOptions.None:
                case AutoSizeModeOptions.OneLineAutoHeight:
                    drawingGraphics.DrawText(this.text);
                    break;
                case AutoSizeModeOptions.WrapText:
                    drawingGraphics.DrawMultiLineText(this.text, this.Size.Width, this.Size.Height);
                    break;
            }
        }
Example #27
0
        private void DrawTextSamples(IDrawingGraphics gr)
        {
            var text = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";

            var textWidth = this.Content.Size.Width - 24;

            gr.Style(MetroTheme.PhoneTextTitle3Style).DrawText("DrawText()").MoveTo(0, gr.Bottom);
            gr.Style(MetroTheme.PhoneTextSmallStyle).DrawText(text).MoveTo(0, gr.Bottom + 10);
            gr.Style(MetroTheme.PhoneTextTitle3Style).DrawText("DrawMultiLineText()").MoveTo(0, gr.Bottom);
            gr.Style(MetroTheme.PhoneTextSmallStyle).DrawMultiLineText(text, textWidth).MoveTo(0, gr.Bottom + 10);

            gr.Style(MetroTheme.PhoneTextTitle3Style).DrawText("DrawText()").MoveTo(0, gr.Bottom);
            gr.Style(MetroTheme.PhoneTextSmallStyle).DrawText(text).MoveTo(0, gr.Bottom + 10);
            gr.Style(MetroTheme.PhoneTextTitle3Style).DrawText("DrawMultiLineText()").MoveTo(0, gr.Bottom);
            gr.Style(MetroTheme.PhoneTextSmallStyle).DrawMultiLineText(text, textWidth).MoveTo(0, gr.Bottom + 10);
        }
Example #28
0
        private void DrawTextSamples(IDrawingGraphics gr)
        {
            var text = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";

            var textWidth = this.Content.Size.Width - 24;

            gr.Style(MetroTheme.PhoneTextTitle3Style).DrawText("DrawText()").MoveTo(0, gr.Bottom);
            gr.Style(MetroTheme.PhoneTextSmallStyle).DrawText(text).MoveTo(0, gr.Bottom + 10);
            gr.Style(MetroTheme.PhoneTextTitle3Style).DrawText("DrawMultiLineText()").MoveTo(0, gr.Bottom);
            gr.Style(MetroTheme.PhoneTextSmallStyle).DrawMultiLineText(text, textWidth).MoveTo(0, gr.Bottom + 10);

            gr.Style(MetroTheme.PhoneTextTitle3Style).DrawText("DrawText()").MoveTo(0, gr.Bottom);
            gr.Style(MetroTheme.PhoneTextSmallStyle).DrawText(text).MoveTo(0, gr.Bottom + 10);
            gr.Style(MetroTheme.PhoneTextTitle3Style).DrawText("DrawMultiLineText()").MoveTo(0, gr.Bottom);
            gr.Style(MetroTheme.PhoneTextSmallStyle).DrawMultiLineText(text, textWidth).MoveTo(0, gr.Bottom + 10);
        }
Example #29
0
        public override void Draw(IDrawingGraphics drawingGraphics)
        {
            if (drawingGraphics == null) return;

            if ((_needRepaint) && (!FreezeUpdate))
            {
                var newbuffer = CreateBuffer();
                RepaintBuffer(newbuffer);
                _buffer = newbuffer;
                _needRepaint = false;
            }

            // buffer may be null when staring
            if (_buffer != null)
                DrawBuffer(drawingGraphics);
        }
Example #30
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 #31
0
        public override void Draw(IDrawingGraphics drawingGraphics)
        {
            if (drawingGraphics == null)
                return;

            if ((_buffer == null) || (_needRepaint))
            {
                var newbuffer = new DoubleBuffer(Size);
                PaintBuffer(newbuffer.Graphics, new Rectangle(0, 0, Size.Width, Size.Height));
                _buffer = newbuffer;
                _needRepaint = false;
            }

            drawingGraphics.DrawImage(_buffer.Image, 0, 0);

            // draw direct to graphic for speed
            //drawingGraphics.Graphics.DrawImage(_buffer.Image, drawingGraphics.CalculateX(0), drawingGraphics.CalculateY(0));
        }
Example #32
0
 public override void Draw(IDrawingGraphics g)
 {
     g.Style(this.Style);
     if (clickTimer != null){
     g.Bold(true);
     }
     g.DrawText(this.Text);
     /*
             g
             .DrawImage(icon, 10, 0, icon_width, icon_width)
             .PenWidth(3)
             .Style(HOBD.theme.PhoneTextNormalStyle)
             .MoveTo(icon_width + 10, 0)
             .DrawMultiLineText(alabel, g.Width - g.X)
             .MoveX(icon_width + 10)
             .Style(HOBD.theme.PhoneTextSmallStyle)
             .DrawText(value)
     */
 }
Example #33
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);
     }
 }
Example #34
0
        public override void Draw(IDrawingGraphics drawingGraphics)
        {
            var size = Size;
            var trect = new Rectangle(0,0, size.Width, size.Height);

            if (image == null)
                return;

            if (KeepAspect)
            {
                double scale = (double)ImageSize.Width / ImageSize.Height;
                size = new Size(Size.Width, (int)(Size.Width / scale));
                if (size.Height > Size.Height)
                    size = new Size((int)(Size.Height * scale), Size.Height);
                trect = new Rectangle((Size.Width - size.Width)/2,
                                     (Size.Height - size.Height)/2,
                                     size.Width, size.Height);
            }
            drawingGraphics.DrawAlphaImage(this.image, trect);
        }
Example #35
0
        public override void Draw(IDrawingGraphics drawingGraphics)
        {
            if (_image == null) return;

            switch (StretchType)
            {
                case StretchTypeOptions.None:
                    drawingGraphics.DrawImage(_image, 0, 0);
                    break;
                case StretchTypeOptions.Fill:
                    drawingGraphics.DrawImage(_image, 0, 0, Size.Width, Size.Height);
                    break;
                case StretchTypeOptions.Proportional:
                    var scaleX = 1.0 * Size.Width / _image.Width;
                    var scaleY = 1.0 * Size.Height / _image.Height;
                    var scale = Math.Min(1, Math.Min(scaleX, scaleY));
                    drawingGraphics.DrawImage(_image, 0, 0, (int)Math.Round(_image.Width * scale), (int)Math.Round(_image.Height * scale));
                    break;
            }
        }
Example #36
0
        protected virtual void Relayout(IDrawingGraphics dg)
        {
            if (this.AutoSizeMode != AutoSizeModeOptions.None)
            {
                var height = 0;
                switch (this.AutoSizeMode)
                {
                case AutoSizeModeOptions.OneLineAutoHeight:
                    height = dg.Style(this.Style)
                             .CalculateTextSize(this.text ?? "").Height;
                    break;

                case AutoSizeModeOptions.WrapText:
                    height = dg.Style(this.Style)
                             .CalculateMultilineTextHeight(this.text ?? "", this.Size.Width);
                    break;
                }
                this.Size = new Size(this.Size.Width, height);
            }
        }
Example #37
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();
     }
 }
Example #38
0
        public override void Draw(IDrawingGraphics drawingGraphics)
        {
            drawingGraphics.Style(this.Style);
            if(AdaptFontSize)
            {
                if(!FontSizeAdapted)
                {
                    Size targetSize;
                    NewFontSize = drawingGraphics.CalculateFontSizeForArea(this.title, new Size(this.Width, Body.Location.Y), out targetSize);
                    FontSizeAdapted = true;
                }
            } else {
                NewFontSize = Style.FontSize;
            }
            drawingGraphics
                .FontSize(NewFontSize)
                .DrawText(this.title)
                .MoveTo(0, 0);

            base.Draw(drawingGraphics);
        }
Example #39
0
        public override void Draw(IDrawingGraphics g)
        {
            g.Style(this.Style);
            if (clickTimer != null)
            {
                g.Bold(true);
            }
            g.DrawText(this.Text);

            /*
             *          g
             *          .DrawImage(icon, 10, 0, icon_width, icon_width)
             *          .PenWidth(3)
             *          .Style(HOBD.theme.PhoneTextNormalStyle)
             *          .MoveTo(icon_width + 10, 0)
             *          .DrawMultiLineText(alabel, g.Width - g.X)
             *          .MoveX(icon_width + 10)
             *          .Style(HOBD.theme.PhoneTextSmallStyle)
             *          .DrawText(value)
             */
        }
Example #40
0
        public override void Draw(IDrawingGraphics drawingGraphics)
        {
            if (this.needUpdate)
            {
                this.Relayout(drawingGraphics);
                this.needUpdate = false;
            }

            drawingGraphics.Style(this.Style);

            switch (this.AutoSizeMode)
            {
            case AutoSizeModeOptions.None:
            case AutoSizeModeOptions.OneLineAutoHeight:
                drawingGraphics.DrawText(this.text);
                break;

            case AutoSizeModeOptions.WrapText:
                drawingGraphics.DrawMultiLineText(this.text, this.Size.Width, this.Size.Height);
                break;
            }
        }
Example #41
0
 public abstract void Draw(IDrawingGraphics drawingGraphics);
Example #42
0
 public override void Draw(IDrawingGraphics drawingGraphics)
 {
     this.DrawTile(drawingGraphics);
     this.DrawTileText(drawingGraphics);
 }
Example #43
0
 protected virtual void DrawTileText(IDrawingGraphics drawingGraphics)
 {
     this.text.Draw(drawingGraphics.CreateChild(this.text.Location, this.text.TransformationScaling, this.text.TransformationCenter));
 }
Example #44
0
 public abstract void Draw(IDrawingGraphics drawingGraphics);
Example #45
0
 protected virtual void DrawTile(IDrawingGraphics drawingGraphics)
 {
     base.Draw(drawingGraphics);
 }
Example #46
0
        public override void Draw(IDrawingGraphics drawingGraphics)
        {
            var dg = drawingGraphics;

            if (this.clipBitmap == null)
            {
                this.clipBitmap = new Bitmap(this.Size.Width.ToPixels(), this.Size.Height.ToPixels() - 1); // TODO roundup errors!
            }
            if (CachePanning && panInProgress && this.clipBitmap != null)
            {
                drawingGraphics.Graphics.DrawImage(this.clipBitmap, drawingGraphics.CalculateX(this.HorizontalOffset - this.panH), drawingGraphics.CalculateY(this.VerticalOffset - this.panV));
            }
            else
            {
                using (var clipBitmap = drawingGraphics.GetClipBuffer(new Rectangle(0, 0, this.Size.Width, this.Size.Height), this.clipBitmap))
                {
                    /* Do shadows */
                    if (this.DrawShadows)
                    {
                        if (TopShadow == null)
                        {
                            TopShadow    = new Bitmap(this.Size.Width.ToPixels(), drawingGraphics.CalculateHeight(ShadowHeight));
                            BottomShadow = new Bitmap(this.Size.Width.ToPixels(), drawingGraphics.CalculateHeight(ShadowHeight));
                        }
                        if (this.VerticalOffset < 0)
                        {
                            drawingGraphics.GetOpaqueClipBuffer(new Rectangle(0, 0, this.Size.Width, this.ShadowHeight), TopShadow).Dispose();
                        }
                        if (this.VerticalOffset > Math.Min(0, -this.Content.Size.Height + this.Size.Height))
                        {
                            drawingGraphics.GetOpaqueClipBuffer(new Rectangle(0, this.Size.Height + 1 - ShadowHeight,
                                                                              this.Size.Width, ShadowHeight), BottomShadow).Dispose();
                        }
                    }

                    this.Content.Draw(clipBitmap.DrawingGr.CreateChild(new Point(this.HorizontalOffset, this.VerticalOffset),
                                                                       this.content.TransformationScaling, this.content.TransformationCenter));
                    if (this.ShowScrollbars)
                    {
                        this.DrawScrollBar(clipBitmap.DrawingGr);
                    }
                }
            }

            if (this.DrawShadows)
            {
                if (this.VerticalOffset < 0)
                {
                    int cheight = 0;
                    for (int s = 0; s < ShadowSteps; s++)
                    {
                        drawingGraphics.Graphics.AlphaBlend(TopShadow,
                                                            new Rectangle(dg.CalculateX(0), dg.CalculateY(0) + cheight, TopShadow.Width, TopShadow.Height / ShadowSteps),
                                                            new Rectangle(0, cheight, TopShadow.Width, TopShadow.Height / ShadowSteps), 0.95f - 1f / (ShadowSteps + 2) * s);
                        cheight += TopShadow.Height / ShadowSteps;
                    }
                }
                if (this.VerticalOffset > Math.Min(0, -this.Content.Size.Height + this.Size.Height))
                {
                    int cheight = 0;
                    for (int s = 0; s < ShadowSteps; s++)
                    {
                        drawingGraphics.Graphics.AlphaBlend(BottomShadow,
                                                            new Rectangle(dg.CalculateX(0), dg.CalculateY(this.Size.Height - ShadowHeight) + cheight, BottomShadow.Width, BottomShadow.Height / ShadowSteps),
                                                            new Rectangle(0, cheight, BottomShadow.Width, BottomShadow.Height / ShadowSteps), 1f / (ShadowSteps + 2) * (s + 2));
                        cheight += BottomShadow.Height / ShadowSteps;
                    }
                }
            }
        }
Example #47
0
 public override void Draw(IDrawingGraphics drawingGraphics)
 {
     drawingGraphics.DrawImage(this.image, 0, 0, Size.Width, Size.Height);
 }
Example #48
0
        private void DoRelayout(IDrawingGraphics drawingGraphics)
        {
            if (_inRelayout) return;

            _inRelayout = true;
            try
            {
                Relayout(drawingGraphics);
            }
            finally
            {
                _inRelayout = false;
            }
        }
Example #49
0
 protected virtual void Relayout(IDrawingGraphics dg, string text)
 {
     TextSize = dg.Style(this.Style).CalculateTextSize(text);
     if (this.AutoSizeMode != AutoSizeModeOptions.None)
     {
         int height = 0;
         switch (this.AutoSizeMode)
         {
             case AutoSizeModeOptions.OneLineAutoHeight:
                 this.Size = new Size(TextSize.Width, TextSize.Height);
                 break;
             case AutoSizeModeOptions.OneLineAutoHeightFixedWidth:
                 height = TextSize.Height;
                 this.Size = new Size(this.Size.Width, height);
                 break;
             case AutoSizeModeOptions.WrapText:
                 height = dg.Style(this.Style)
                     .CalculateMultilineTextHeight(text, this.Size.Width);
                 this.Size = new Size(this.Size.Width, height);
                 break;
         }
     }
 }
 public override void Draw(IDrawingGraphics drawingGraphics)
 {
     drawingGraphics.DrawAlphaImage(this.image, 0, 0, Size.Width, Size.Height);
 }