Changeset 100
- Timestamp:
- 02/27/08 08:15:38 (5 years ago)
- Location:
- branches/eraser6/Eraser
- Files:
-
- 2 added
- 2 edited
-
MainForm.Designer.cs (modified) (1 diff)
-
MainForm.cs (modified) (1 diff)
-
Resources/BackgroundLogo.png (added)
-
Resources/ToolbarHelp.png (added)
Legend:
- Unmodified
- Added
- Removed
-
branches/eraser6/Eraser/MainForm.Designer.cs
r94 r100 1 1 namespace Eraser 2 2 { 3 partial class MainForm4 {5 /// <summary>6 /// Required designer variable.7 /// </summary>8 private System.ComponentModel.IContainer components = null;3 partial class MainForm 4 { 5 /// <summary> 6 /// Required designer variable. 7 /// </summary> 8 private System.ComponentModel.IContainer components = null; 9 9 10 /// <summary>11 /// Clean up any resources being used.12 /// </summary>13 /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>14 protected override void Dispose(bool disposing)15 {16 if (disposing && (components != null))17 {18 components.Dispose();19 }20 base.Dispose(disposing);21 }10 /// <summary> 11 /// Clean up any resources being used. 12 /// </summary> 13 /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> 14 protected override void Dispose(bool disposing) 15 { 16 if (disposing && (components != null)) 17 { 18 components.Dispose(); 19 } 20 base.Dispose(disposing); 21 } 22 22 23 #region Windows Form Designer generated code23 #region Windows Form Designer generated code 24 24 25 /// <summary> 26 /// Required method for Designer support - do not modify 27 /// the contents of this method with the code editor. 28 /// </summary> 29 private void InitializeComponent() 30 { 31 this.contentPanel = new System.Windows.Forms.Panel(); 32 this.SuspendLayout(); 33 // 34 // contentPanel 35 // 36 this.contentPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 37 | System.Windows.Forms.AnchorStyles.Left) 38 | System.Windows.Forms.AnchorStyles.Right))); 39 this.contentPanel.AutoScroll = true; 40 this.contentPanel.BackColor = System.Drawing.Color.White; 41 this.contentPanel.Location = new System.Drawing.Point(14, 77); 42 this.contentPanel.Name = "contentPanel"; 43 this.contentPanel.Size = new System.Drawing.Size(752, 449); 44 this.contentPanel.TabIndex = 0; 45 // 46 // MainForm 47 // 48 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 49 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 50 this.BackColor = System.Drawing.SystemColors.Control; 51 this.ClientSize = new System.Drawing.Size(766, 538); 52 this.Controls.Add(this.contentPanel); 53 this.MinimumSize = new System.Drawing.Size(760, 520); 54 this.Name = "MainForm"; 55 this.Text = "Eraser"; 56 this.Paint += new System.Windows.Forms.PaintEventHandler(this.MainForm_Paint); 57 this.Resize += new System.EventHandler(this.MainForm_Resize); 58 this.ResumeLayout(false); 25 /// <summary> 26 /// Required method for Designer support - do not modify 27 /// the contents of this method with the code editor. 28 /// </summary> 29 private void InitializeComponent() 30 { 31 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); 32 this.contentPanel = new System.Windows.Forms.Panel(); 33 this.SuspendLayout(); 34 // 35 // contentPanel 36 // 37 this.contentPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 38 | System.Windows.Forms.AnchorStyles.Left) 39 | System.Windows.Forms.AnchorStyles.Right))); 40 this.contentPanel.AutoScroll = true; 41 this.contentPanel.BackColor = System.Drawing.Color.White; 42 this.contentPanel.Location = new System.Drawing.Point(14, 77); 43 this.contentPanel.Name = "contentPanel"; 44 this.contentPanel.Size = new System.Drawing.Size(752, 449); 45 this.contentPanel.TabIndex = 0; 46 // 47 // MainForm 48 // 49 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 50 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 51 this.BackColor = System.Drawing.SystemColors.Control; 52 this.ClientSize = new System.Drawing.Size(766, 538); 53 this.Controls.Add(this.contentPanel); 54 this.MinimumSize = new System.Drawing.Size(760, 520); 55 this.Name = "MainForm"; 56 this.Text = "Eraser"; 57 this.Paint += new System.Windows.Forms.PaintEventHandler(this.MainForm_Paint); 58 this.Resize += new System.EventHandler(this.MainForm_Resize); 59 this.ResumeLayout(false); 59 60 60 }61 } 61 62 62 #endregion63 #endregion 63 64 64 private System.Windows.Forms.Panel contentPanel;65 }65 private System.Windows.Forms.Panel contentPanel; 66 } 66 67 } -
branches/eraser6/Eraser/MainForm.cs
r94 r100 10 10 namespace Eraser 11 11 { 12 public partial class MainForm : Form13 {14 public MainForm() 15 { 16 InitializeComponent(); 17 } 12 public partial class MainForm : Form 13 { 14 private ToolBar toolBar; 15 public MainForm() 16 { 17 InitializeComponent(); 18 18 19 private static GraphicsPath CreateRoundRect(float X, float Y, float width, 20 float height, float radius) 21 { 22 GraphicsPath result = new GraphicsPath(); 19 //Create the toolbar control 20 toolBar = new ToolBar(); 21 toolBar.Name = "toolBar"; 22 toolBar.Location = new Point(14, 27); 23 toolBar.Size = new Size(500, 26); 24 toolBar.TabIndex = 1; 25 this.Controls.Add(this.toolBar); 23 26 24 //Top line. 25 result.AddLine(X + radius, Y, X + width - 2 * radius, Y); 27 ToolBarItem schedule = new ToolBarItem(); 28 schedule.Bitmap = Properties.Resources.ToolbarSchedule; 29 schedule.Text = "Erasing Schedule"; 30 schedule.Menu = new ContextMenu(); 31 schedule.Menu.MenuItems.Add("Queue Task"); 32 toolBar.Items.Add(schedule); 26 33 27 //Top-right corner 28 result.AddArc(X + width - 2 * radius, Y, 2 * radius, 2 * radius, 270, 90); 34 ToolBarItem settings = new ToolBarItem(); 35 settings.Bitmap = Properties.Resources.ToolbarSettings; 36 settings.Text = "Settings"; 37 toolBar.Items.Add(settings); 29 38 30 //Right line. 31 result.AddLine(X + width, Y + radius, X + width, Y + height - 2 * radius); 39 ToolBarItem help = new ToolBarItem(); 40 help.Bitmap = Properties.Resources.ToolbarHelp; 41 help.Text = "Help"; 42 toolBar.Items.Add(help); 43 } 32 44 33 //Bottom-right corner 34 result.AddArc(X + width - 2 * radius, Y + height - 2 * radius, 2 * radius, 2 * radius, 0, 90); 45 private static GraphicsPath CreateRoundRect(float X, float Y, float width, 46 float height, float radius) 47 { 48 GraphicsPath result = new GraphicsPath(); 35 49 36 //Bottomline.37 result.AddLine(X + width - 2 * radius, Y + height, X + radius, Y + height);50 //Top line. 51 result.AddLine(X + radius, Y, X + width - 2 * radius, Y); 38 52 39 //Bottom-left corner40 result.AddArc(X, Y + height - 2 *radius, 2 * radius, 2 * radius, 90, 90);53 //Top-right corner 54 result.AddArc(X + width - 2 * radius, Y, 2 * radius, 2 * radius, 270, 90); 41 55 42 //Left line 43 result.AddLine(X, Y + height - 2 * radius, X, Y +radius);56 //Right line. 57 result.AddLine(X + width, Y + radius, X + width, Y + height - 2 * radius); 44 58 45 //Top-left corner 46 result.AddArc(X, Y, 2 * radius, 2 * radius, 180, 90); 47 result.CloseFigure(); 59 //Bottom-right corner 60 result.AddArc(X + width - 2 * radius, Y + height - 2 * radius, 2 * radius, 2 * radius, 0, 90); 48 61 49 return result; 50 } 62 //Bottom line. 63 result.AddLine(X + width - 2 * radius, Y + height, X + radius, Y + height); 51 64 52 private void DrawBackground(Graphics dc) 53 { 54 //Draw the base background 55 dc.FillRectangle(new SolidBrush(Color.FromArgb(unchecked((int)0xFF292929))), 56 new Rectangle(new Point(0, 0), this.Size)); 65 //Bottom-left corner 66 result.AddArc(X, Y + height - 2 *radius, 2 * radius, 2 * radius, 90, 90); 57 67 58 //Then the side gradient 59 dc.FillRectangle(new LinearGradientBrush(new Rectangle(0, 0, 338, Math.Max(1, ClientSize.Height)), 60 Color.FromArgb(unchecked((int)0xFF363636)), 61 Color.FromArgb(unchecked((int)0xFF292929)), 0.0), 62 0, 0, 338, ClientSize.Height); 68 //Left line 69 result.AddLine(X, Y + height - 2 * radius, X, Y + radius); 63 70 64 //Draw the top background 65 dc.FillRectangle(new SolidBrush(Color.FromArgb(unchecked((int)0xFF414141))), 66 new Rectangle(0, 0, ClientSize.Width, 32));71 //Top-left corner 72 result.AddArc(X, Y, 2 * radius, 2 * radius, 180, 90); 73 result.CloseFigure(); 67 74 68 //Finally the top gradient 69 dc.DrawImage(Properties.Resources.BackgroundGradient, new Point(0, 0)); 75 return result; 76 } 70 77 71 dc.SmoothingMode = SmoothingMode.AntiAlias; 72 dc.FillPath(Brushes.White, CreateRoundRect(11, 74, contentPanel.Width + 8, ClientSize.Height - 85, 3)); 73 } 78 private void DrawBackground(Graphics dc) 79 { 80 //Draw the base background 81 dc.FillRectangle(new SolidBrush(Color.FromArgb(unchecked((int)0xFF292929))), 82 new Rectangle(new Point(0, 0), this.Size)); 74 83 75 private void MainForm_Paint(object sender, PaintEventArgs e) 76 { 77 e.Graphics.SetClip(new Rectangle(0, 0, Width, Height), CombineMode.Intersect); 78 DrawBackground(e.Graphics); 79 } 84 //Then the side gradient 85 dc.FillRectangle(new LinearGradientBrush(new Rectangle(0, 0, 338, Math.Max(1, ClientSize.Height)), 86 Color.FromArgb(unchecked((int)0xFF363636)), 87 Color.FromArgb(unchecked((int)0xFF292929)), 0.0), 88 0, 0, 338, ClientSize.Height); 80 89 81 private void MainForm_Resize(object sender, EventArgs e) 82 { 83 Bitmap bmp = new Bitmap(Width, Height); 84 Graphics dc = Graphics.FromImage(bmp); 85 DrawBackground(dc); 90 //Draw the top background 91 dc.FillRectangle(new SolidBrush(Color.FromArgb(unchecked((int)0xFF414141))), 92 new Rectangle(0, 0, ClientSize.Width, 32)); 86 93 87 CreateGraphics().DrawImage(bmp, new Point(0, 0)); 88 } 89 } 94 //The top gradient 95 dc.DrawImage(Properties.Resources.BackgroundGradient, new Point(0, 0)); 96 97 //And the logo 98 Bitmap logo = Properties.Resources.BackgroundLogo; 99 dc.DrawImage(logo, new Point(ClientSize.Width - logo.Width - 10, 10)); 100 101 dc.SmoothingMode = SmoothingMode.AntiAlias; 102 dc.FillPath(Brushes.White, CreateRoundRect(11, 74, contentPanel.Width + 8, ClientSize.Height - 85, 3)); 103 } 104 105 private void MainForm_Paint(object sender, PaintEventArgs e) 106 { 107 e.Graphics.SetClip(new Rectangle(0, 0, Width, Height), CombineMode.Intersect); 108 DrawBackground(e.Graphics); 109 } 110 111 private void MainForm_Resize(object sender, EventArgs e) 112 { 113 Bitmap bmp = new Bitmap(Width, Height); 114 Graphics dc = Graphics.FromImage(bmp); 115 DrawBackground(dc); 116 117 CreateGraphics().DrawImage(bmp, new Point(0, 0)); 118 } 119 } 90 120 }
Note: See TracChangeset
for help on using the changeset viewer.
