private void Form_Main_Load(object sender, EventArgs e) { MakeMaxForm(); ShowOnMonitor(showOnMonitor); NormalSzie = Size; ControlNeedRefresh = true; NormalLocation = Location; Color_PrimaryColor = Color.Black; Header_Height = 80; GB = new GaussianBlur(10); LoadBGImage(); LoadPanel1(); LoadPanel2(); LoadPanel3(); ScoreListView.Size = new Size(857, 525); moUI_Panel1.Visible = false; moUI_Panel2.Visible = false; moUI_Panel3.Visible = false; Form_Main_Resize(null, null); LoadOptionButton(); MoUI_Controler.SetTextColor(Controls, CurrentTextColor); MoUI_Controler.SetTextColor(moUI_Panel1.Controls, CurrentTextColor); MoUI_Controler.SetTextColor(moUI_Panel2.Controls, CurrentTextColor); MoUI_Controler.SetTextColor(moUI_Panel3.Controls, CurrentTextColor); MoUI_Controler.SetTextColor(PanelOption.Controls, CurrentTextColor); Invalidate(); TestSub(); }
protected override void OnPaint(PaintEventArgs e) { try { //Graphics g = e.Graphics; Bitmap b = new Bitmap(Width, Height); Graphics g = Graphics.FromImage(b); Pen PrimaryColorPen = new Pen(Color.FromArgb(255, Color_PrimaryColor)); //Pen PrimaryColorPen = new Pen(Color.FromArgb(250, Color.White)); Pen BlackPen = new Pen(Color.Black); //UI重绘 { //Graphics g = Graphics.FromImage(FormBackGround); //g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; //Brush BackGroundBush = new SolidBrush(Color.Gray); //g.Clear(Color.LightGray); //for (int i = 100; i < Width; i += 100) //{ // for (int j = 100; j < Height; j += 100) // { // g.FillEllipse(BackGroundBush, i, j, 2, 2); // } //} g.DrawImage(PreImage_BG, new Rectangle(1, 1, Width - 2, Height - 2), new Rectangle((PreImage_BG.Width - Width) / 2 - 1, 1, Width - 2, Height - 2), GraphicsUnit.Pixel); //g.Save(); //e.Graphics.DrawImage(FormBackGround, 0, 0); } //Paint Header { g.DrawImage(PreImage_Header, new Rectangle(2, 2, Width - 4, Header_Height), new Rectangle((PreImage_BG.Width - Width) / 2, 2, Width - 4, Header_Height), GraphicsUnit.Pixel); } //Paint Line { g.DrawLine(BlackPen, new Point(0, 0), new Point(Width, 0)); g.DrawLine(BlackPen, new Point(Width - 1, 0), new Point(Width - 1, Height - 1)); g.DrawLine(BlackPen, new Point(Width - 1, Height - 1), new Point(0, Height - 1)); g.DrawLine(BlackPen, new Point(0, Height), new Point(0, 0)); g.DrawLine(PrimaryColorPen, new Point(2, 1), new Point(Width - 2, 1)); g.DrawLine(PrimaryColorPen, new Point(Width - 2, 2), new Point(Width - 2, Height - 2)); g.DrawLine(PrimaryColorPen, new Point(Width - 3, Height - 2), new Point(1, Height - 2)); g.DrawLine(PrimaryColorPen, new Point(1, Height - 3), new Point(1, 1)); g.DrawLine(PrimaryColorPen, new Point(121, Header_Height), new Point(121, Height - 2)); g.DrawLine(PrimaryColorPen, new Point(2, Header_Height), new Point(Width - 3, Header_Height)); } //Paint Control { //g.DrawImage(ImageEx.ImageFromText("test", new Font("微软雅黑", 30), Color.White, Color.FromArgb(125,Color.Black)), new Point(100, 100)); } //Test Sub { //GraphicsPath graphicsPath = new GraphicsPath(); //graphicsPath.AddEllipse(new Rectangle(0, 0, 200, 200)); //PathGradientBrush pathGradientBrush = new PathGradientBrush(graphicsPath); //pathGradientBrush.CenterColor = Color.FromArgb(255, 232, 3); //pathGradientBrush.CenterPoint = new PointF(100, 100); //pathGradientBrush.SurroundColors = new Color[] { Color.Transparent }; //e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; //e.Graphics.FillEllipse(pathGradientBrush, new Rectangle(0, 0, 200, 200)); //graphicsPath.Dispose(); //pathGradientBrush.Dispose(); } g.Save(); e.Graphics.DrawImage(b, new Point(0, 0)); if (ControlNeedRefresh && Panel_ResizeButton.Visible) { ControlNeedRefresh = false; MoUI_Controler.RefreshMoUIControlBackgroundImage(Controls, b, CurrentTextColor); } b.Dispose(); g.Dispose(); } catch //(Exception ex) { // } }