Exemple #1
0
        public NotifyBarContainer(INotifyBar barContent)
        {
            SuspendLayout(); //suspend layout until all bar element is finish set up
            BarContent = barContent;
            InitializeComponent();
            btnDetail.Click += detail_Click;
            btnStop.Click   += stop_Click;
            btnStop.Image    = ZklResources.Remove;
            var control = barContent.GetControl();

            //Note: control-element is already DPI-scaled and might be DPI-scaled again, and we dont need more scaling
            //Set size to control-element's maximum size (if defined in Program.cs). If not defined then use current height (hopefully the control-element is only used once)
            Height  = (control.MaximumSize.Height > 0 ? control.MaximumSize.Height : control.Height) + DpiMeasurement.ScaleValueY(28);
            lbTitle = new Label()
            {
                Font = new Font("Microsoft Sans Serif", 13.25F, FontStyle.Bold), ForeColor = Color.DarkCyan, AutoSize = true
            };
            tableLayoutPanel1.Controls.Add(lbTitle, 1, 0);

            tableLayoutPanel1.Controls.Add(control, 1, 1);
            control.Dock = DockStyle.Fill;
            Dock         = DockStyle.Top;
            BarContent.AddedToContainer(this);
            ResumeLayout();
        }
		public void AddBar(INotifyBar bar)
		{
			if (!Bars.Contains(bar))
			{
				Controls.Add(new NotifyBarContainer(bar));
                uiUpdate.Start(); //accumulate update for 50ms because Linux Mono have trouble with multiple add/remove bar spam.
			}
		}
Exemple #3
0
 public void AddBar(INotifyBar bar)
 {
     if (!Bars.Contains(bar))
     {
         Controls.Add(new NotifyBarContainer(bar));
         uiUpdate.Start(); //accumulate update for 50ms because Linux Mono have trouble with multiple add/remove bar spam.
     }
 }
 public void AddBar(INotifyBar bar)
 {
     if (!Bars.Contains(bar))
     {
         Controls.Add(new NotifyBarContainer(bar));
         //Height = Controls.OfType<Control>().Sum(x => x.Height);
         timedUpdate.Start(); //accumulate update for 50ms because Linux Mono have trouble with multiple add/remove bar spam.
         if (Environment.OSVersion.Platform != PlatformID.Unix)
         {
             Program.MainWindow.Invalidate(true);
         }
     }
 }
        public NotifyBarContainer(INotifyBar barContent)
        {
            SuspendLayout(); //suspend layout until all bar element is finish set up
            BarContent = barContent;
            InitializeComponent();
            btnDetail.Click += detail_Click;
            btnStop.Click += stop_Click;
            btnStop.Image = ZklResources.Remove;
            var control = barContent.GetControl();
            //Note: control-element is already DPI-scaled and might be DPI-scaled again, and we dont need more scaling
            //Set size to control-element's maximum size (if defined in Program.cs). If not defined then use current height (hopefully the control-element is only used once)
            Height = (control.MaximumSize.Height > 0 ? control.MaximumSize.Height : control.Height) + DpiMeasurement.ScaleValueY(28);
            lbTitle = new Label() { Font = Config.GeneralFontBig, ForeColor = Color.DarkCyan, AutoSize = true };
            tableLayoutPanel1.Controls.Add(lbTitle, 1, 0);

            tableLayoutPanel1.Controls.Add(control, 1, 1);
            control.Dock = DockStyle.Fill;
            Dock = DockStyle.Top;
            BarContent.AddedToContainer(this);
            ResumeLayout();
        }