diff --git a/Netch/Forms/MainForm.Designer.cs b/Netch/Forms/MainForm.Designer.cs index 0a551854..d572df09 100644 --- a/Netch/Forms/MainForm.Designer.cs +++ b/Netch/Forms/MainForm.Designer.cs @@ -64,9 +64,16 @@ namespace Netch.Forms this.ModeLabel = new System.Windows.Forms.Label(); this.ServerLabel = new System.Windows.Forms.Label(); this.ProfileNameText = new System.Windows.Forms.TextBox(); + this.ModeComboBox = new System.Windows.Forms.SearchComboBox(); this.ServerComboBox = new System.Windows.Forms.ComboBox(); this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); + this.EditPictureBox = new System.Windows.Forms.PictureBox(); + this.CopyLinkPictureBox = new System.Windows.Forms.PictureBox(); + this.DeletePictureBox = new System.Windows.Forms.PictureBox(); + this.SpeedPictureBox = new System.Windows.Forms.PictureBox(); this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); + this.EditModePictureBox = new System.Windows.Forms.PictureBox(); + this.DeleteModePictureBox = new System.Windows.Forms.PictureBox(); this.StatusStrip = new System.Windows.Forms.StatusStrip(); this.StatusLabel = new System.Windows.Forms.ToolStripStatusLabel(); this.UsedBandwidthLabel = new System.Windows.Forms.ToolStripStatusLabel(); @@ -81,27 +88,20 @@ namespace Netch.Forms this.SettingsButton = new System.Windows.Forms.Button(); this.ProfileGroupBox = new System.Windows.Forms.GroupBox(); this.ProfileTable = new System.Windows.Forms.TableLayoutPanel(); - this.ModeComboBox = new System.Windows.Forms.SearchComboBox(); - this.EditPictureBox = new System.Windows.Forms.PictureBox(); - this.CopyLinkPictureBox = new System.Windows.Forms.PictureBox(); - this.DeletePictureBox = new System.Windows.Forms.PictureBox(); - this.SpeedPictureBox = new System.Windows.Forms.PictureBox(); - this.EditModePictureBox = new System.Windows.Forms.PictureBox(); - this.DeleteModePictureBox = new System.Windows.Forms.PictureBox(); this.MenuStrip.SuspendLayout(); this.ConfigurationGroupBox.SuspendLayout(); this.configLayoutPanel.SuspendLayout(); this.tableLayoutPanel2.SuspendLayout(); - this.tableLayoutPanel3.SuspendLayout(); - this.StatusStrip.SuspendLayout(); - this.NotifyMenu.SuspendLayout(); - this.ProfileGroupBox.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.EditPictureBox)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.CopyLinkPictureBox)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.DeletePictureBox)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.SpeedPictureBox)).BeginInit(); + this.tableLayoutPanel3.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.EditModePictureBox)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.DeleteModePictureBox)).BeginInit(); + this.StatusStrip.SuspendLayout(); + this.NotifyMenu.SuspendLayout(); + this.ProfileGroupBox.SuspendLayout(); this.SuspendLayout(); // // MenuStrip @@ -401,6 +401,19 @@ namespace Netch.Forms this.ProfileNameText.Size = new System.Drawing.Size(546, 23); this.ProfileNameText.TabIndex = 11; // + // ModeComboBox + // + this.ModeComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.ModeComboBox.Dock = System.Windows.Forms.DockStyle.Fill; + this.ModeComboBox.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; + this.ModeComboBox.FormattingEnabled = true; + this.ModeComboBox.IntegralHeight = false; + this.ModeComboBox.Location = new System.Drawing.Point(54, 34); + this.ModeComboBox.Name = "ModeComboBox"; + this.ModeComboBox.Size = new System.Drawing.Size(546, 24); + this.ModeComboBox.TabIndex = 2; + this.ModeComboBox.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.ComboBox_DrawItem); + // // ServerComboBox // this.ServerComboBox.Dock = System.Windows.Forms.DockStyle.Fill; @@ -433,6 +446,50 @@ namespace Netch.Forms this.tableLayoutPanel2.Size = new System.Drawing.Size(94, 24); this.tableLayoutPanel2.TabIndex = 12; // + // EditPictureBox + // + this.EditPictureBox.Cursor = System.Windows.Forms.Cursors.Hand; + this.EditPictureBox.Image = ((System.Drawing.Image)(resources.GetObject("EditPictureBox.Image"))); + this.EditPictureBox.Location = new System.Drawing.Point(3, 3); + this.EditPictureBox.Name = "EditPictureBox"; + this.EditPictureBox.Size = new System.Drawing.Size(16, 16); + this.EditPictureBox.TabIndex = 7; + this.EditPictureBox.TabStop = false; + this.EditPictureBox.Click += new System.EventHandler(this.EditPictureBox_Click); + // + // CopyLinkPictureBox + // + this.CopyLinkPictureBox.Cursor = System.Windows.Forms.Cursors.Hand; + this.CopyLinkPictureBox.Image = global::Netch.Properties.Resources.CopyLink; + this.CopyLinkPictureBox.Location = new System.Drawing.Point(72, 3); + this.CopyLinkPictureBox.Name = "CopyLinkPictureBox"; + this.CopyLinkPictureBox.Size = new System.Drawing.Size(18, 18); + this.CopyLinkPictureBox.TabIndex = 14; + this.CopyLinkPictureBox.TabStop = false; + this.CopyLinkPictureBox.Click += new System.EventHandler(this.CopyLinkPictureBox_Click); + // + // DeletePictureBox + // + this.DeletePictureBox.Cursor = System.Windows.Forms.Cursors.Hand; + this.DeletePictureBox.Image = ((System.Drawing.Image)(resources.GetObject("DeletePictureBox.Image"))); + this.DeletePictureBox.Location = new System.Drawing.Point(26, 3); + this.DeletePictureBox.Name = "DeletePictureBox"; + this.DeletePictureBox.Size = new System.Drawing.Size(16, 16); + this.DeletePictureBox.TabIndex = 8; + this.DeletePictureBox.TabStop = false; + this.DeletePictureBox.Click += new System.EventHandler(this.DeletePictureBox_Click); + // + // SpeedPictureBox + // + this.SpeedPictureBox.Cursor = System.Windows.Forms.Cursors.Hand; + this.SpeedPictureBox.Image = ((System.Drawing.Image)(resources.GetObject("SpeedPictureBox.Image"))); + this.SpeedPictureBox.Location = new System.Drawing.Point(49, 3); + this.SpeedPictureBox.Name = "SpeedPictureBox"; + this.SpeedPictureBox.Size = new System.Drawing.Size(16, 16); + this.SpeedPictureBox.TabIndex = 9; + this.SpeedPictureBox.TabStop = false; + this.SpeedPictureBox.Click += new System.EventHandler(this.SpeedPictureBox_Click); + // // tableLayoutPanel3 // this.tableLayoutPanel3.ColumnCount = 4; @@ -449,6 +506,30 @@ namespace Netch.Forms this.tableLayoutPanel3.Size = new System.Drawing.Size(94, 24); this.tableLayoutPanel3.TabIndex = 13; // + // EditModePictureBox + // + this.EditModePictureBox.Cursor = System.Windows.Forms.Cursors.Hand; + this.EditModePictureBox.ErrorImage = global::Netch.Properties.Resources.edit; + this.EditModePictureBox.Image = global::Netch.Properties.Resources.edit; + this.EditModePictureBox.InitialImage = global::Netch.Properties.Resources.edit; + this.EditModePictureBox.Location = new System.Drawing.Point(3, 3); + this.EditModePictureBox.Name = "EditModePictureBox"; + this.EditModePictureBox.Size = new System.Drawing.Size(16, 16); + this.EditModePictureBox.TabIndex = 12; + this.EditModePictureBox.TabStop = false; + this.EditModePictureBox.Click += new System.EventHandler(this.EditModePictureBox_Click); + // + // DeleteModePictureBox + // + this.DeleteModePictureBox.Cursor = System.Windows.Forms.Cursors.Hand; + this.DeleteModePictureBox.Image = global::Netch.Properties.Resources.delete; + this.DeleteModePictureBox.Location = new System.Drawing.Point(26, 3); + this.DeleteModePictureBox.Name = "DeleteModePictureBox"; + this.DeleteModePictureBox.Size = new System.Drawing.Size(16, 16); + this.DeleteModePictureBox.TabIndex = 13; + this.DeleteModePictureBox.TabStop = false; + this.DeleteModePictureBox.Click += new System.EventHandler(this.DeleteModePictureBox_Click); + // // StatusStrip // this.StatusStrip.ImageScalingSize = new System.Drawing.Size(20, 20); @@ -577,87 +658,6 @@ namespace Netch.Forms this.ProfileTable.Size = new System.Drawing.Size(703, 43); this.ProfileTable.TabIndex = 0; // - // ModeComboBox - // - this.ModeComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; - this.ModeComboBox.Dock = System.Windows.Forms.DockStyle.Fill; - this.ModeComboBox.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; - this.ModeComboBox.FormattingEnabled = true; - this.ModeComboBox.IntegralHeight = false; - this.ModeComboBox.Location = new System.Drawing.Point(54, 34); - this.ModeComboBox.Name = "ModeComboBox"; - this.ModeComboBox.Size = new System.Drawing.Size(546, 24); - this.ModeComboBox.TabIndex = 2; - this.ModeComboBox.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.ComboBox_DrawItem); - // - // EditPictureBox - // - this.EditPictureBox.Cursor = System.Windows.Forms.Cursors.Hand; - this.EditPictureBox.Image = ((System.Drawing.Image)(resources.GetObject("EditPictureBox.Image"))); - this.EditPictureBox.Location = new System.Drawing.Point(3, 3); - this.EditPictureBox.Name = "EditPictureBox"; - this.EditPictureBox.Size = new System.Drawing.Size(16, 16); - this.EditPictureBox.TabIndex = 7; - this.EditPictureBox.TabStop = false; - this.EditPictureBox.Click += new System.EventHandler(this.EditPictureBox_Click); - // - // CopyLinkPictureBox - // - this.CopyLinkPictureBox.Cursor = System.Windows.Forms.Cursors.Hand; - this.CopyLinkPictureBox.Image = global::Netch.Properties.Resources.CopyLink; - this.CopyLinkPictureBox.Location = new System.Drawing.Point(72, 3); - this.CopyLinkPictureBox.Name = "CopyLinkPictureBox"; - this.CopyLinkPictureBox.Size = new System.Drawing.Size(18, 18); - this.CopyLinkPictureBox.TabIndex = 14; - this.CopyLinkPictureBox.TabStop = false; - this.CopyLinkPictureBox.Click += new System.EventHandler(this.CopyLinkPictureBox_Click); - // - // DeletePictureBox - // - this.DeletePictureBox.Cursor = System.Windows.Forms.Cursors.Hand; - this.DeletePictureBox.Image = ((System.Drawing.Image)(resources.GetObject("DeletePictureBox.Image"))); - this.DeletePictureBox.Location = new System.Drawing.Point(26, 3); - this.DeletePictureBox.Name = "DeletePictureBox"; - this.DeletePictureBox.Size = new System.Drawing.Size(16, 16); - this.DeletePictureBox.TabIndex = 8; - this.DeletePictureBox.TabStop = false; - this.DeletePictureBox.Click += new System.EventHandler(this.DeletePictureBox_Click); - // - // SpeedPictureBox - // - this.SpeedPictureBox.Cursor = System.Windows.Forms.Cursors.Hand; - this.SpeedPictureBox.Image = ((System.Drawing.Image)(resources.GetObject("SpeedPictureBox.Image"))); - this.SpeedPictureBox.Location = new System.Drawing.Point(49, 3); - this.SpeedPictureBox.Name = "SpeedPictureBox"; - this.SpeedPictureBox.Size = new System.Drawing.Size(16, 16); - this.SpeedPictureBox.TabIndex = 9; - this.SpeedPictureBox.TabStop = false; - this.SpeedPictureBox.Click += new System.EventHandler(this.SpeedPictureBox_Click); - // - // EditModePictureBox - // - this.EditModePictureBox.Cursor = System.Windows.Forms.Cursors.Hand; - this.EditModePictureBox.ErrorImage = global::Netch.Properties.Resources.edit; - this.EditModePictureBox.Image = global::Netch.Properties.Resources.edit; - this.EditModePictureBox.InitialImage = global::Netch.Properties.Resources.edit; - this.EditModePictureBox.Location = new System.Drawing.Point(3, 3); - this.EditModePictureBox.Name = "EditModePictureBox"; - this.EditModePictureBox.Size = new System.Drawing.Size(16, 16); - this.EditModePictureBox.TabIndex = 12; - this.EditModePictureBox.TabStop = false; - this.EditModePictureBox.Click += new System.EventHandler(this.EditModePictureBox_Click); - // - // DeleteModePictureBox - // - this.DeleteModePictureBox.Cursor = System.Windows.Forms.Cursors.Hand; - this.DeleteModePictureBox.Image = global::Netch.Properties.Resources.delete; - this.DeleteModePictureBox.Location = new System.Drawing.Point(26, 3); - this.DeleteModePictureBox.Name = "DeleteModePictureBox"; - this.DeleteModePictureBox.Size = new System.Drawing.Size(16, 16); - this.DeleteModePictureBox.TabIndex = 13; - this.DeleteModePictureBox.TabStop = false; - this.DeleteModePictureBox.Click += new System.EventHandler(this.DeleteModePictureBox_Click); - // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); @@ -686,18 +686,18 @@ namespace Netch.Forms this.configLayoutPanel.ResumeLayout(false); this.configLayoutPanel.PerformLayout(); this.tableLayoutPanel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.EditPictureBox)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.CopyLinkPictureBox)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.DeletePictureBox)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.SpeedPictureBox)).EndInit(); this.tableLayoutPanel3.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.EditModePictureBox)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.DeleteModePictureBox)).EndInit(); this.StatusStrip.ResumeLayout(false); this.StatusStrip.PerformLayout(); this.NotifyMenu.ResumeLayout(false); this.ProfileGroupBox.ResumeLayout(false); this.ProfileGroupBox.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.EditPictureBox)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.CopyLinkPictureBox)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.DeletePictureBox)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.SpeedPictureBox)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.EditModePictureBox)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.DeleteModePictureBox)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); diff --git a/Netch/Forms/MainForm.cs b/Netch/Forms/MainForm.cs index a285f94e..650bf179 100644 --- a/Netch/Forms/MainForm.cs +++ b/Netch/Forms/MainForm.cs @@ -283,6 +283,8 @@ namespace Netch.Forms var cbx = sender as ComboBox; + var eWidth = (int)ServerComboBox.Width / 10; + // 绘制背景颜色 e.Graphics.FillRectangle(new SolidBrush(Color.White), e.Bounds); @@ -319,20 +321,22 @@ namespace Netch.Forms } // 绘制延迟底色 - e.Graphics.FillRectangle(brush, ServerComboBox.Size.Width - 60, e.Bounds.Y, 60, e.Bounds.Height); + e.Graphics.FillRectangle(brush, eWidth * 9, e.Bounds.Y, eWidth, e.Bounds.Height); // 绘制延迟字符串 - e.Graphics.DrawString(item.Delay.ToString(), cbx.Font, new SolidBrush(Color.Black), ServerComboBox.Size.Width - 58, e.Bounds.Y); + e.Graphics.DrawString(item.Delay.ToString(), cbx.Font, new SolidBrush(Color.Black), eWidth * 9 + eWidth / 30, e.Bounds.Y); } else if (cbx.Items[e.Index] is Models.Mode) { var item = cbx.Items[e.Index] as Models.Mode; + // 绘制延迟底色 - e.Graphics.FillRectangle(new SolidBrush(Color.Gray), ServerComboBox.Size.Width - 60, e.Bounds.Y, 60, e.Bounds.Height); + e.Graphics.FillRectangle(new SolidBrush(Color.Gray), eWidth * 9, e.Bounds.Y, eWidth, e.Bounds.Height); + // 绘制延迟字符串 - e.Graphics.DrawString(item.Rule.Count.ToString(), cbx.Font, new SolidBrush(Color.Black), ServerComboBox.Size.Width - 58, e.Bounds.Y); + e.Graphics.DrawString(item.Rule.Count.ToString(), cbx.Font, new SolidBrush(Color.Black), eWidth * 9 + eWidth / 30, e.Bounds.Y); } } } @@ -386,7 +390,7 @@ namespace Netch.Forms RelyToolStripMenuItem.Text = Utils.i18N.Translate(RelyToolStripMenuItem.Text); SizeHeight = Size.Height; - ControllHeight = ConfigurationGroupBox.Controls[0].Height/3; + ControllHeight = ConfigurationGroupBox.Controls[0].Height / 3; ProfileBoxHeight = ProfileGroupBox.Height; CFGBoxHeight = ConfigurationGroupBox.Height; InitProfile(); @@ -1262,16 +1266,16 @@ namespace Netch.Forms configLayoutPanel.RowStyles[2].Height = 0; ProfileGroupBox.Visible = false; - ConfigurationGroupBox.Size = new Size(ConfigurationGroupBox.Size.Width, CFGBoxHeight-ControllHeight); - Size = new Size(Size.Width,SizeHeight-(ControllHeight+ProfileBoxHeight)); - + ConfigurationGroupBox.Size = new Size(ConfigurationGroupBox.Size.Width, CFGBoxHeight - ControllHeight); + Size = new Size(Size.Width, SizeHeight - (ControllHeight + ProfileBoxHeight)); + return; } configLayoutPanel.RowStyles[2].SizeType = SizeType.AutoSize; ProfileGroupBox.Visible = true; - ConfigurationGroupBox.Size = new Size(ConfigurationGroupBox.Size.Width,CFGBoxHeight); - Size = new Size(Size.Width,SizeHeight); + ConfigurationGroupBox.Size = new Size(ConfigurationGroupBox.Size.Width, CFGBoxHeight); + Size = new Size(Size.Width, SizeHeight); ProfileTable.ColumnCount = numProfile;