Пример #1
0
        /// <summary>
        /// title bar design
        /// </summary>
        /// <param name="dp"></param>
        /// <param name="sr">log panel drawing area</param>
        /// <returns></returns>
        protected virtual ScreenY drawTitleBar(DrawProperty dp, ScreenRect sr)
        {
            var _bd         = new CanvasSolidColorBrush(dp.Canvas, Color.FromArgb(64, 0, 0, 0));
            var titleHeight = 8;
            var w3          = sr.Width / 4;
            var pst         = new ScreenPos[] { ScreenPos.From(sr.LT.X, sr.LT.Y + titleHeight + 16), ScreenPos.From(sr.LT.X, sr.LT.Y), ScreenPos.From(sr.RB.X, sr.LT.Y), };
            var psb         = new ScreenPos[] { ScreenPos.From(sr.RB.X, sr.LT.Y + titleHeight), ScreenPos.From(sr.RB.X - w3, sr.LT.Y + titleHeight + 2), ScreenPos.From(sr.RB.X - w3 * 2, sr.LT.Y + titleHeight + 8), ScreenPos.From(sr.RB.X - w3 * 3, sr.LT.Y + titleHeight + 16), ScreenPos.From(sr.LT.X, sr.LT.Y + titleHeight + 16), };
            var ps          = pst.Union(psb).ToList();
            var path        = new CanvasPathBuilder(dp.Canvas);

            path.BeginFigure(ps[0]);
            for (var i = 1; i < ps.Count; i++)
            {
                path.AddLine(ps[i]);
            }
            path.EndFigure(CanvasFigureLoop.Closed);
            var geo = CanvasGeometry.CreatePath(path);

            dp.Graphics.FillGeometry(geo, _bd);

            // edge highlight
            for (var i = 1; i < pst.Length; i++)
            {
                dp.Graphics.DrawLine(pst[i - 1], pst[i], Color.FromArgb(96, 255, 255, 255));
            }
            // edge shadow
            for (var i = 1; i < psb.Length; i++)
            {
                dp.Graphics.DrawLine(psb[i - 1], psb[i], Color.FromArgb(96, 0, 0, 0));
            }

            // title bar design
            var btr = sr.Clone();

            btr.RB = ScreenPos.From(btr.LT.X + ScreenX.From(24), btr.LT.Y + ScreenY.From(12));
            btr    = btr + ScreenPos.From(4, 4);
            var imgttl = Assets.Image("LogPanelTitileDesign");

            if (imgttl != null)
            {
                dp.Graphics.DrawImage(imgttl, btr.LT + ScreenSize.From(-3, -14));
            }
            btr = btr + ScreenX.From(50);

            // title filter buttons
            var btn1 = Assets.Image("btnLogPanel");
            var btn0 = Assets.Image("btnLogPanelOff");

            if (btn1 != null && btn0 != null)
            {
                var ctfb = new CanvasTextFormat
                {
                    FontFamily = "Arial",
                    FontSize   = 10.0f,
                    FontWeight = FontWeights.Normal,
                    FontStyle  = FontStyle.Italic,
                };
                foreach ((var lv, var caption) in new (LLV, string)[] { (LLV.ERR, "e"), (LLV.WAR, "w"), (LLV.INF, "i"), (LLV.DEV, "d") })
Пример #2
0
 public override void Draw(DrawProperty dp)
 {
     if (Visible)
     {
         var sr = ScreenRect.FromLTRB(Left.Cx, Top.Cy, Right.Cx, Bottom.Cy);
         dp.Graphics.FillRectangle(_(sr), MaskBG);
         dp.Graphics.FillRectangle(_(sr), MaskPen);
     }
 }
Пример #3
0
        /// <summary>
        /// background design
        /// </summary>
        /// <param name="dp"></param>
        /// <param name="sr"></param>
        protected virtual void drawBackground(DrawProperty dp, ScreenRect sr)
        {
            var bg = new CanvasLinearGradientBrush(dp.Canvas, Parent.BackgroundColor1, Parent.BackgroundColor2)
            {
                StartPoint = _(ScreenPos.From(sr.LT.X, sr.LT.Y)),
                EndPoint   = _(ScreenPos.From(sr.RB.X, sr.RB.Y)),
            };

            dp.Graphics.FillRectangle(_(dp.PaneRect), bg);
        }
Пример #4
0
        public override void Draw(DrawProperty dp)
        {
            if (Image == null)
            {
                return;
            }

            var sr = GetScreenRect(dp.Pane);

            dp.Graphics.DrawImage(Image, _(sr));
        }
Пример #5
0
        public override void Draw(DrawProperty dp)
        {
            if (string.IsNullOrEmpty(Text) || string.IsNullOrWhiteSpace(Text))
            {
                return;
            }

            var tf = new CanvasTextFormat
            {
                FontFamily               = "Segoe UI",
                FontSize                 = 11.0f,
                FontStyle                = FontStyle.Normal,
                FontStretch              = FontStretch.Normal,
                FontWeight               = FontWeights.Normal,
                WordWrapping             = CanvasWordWrapping.NoWrap,
                Direction                = CanvasTextDirection.LeftToRightThenTopToBottom,
                HorizontalAlignment      = CanvasHorizontalAlignment.Left,
                LineSpacing              = 2.0f,
                OpticalAlignment         = CanvasOpticalAlignment.Default,
                Options                  = CanvasDrawTextOptions.Default,
                VerticalAlignment        = CanvasVerticalAlignment.Top,
                VerticalGlyphOrientation = CanvasVerticalGlyphOrientation.Default,
            };
            var ssz0 = GraphicUtil.MeasureString(dp.Canvas, Text, tf);
            var ssz  = ssz0.Clone();
            var sp   = ScreenPos.From(Location.X.Cx, Location.Y.Cy);

            if (IsUpperPositionDefault)
            {
                sp += ScreenX.From(8);
                sp -= ScreenY.From(32);
            }
            else
            {
                sp -= ssz.Width;            // adjust tooltip position
                sp += ScreenY.From(24);
            }
            if (sp.X < 0)
            {
                sp.X = ScreenX.From(0);
            }

            var sr = ScreenRect.From(sp, ssz + ScreenSize.From(12, 12));

            sp += ScreenPos.From(6, 4); // padding
            dp.Graphics.FillRectangle(_(sr), Color.FromArgb(0xee, 0xdd, 0xdd, 0xdd));
            dp.Graphics.DrawRectangle(_(sr), Color.FromArgb(0xff, 0x88, 0x88, 0x88));
            dp.Graphics.DrawText(Text, sp + ssz0.Height, Color.FromArgb(0xff, 0x00, 0x00, 0x00), tf);
        }
Пример #6
0
        /// <summary>
        /// drawing
        /// </summary>
        /// <param name="dp"></param>
        public override void Draw(DrawProperty dp)
        {
            if (Parent.IsVisible == false)
            {
                return;  // draw when feature is active only.
            }

            var sr = dp.PaneRect;

            drawBackground(dp, sr);

            var theight = drawTitleBar(dp, sr);

            drawMessage(dp, sr, theight);
        }
Пример #7
0
 /// <summary>
 /// draw evnt base method
 /// </summary>
 public abstract void Draw(DrawProperty dp);