コード例 #1
0
ファイル: Tile.cs プロジェクト: SeregaPru/metrohome65
 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));
 }
コード例 #2
0
ファイル: SensorTextElement.cs プロジェクト: leewoody/hobd
        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);
        }
コード例 #3
0
ファイル: Canvas.cs プロジェクト: SeregaPru/metrohome65
 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)));
 }
コード例 #4
0
 public void ApplyTo(IDrawingGraphics gr)
 {
     gr.FontName(this.FontFamily);
     gr.FontSize(this.FontSize);
     gr.Color(this.Foreground);
     gr.Bold(this.Bold);
 }
コード例 #5
0
 private void DrawHeaders(IDrawingGraphics gr)
 {
     foreach (var h in this.pivotItems)
     {
         gr.Style(this.HeaderStylePassive).DrawText(h.Title).MoveRelX(this.headerPadding);
     }
 }
コード例 #6
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(); //
        }
コード例 #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);
        }
コード例 #8
0
ファイル: PanoramaSection.cs プロジェクト: hksonngan/fleux
        public override void Draw(IDrawingGraphics drawingGraphics)
        {
            drawingGraphics.Style(this.Style)
                .DrawText(this.title)
                .MoveTo(0, 0);

            base.Draw(drawingGraphics);
        }
コード例 #9
0
ファイル: PanoramaSection.cs プロジェクト: hksonngan/fleux
        public override void Draw(IDrawingGraphics drawingGraphics)
        {
            drawingGraphics.Style(this.Style)
            .DrawText(this.title)
            .MoveTo(0, 0);

            base.Draw(drawingGraphics);
        }
コード例 #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);
 }
コード例 #11
0
ファイル: DynamicElement.cs プロジェクト: cail/hobd
 public override void Draw(IDrawingGraphics g)
 {
     g.Style(this.Style);
     if (clickTimer != null){
     g.Bold(true);
     }
     g.DrawText(this.Text);
 }
コード例 #12
0
        public override void Draw(IDrawingGraphics drawingGraphics)
        {
            drawingGraphics.Style(MetroTheme.PhoneTextPanoramaSectionTitleStyle)
                .DrawText(this.title)
                .MoveTo(0, 0);

            base.Draw(drawingGraphics);
        }
コード例 #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);
 }
コード例 #14
0
ファイル: DecoratorElement.cs プロジェクト: flts/fleux
 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);
 }
コード例 #15
0
ファイル: DynamicElement.cs プロジェクト: leewoody/hobd
 public override void Draw(IDrawingGraphics g)
 {
     g.Style(this.Style);
     if (clickTimer != null)
     {
         g.Bold(true);
     }
     g.DrawText(this.Text);
 }
コード例 #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));
        }
コード例 #17
0
ファイル: ClipBuffer.cs プロジェクト: flts/fleux
 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));
 }
コード例 #18
0
ファイル: ClipBuffer.cs プロジェクト: hksonngan/fleux
 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));
 }
コード例 #19
0
 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);
     }
 }
コード例 #20
0
ファイル: FontEdit.cs プロジェクト: SeregaPru/metrohome65
        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);
        }
コード例 #21
0
ファイル: Canvas.cs プロジェクト: hksonngan/fleux
 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));
     };
 }
コード例 #22
0
ファイル: ScrollViewer.cs プロジェクト: hksonngan/fleux
        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));
        }
コード例 #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)));
        }
コード例 #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));
            }
            ;
        }
コード例 #25
0
ファイル: ImageButton.cs プロジェクト: SeregaPru/metrohome65
 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));
 }
コード例 #26
0
ファイル: TextElement.cs プロジェクト: SeregaPru/metrohome65
        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;
            }
        }
コード例 #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);
        }
コード例 #28
0
ファイル: TextPage.cs プロジェクト: hksonngan/fleux
        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);
        }
コード例 #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);
        }
コード例 #30
0
ファイル: TextBox.cs プロジェクト: SeregaPru/metrohome65
        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);
        }
コード例 #31
0
ファイル: WidgetBase.cs プロジェクト: SeregaPru/metrohome65
        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));
        }
コード例 #32
0
ファイル: IconTextElement.cs プロジェクト: victorchalian/hobd
 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)
     */
 }
コード例 #33
0
ファイル: DecoratorElement.cs プロジェクト: cail/fleux
 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);
     }
 }
コード例 #34
0
ファイル: ImageElement.cs プロジェクト: cail/fleux
        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);
        }
コード例 #35
0
ファイル: ImageElement.cs プロジェクト: SeregaPru/metrohome65
        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;
            }
        }
コード例 #36
0
ファイル: TextElement.cs プロジェクト: hksonngan/fleux
        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);
            }
        }
コード例 #37
0
ファイル: Grid.cs プロジェクト: SeregaPru/metrohome65
 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();
     }
 }
コード例 #38
0
ファイル: PanoramaSection.cs プロジェクト: cail/fleux
        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);
        }
コード例 #39
0
ファイル: IconTextElement.cs プロジェクト: leewoody/hobd
        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)
             */
        }
コード例 #40
0
ファイル: TextElement.cs プロジェクト: hksonngan/fleux
        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;
            }
        }
コード例 #41
0
 public abstract void Draw(IDrawingGraphics drawingGraphics);
コード例 #42
0
ファイル: Tile.cs プロジェクト: hksonngan/fleux
 public override void Draw(IDrawingGraphics drawingGraphics)
 {
     this.DrawTile(drawingGraphics);
     this.DrawTileText(drawingGraphics);
 }
コード例 #43
0
ファイル: Tile.cs プロジェクト: hksonngan/fleux
 protected virtual void DrawTileText(IDrawingGraphics drawingGraphics)
 {
     this.text.Draw(drawingGraphics.CreateChild(this.text.Location, this.text.TransformationScaling, this.text.TransformationCenter));
 }
コード例 #44
0
ファイル: UIElement.cs プロジェクト: SeregaPru/metrohome65
 public abstract void Draw(IDrawingGraphics drawingGraphics);
コード例 #45
0
ファイル: Tile.cs プロジェクト: hksonngan/fleux
 protected virtual void DrawTile(IDrawingGraphics drawingGraphics)
 {
     base.Draw(drawingGraphics);
 }
コード例 #46
0
ファイル: ScrollViewer.cs プロジェクト: hksonngan/fleux
        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;
                    }
                }
            }
        }
コード例 #47
0
ファイル: ImageElement.cs プロジェクト: hksonngan/fleux
 public override void Draw(IDrawingGraphics drawingGraphics)
 {
     drawingGraphics.DrawImage(this.image, 0, 0, Size.Width, Size.Height);
 }
コード例 #48
0
ファイル: TextElement.cs プロジェクト: cail/fleux
        private void DoRelayout(IDrawingGraphics drawingGraphics)
        {
            if (_inRelayout) return;

            _inRelayout = true;
            try
            {
                Relayout(drawingGraphics);
            }
            finally
            {
                _inRelayout = false;
            }
        }
コード例 #49
0
ファイル: TextElement.cs プロジェクト: cail/fleux
 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;
         }
     }
 }
コード例 #50
0
 public override void Draw(IDrawingGraphics drawingGraphics)
 {
     drawingGraphics.DrawAlphaImage(this.image, 0, 0, Size.Width, Size.Height);
 }