public void RefreshComponents() { if (!ControlBox) { return; } if (WindowState == FormWindowState.Maximized) { if (Theme == MetroThemeStyle.Light) { windowMaximize.Image = Properties.Resources.drect_black; windowMaximize.NoFocusImage = Properties.Resources.drect_black; } else { windowMaximize.Image = Properties.Resources.drect_white; windowMaximize.NoFocusImage = Properties.Resources.drect_white; } windowMaximize.Tag = WindowsButton.maximized; CustomPanelWinControl.Location = new Point(ClientSize.Width - controlBoxSpace, 0); } else { if (Theme == MetroThemeStyle.Light) { windowMaximize.Image = Properties.Resources.rect_black; windowMaximize.NoFocusImage = Properties.Resources.rect_black; } else { windowMaximize.Image = Properties.Resources.rect_white; windowMaximize.NoFocusImage = Properties.Resources.rect_white; } windowMaximize.Tag = WindowsButton.minimized; CustomPanelWinControl.Location = new Point(ClientSize.Width - controlBoxSpace - 2, 2); } if (Theme == MetroThemeStyle.Light) { windowClose.Image = Properties.Resources.x_black; windowClose.NoFocusImage = Properties.Resources.x_black; windowTray.Image = Properties.Resources.line_black; windowTray.NoFocusImage = Properties.Resources.line_black; } else { windowClose.Image = Properties.Resources.x_white; windowClose.NoFocusImage = Properties.Resources.x_white; windowTray.Image = Properties.Resources.line_white; windowTray.NoFocusImage = Properties.Resources.line_white; } windowClose.BackColor = Color.Transparent; windowTray.BackColor = Color.Transparent; notifLabel.BackColor = StyleMethods.ToSystemColor(Style); notifLabel.ForeColor = MetroColors.White; notifLabel.Location = new Point(3, Height - 21); }
protected override void OnPaint(PaintEventArgs e) { SolidBrush brush = new SolidBrush(StyleMethods.ToSystemColor(Style)); Pen pen = new Pen(brush, 2); if (NotificationBox) { e.Graphics.FillRectangle(brush, 0, Height - 25, Width, 25); } switch (BorderStyle) { case MetroFormBorderStyle.None: break; case MetroFormBorderStyle.FixedSingle: if (WindowState == FormWindowState.Normal) { e.Graphics.DrawRectangle(pen, 1, 1, Width - 2, Height - 2); } break; } RefreshComponents(); }
private void WindowButton_MouseEnter(object sender, EventArgs e) { MetroLink button = (MetroLink)sender; button.BackColor = StyleMethods.ToSystemColor(Style); }