コード例 #1
0
 private void LayoutControl()
 {
     labelName.Text = RecentUsage.GetName(ID);
     if (!SystemUtilities.OSIsWindowsSeven())
     {
         linkLabelStart.Font   = new Font("Tahoma", 8.25F, FontStyle.Regular, GraphicsUnit.Point, 0);
         linkLabelStop.Font    = new Font("Tahoma", 8.25F, FontStyle.Regular, GraphicsUnit.Point, 0);
         linkLabelRestart.Font = new Font("Tahoma", 8.25F, FontStyle.Regular, GraphicsUnit.Point, 0);
         labelName.Font        = new Font("Tahoma", 8.25F, FontStyle.Regular, GraphicsUnit.Point, 0);
     }
 }
コード例 #2
0
        private void LayoutForm()
        {
            bool isWindowsSeven = SystemUtilities.OSIsWindowsSeven();

            ControlRecentApplicationRow row = null;

            foreach (RecentUsage recentUsage in RecentUsages.Take(Configuration.MAX_VISIBLE_RECENT_USAGE_COUNT).OrderBy(recent => (recent.ID == recent.Name)).ThenBy(recent => recent.Name))
            {
                row = new ControlRecentApplicationRow(imageList, recentUsage.ID)
                {
                    Width = flowLayoutPanel.Width
                };
                flowLayoutPanel.Controls.Add(row);
            }

            if (row != null)
            {
                MinimumSize = new Size(MinimumSize.Width, Math.Max(34 + 43 + (isWindowsSeven ? 0 : -16) + Math.Min(RecentUsages.Count, Configuration.MAX_VISIBLE_RECENT_USAGE_COUNT) * row.Height, 100));
            }
            else
            {
                labelNonAvailable.Visible = true;
            }

            linkLabelOpen.Enabled = (_openMainWindowAction != null);

            if (!isWindowsSeven)
            {
                FormBorderStyle                 = FormBorderStyle.FixedToolWindow;
                flowLayoutPanel.Height         += 8;
                panelBackground.BackgroundImage = null;
                panelBackground.Width          += 8;
                panelBackground.Height         -= 4;
                panelBackground.Location        = new Point(panelBackground.Location.X, panelBackground.Location.Y + 10);
                linkLabelOpen.Font              = new Font("Tahoma", 8.25F, FontStyle.Regular, GraphicsUnit.Point, 0);
                linkLabelOpen.Location          = new Point(linkLabelOpen.Location.X, linkLabelOpen.Location.Y + 4);
            }

            Location = new Point(Math.Min(MousePosition.X - Size.Width / 2, Screen.PrimaryScreen.WorkingArea.Width - Size.Width - 8),
                                 Screen.PrimaryScreen.WorkingArea.Height - Size.Height - (isWindowsSeven ? 8 : 0));

            Opacity = 100;
            Show();

            try { Program.SetForegroundWindow(Handle); } catch { }
        }