Example #1
0
 public void Draw(Graphics Graphics, StatusElementResources Resources)
 {
     foreach (StatusElement Element in Elements)
     {
         Element.Draw(Graphics, Resources);
     }
 }
Example #2
0
        public override Size Measure(Graphics Graphics, StatusElementResources Resources)
        {
            Size LabelSize   = TextRenderer.MeasureText(Name, Resources.BadgeFont);
            int  BadgeHeight = Resources.BadgeFont.Height + 1;

            return(new Size(LabelSize.Width + BadgeHeight - 4, BadgeHeight));
        }
Example #3
0
        public Point Layout(Graphics Graphics, Point Location, StatusElementResources Resources)
        {
            Size Size = Measure(Graphics, Resources);

            Bounds = new Rectangle(Location.X, Location.Y - (Size.Height + 1) / 2, Size.Width, Size.Height);
            return(new Point(Location.X + Size.Width, Location.Y));
        }
        public void Set(IEnumerable <StatusLine> NewLines, StatusLine NewCaption, StatusLine NewAlert, Color?NewTintColor)
        {
            if (Resources == null)
            {
                Resources = new StatusElementResources(Font);
            }

            if (TintColor != NewTintColor)
            {
                Invalidate();
            }

            InvalidateElements();
            Lines.Clear();
            Lines.AddRange(NewLines);
            Caption   = NewCaption;
            Alert     = NewAlert;
            TintColor = NewTintColor;
            LayoutElements();
            InvalidateElements();

            MouseOverElement = null;
            MouseDownElement = null;
            SetMouseOverLocation(MouseOverLocation);
            SetMouseDownLocation(MouseDownLocation);
        }
Example #5
0
 public override void Draw(Graphics Graphics, StatusElementResources Resources)
 {
     using (SolidBrush Brush = new SolidBrush(bMouseOver? HoverBackgroundColor : BackgroundColor))
     {
         Graphics.FillRectangle(Brush, Bounds);
     }
     TextRenderer.DrawText(Graphics, Name, Resources.BadgeFont, Bounds, Color.White, TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter | TextFormatFlags.SingleLine | TextFormatFlags.NoPrefix | TextFormatFlags.PreserveGraphicsClipping);
 }
Example #6
0
 private void ResetFontCache()
 {
     if (Resources != null)
     {
         Resources.Dispose();
         Resources = null;
     }
     Resources = new StatusElementResources(Font);
 }
Example #7
0
        public void Layout(Graphics Graphics, Point Location, StatusElementResources Resources)
        {
            Bounds = new Rectangle(Location, new Size(0, 0));

            Point NextLocation = Location;

            foreach (StatusElement Element in Elements)
            {
                NextLocation = Element.Layout(Graphics, NextLocation, Resources);
                Bounds       = Rectangle.Union(Bounds, Element.Bounds);
            }
        }
Example #8
0
        public override void Draw(Graphics Graphics, StatusElementResources Resources)
        {
            Color TextColor = SystemColors.HotTrack;

            if (bMouseDown)
            {
                TextColor = Color.FromArgb(TextColor.B / 2, TextColor.G / 2, TextColor.R);
            }
            else if (bMouseOver)
            {
                TextColor = Color.FromArgb(TextColor.B, TextColor.G, TextColor.R);
            }
            TextRenderer.DrawText(Graphics, Text, Resources.FindOrAddFont(Style), Bounds.Location, TextColor, TextFormatFlags.NoPadding);
        }
Example #9
0
        public override void Draw(Graphics Graphics, StatusElementResources Resources)
        {
            Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None;

            Graphics.DrawRectangle(Pens.Black, Bounds.Left, Bounds.Top, Bounds.Width - 1, Bounds.Height - 1);
            Graphics.FillRectangle(Brushes.White, Bounds.Left + 1, Bounds.Top + 1, Bounds.Width - 2, Bounds.Height - 2);

            int ProgressX = Bounds.Left + 2 + (int)((Bounds.Width - 4) * Progress);

            using (Brush ProgressBarBrush = new SolidBrush(Color.FromArgb(112, 146, 190)))
            {
                Graphics.FillRectangle(ProgressBarBrush, Bounds.Left + 2, Bounds.Y + 2, ProgressX - (Bounds.Left + 2), Bounds.Height - 4);
            }
        }
        public override void Draw(Graphics Graphics, StatusElementResources Resources)
        {
            SmoothingMode PrevSmoothingMode = Graphics.SmoothingMode;

            Graphics.SmoothingMode = SmoothingMode.HighQuality;

            using (GraphicsPath Path = new GraphicsPath())
            {
                Path.StartFigure();
                Path.AddLine(Bounds.Left + (MergeLeft? 1 : 0), Bounds.Top, Bounds.Left - (MergeLeft? 1 : 0), Bounds.Bottom);
                Path.AddLine(Bounds.Left - (MergeLeft? 1 : 0), Bounds.Bottom, Bounds.Right - 2 - (MergeRight? 1 : 0), Bounds.Bottom);
                Path.AddLine(Bounds.Right - 2 - (MergeRight? 1 : 0), Bounds.Bottom, Bounds.Right - 2 + (MergeRight? 1 : 0), Bounds.Top);
                Path.AddLine(Bounds.Right - 2 + (MergeRight? 1 : 0), Bounds.Top, Bounds.Left + (MergeLeft? 1 : 0), Bounds.Top);
                Path.CloseFigure();

                using (SolidBrush Brush = new SolidBrush(bMouseOver? HoverBackgroundColor : BackgroundColor))
                {
                    Graphics.FillPath(Brush, Path);
                }
            }

            Graphics.SmoothingMode = PrevSmoothingMode;
            TextRenderer.DrawText(Graphics, Name, Resources.BadgeFont, Bounds, Color.White, TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter | TextFormatFlags.SingleLine | TextFormatFlags.NoPrefix | TextFormatFlags.PreserveGraphicsClipping);
        }
Example #11
0
 public abstract void Draw(Graphics Grahpics, StatusElementResources Resources);
 public override Size Measure(Graphics Graphics, StatusElementResources Resources)
 {
     return(new Size((int)(Icon.Width * Graphics.DpiX / 96.0f), (int)(Icon.Height * Graphics.DpiY / 96.0f)));
 }
Example #13
0
 public abstract Size Measure(Graphics Graphics, StatusElementResources Resources);
 public StatusLineListViewWidget(ListViewItem Item, StatusElementResources Resources)
     : base(Item)
 {
     this.Resources           = Resources;
     this.HorizontalAlignment = HorizontalAlignment.Center;
 }
Example #15
0
 public override void Draw(Graphics Graphics, StatusElementResources Resources)
 {
     Graphics.DrawImage(Strip, Bounds, new Rectangle(IconSize.Width * Index, 0, IconSize.Width, IconSize.Height), GraphicsUnit.Pixel);
 }
Example #16
0
 public override void Draw(Graphics Graphics, StatusElementResources Resources)
 {
     TextRenderer.DrawText(Graphics, Text, Resources.FindOrAddFont(Style), Bounds.Location, SystemColors.ControlText, TextFormatFlags.NoPadding);
 }
Example #17
0
 public override Size Measure(Graphics Graphics, StatusElementResources Resources)
 {
     return(TextRenderer.MeasureText(Graphics, Text, Resources.FindOrAddFont(Style), new Size(int.MaxValue, int.MaxValue), TextFormatFlags.NoPadding));
 }
Example #18
0
 public override Size Measure(Graphics Graphics, StatusElementResources Resources)
 {
     return(Icon.Size);
 }
Example #19
0
 public override void Draw(Graphics Graphics, StatusElementResources Resources)
 {
     Graphics.DrawImage(Icon, Bounds.Location);
 }
Example #20
0
        public override Size Measure(Graphics Graphics, StatusElementResources Resources)
        {
            int Height = (int)(Resources.FindOrAddFont(FontStyle.Regular).Height * 0.9f);

            return(new Size(Height * 16, Height));
        }