示例#1
0
文件: FormLoad.cs 项目: rNdm74/DotDat
        public FormLoad(ref Form1 form)
        {
            // Refresh form.
            form.Refresh();

            // Clear form controls.
            form.Controls.Clear();

            // Access active schemes.
            new ProcessManager();

            // Add controls to form.
            form.FormControls = new FormControls(ref form);

            // Set form location.
            form.Location = SystemTray.Position(form, WinAPI.GetTrayRectangle());

            if (form.Opacity <= 0)
                form.Opacity = 100;

            form.TopMost = true;

            form.Show();

            form.Activate();
        }
示例#2
0
        public FormControls(ref Form1 form)
        {
            // RadioButtons on form.
            form.RadioButtons = new FormRadioButtons(ref form);

            // Set form size.
            form.ClientSize = new Size(250, new FormRectangles().TotalRectHeight());
        }
示例#3
0
 public static Point Position(Form1 form, Rectangle trayRectangle)
 {
     // Return form position location.
     switch (Location(ref trayRectangle))
     {
         case TaskbarPosition.Top:
             return new Point((trayRectangle.Left + trayRectangle.Width - form.Width - 12),
                              (trayRectangle.Top + 48));
         case TaskbarPosition.Bottom:
             return new Point((trayRectangle.Left + trayRectangle.Width - form.Width - 12),
                              (trayRectangle.Top - form.Height - 8));
         case TaskbarPosition.Left:
             return new Point((trayRectangle.Left + trayRectangle.Width + 7),
                              (trayRectangle.Top + trayRectangle.Height) - form.Height - 12);
         case TaskbarPosition.Right:
             return new Point((trayRectangle.Left - trayRectangle.Width - form.Width + 55),
                              (trayRectangle.Top + trayRectangle.Height) - form.Height - 12);
         default:
             return new Point(0, 0);
     }
 }