Fix design problem when title relative long (#85)

This commit is contained in:
Markus Hofknecht 2020-05-24 02:40:44 +02:00
parent ab1177e957
commit 48bcd0bbff
2 changed files with 114 additions and 107 deletions

View file

@ -29,23 +29,95 @@
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
this.dgv = new System.Windows.Forms.DataGridView();
this.ColumnIcon = new System.Windows.Forms.DataGridViewImageColumn();
this.ColumnText = new System.Windows.Forms.DataGridViewTextBoxColumn();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
this.labelTitle = new SystemTrayMenu.UserInterface.LabelNoCopy();
this.tableLayoutPanelSearch = new System.Windows.Forms.TableLayoutPanel();
this.textBoxSearch = new System.Windows.Forms.TextBox();
this.ColumnText = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ColumnIcon = new System.Windows.Forms.DataGridViewImageColumn();
this.dgv = new System.Windows.Forms.DataGridView();
this.pictureBoxSearch = new System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(this.dgv)).BeginInit();
this.textBoxSearch = new System.Windows.Forms.TextBox();
this.tableLayoutPanelSearch = new System.Windows.Forms.TableLayoutPanel();
this.tableLayoutPanel.SuspendLayout();
this.tableLayoutPanelSearch.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgv)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxSearch)).BeginInit();
this.tableLayoutPanelSearch.SuspendLayout();
this.SuspendLayout();
//
// tableLayoutPanel
//
this.tableLayoutPanel.AutoScroll = true;
this.tableLayoutPanel.AutoSize = true;
this.tableLayoutPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.tableLayoutPanel.ColumnCount = 1;
this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel.Controls.Add(this.labelTitle, 0, 0);
this.tableLayoutPanel.Controls.Add(this.dgv, 0, 1);
this.tableLayoutPanel.Controls.Add(this.tableLayoutPanelSearch, 0, 2);
this.tableLayoutPanel.Location = new System.Drawing.Point(1, 1);
this.tableLayoutPanel.Margin = new System.Windows.Forms.Padding(0);
this.tableLayoutPanel.Name = "tableLayoutPanel";
this.tableLayoutPanel.RowCount = 3;
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel.Size = new System.Drawing.Size(83, 182);
this.tableLayoutPanel.TabIndex = 3;
this.tableLayoutPanel.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.dgv_MouseWheel);
//
// labelTitle
//
this.labelTitle.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.labelTitle.AutoEllipsis = true;
this.labelTitle.AutoSize = true;
this.labelTitle.BackColor = System.Drawing.Color.Azure;
this.labelTitle.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelTitle.ForeColor = System.Drawing.Color.Black;
this.labelTitle.Location = new System.Drawing.Point(0, 0);
this.labelTitle.Margin = new System.Windows.Forms.Padding(0);
this.labelTitle.Name = "labelTitle";
this.labelTitle.Padding = new System.Windows.Forms.Padding(3, 0, 0, 1);
this.labelTitle.Size = new System.Drawing.Size(83, 14);
this.labelTitle.TabIndex = 2;
this.labelTitle.Text = "STM";
this.labelTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.labelTitle.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.LabelTitle_MouseDoubleClick);
this.labelTitle.MouseEnter += new System.EventHandler(this.LabelTitle_MouseEnter);
this.labelTitle.MouseLeave += new System.EventHandler(this.LabelTitle_MouseLeave);
this.labelTitle.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.dgv_MouseWheel);
//
// ColumnText
//
this.ColumnText.DataPropertyName = "ColumnText";
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle2.Padding = new System.Windows.Forms.Padding(0, 0, 3, 0);
this.ColumnText.DefaultCellStyle = dataGridViewCellStyle2;
this.ColumnText.Frozen = true;
this.ColumnText.HeaderText = "ColumnText";
this.ColumnText.MaxInputLength = 40;
this.ColumnText.Name = "ColumnText";
this.ColumnText.ReadOnly = true;
this.ColumnText.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.ColumnText.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Programmatic;
this.ColumnText.Width = 50;
//
// ColumnIcon
//
this.ColumnIcon.DataPropertyName = "ColumnIcon";
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle1.NullValue = "System.Drawing.Icon";
dataGridViewCellStyle1.Padding = new System.Windows.Forms.Padding(3, 2, 6, 2);
this.ColumnIcon.DefaultCellStyle = dataGridViewCellStyle1;
this.ColumnIcon.Frozen = true;
this.ColumnIcon.HeaderText = "ColumnIcon";
this.ColumnIcon.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Zoom;
this.ColumnIcon.Name = "ColumnIcon";
this.ColumnIcon.ReadOnly = true;
this.ColumnIcon.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.ColumnIcon.Width = 25;
//
// dgv
//
this.dgv.AllowUserToAddRows = false;
@ -80,80 +152,33 @@
this.dgv.ShowCellToolTips = false;
this.dgv.ShowEditingIcon = false;
this.dgv.ShowRowErrors = false;
this.dgv.Size = new System.Drawing.Size(157, 145);
this.dgv.Size = new System.Drawing.Size(83, 145);
this.dgv.TabIndex = 4;
this.dgv.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.dgv_MouseWheel);
//
// ColumnIcon
// pictureBoxSearch
//
this.ColumnIcon.DataPropertyName = "ColumnIcon";
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle1.NullValue = "System.Drawing.Icon";
dataGridViewCellStyle1.Padding = new System.Windows.Forms.Padding(3, 2, 6, 2);
this.ColumnIcon.DefaultCellStyle = dataGridViewCellStyle1;
this.ColumnIcon.Frozen = true;
this.ColumnIcon.HeaderText = "ColumnIcon";
this.ColumnIcon.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Zoom;
this.ColumnIcon.Name = "ColumnIcon";
this.ColumnIcon.ReadOnly = true;
this.ColumnIcon.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.ColumnIcon.Width = 25;
this.pictureBoxSearch.BackColor = System.Drawing.Color.White;
this.pictureBoxSearch.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.pictureBoxSearch.Location = new System.Drawing.Point(3, 3);
this.pictureBoxSearch.Name = "pictureBoxSearch";
this.pictureBoxSearch.Size = new System.Drawing.Size(16, 16);
this.pictureBoxSearch.TabIndex = 1;
this.pictureBoxSearch.TabStop = false;
//
// ColumnText
// textBoxSearch
//
this.ColumnText.DataPropertyName = "ColumnText";
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle2.Padding = new System.Windows.Forms.Padding(0, 0, 3, 0);
this.ColumnText.DefaultCellStyle = dataGridViewCellStyle2;
this.ColumnText.Frozen = true;
this.ColumnText.HeaderText = "ColumnText";
this.ColumnText.MaxInputLength = 40;
this.ColumnText.Name = "ColumnText";
this.ColumnText.ReadOnly = true;
this.ColumnText.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.ColumnText.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Programmatic;
this.ColumnText.Width = 50;
//
// tableLayoutPanel
//
this.tableLayoutPanel.AutoScroll = true;
this.tableLayoutPanel.AutoSize = true;
this.tableLayoutPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.tableLayoutPanel.ColumnCount = 1;
this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel.Controls.Add(this.dgv, 0, 1);
this.tableLayoutPanel.Controls.Add(this.labelTitle, 0, 0);
this.tableLayoutPanel.Controls.Add(this.tableLayoutPanelSearch, 0, 2);
this.tableLayoutPanel.Location = new System.Drawing.Point(1, 1);
this.tableLayoutPanel.Margin = new System.Windows.Forms.Padding(0);
this.tableLayoutPanel.Name = "tableLayoutPanel";
this.tableLayoutPanel.RowCount = 3;
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel.Size = new System.Drawing.Size(157, 182);
this.tableLayoutPanel.TabIndex = 3;
this.tableLayoutPanel.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.dgv_MouseWheel);
//
// labelTitle
//
this.labelTitle.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.labelTitle.AutoSize = true;
this.labelTitle.BackColor = System.Drawing.Color.Azure;
this.labelTitle.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelTitle.ForeColor = System.Drawing.Color.Black;
this.labelTitle.Location = new System.Drawing.Point(0, 0);
this.labelTitle.Margin = new System.Windows.Forms.Padding(0);
this.labelTitle.Name = "labelTitle";
this.labelTitle.Padding = new System.Windows.Forms.Padding(3, 0, 0, 1);
this.labelTitle.Size = new System.Drawing.Size(157, 14);
this.labelTitle.TabIndex = 2;
this.labelTitle.Text = "STM";
this.labelTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.labelTitle.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.LabelTitle_MouseDoubleClick);
this.labelTitle.MouseEnter += new System.EventHandler(this.LabelTitle_MouseEnter);
this.labelTitle.MouseLeave += new System.EventHandler(this.LabelTitle_MouseLeave);
this.labelTitle.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.dgv_MouseWheel);
this.textBoxSearch.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.textBoxSearch.BackColor = System.Drawing.Color.White;
this.textBoxSearch.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.textBoxSearch.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Bold);
this.textBoxSearch.Location = new System.Drawing.Point(25, 4);
this.textBoxSearch.Margin = new System.Windows.Forms.Padding(3, 4, 3, 2);
this.textBoxSearch.Name = "textBoxSearch";
this.textBoxSearch.ShortcutsEnabled = false;
this.textBoxSearch.Size = new System.Drawing.Size(55, 15);
this.textBoxSearch.TabIndex = 0;
this.textBoxSearch.TextChanged += new System.EventHandler(this.textBoxSearch_TextChanged);
//
// tableLayoutPanelSearch
//
@ -171,33 +196,9 @@
this.tableLayoutPanelSearch.Name = "tableLayoutPanelSearch";
this.tableLayoutPanelSearch.RowCount = 1;
this.tableLayoutPanelSearch.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanelSearch.Size = new System.Drawing.Size(157, 22);
this.tableLayoutPanelSearch.Size = new System.Drawing.Size(83, 22);
this.tableLayoutPanelSearch.TabIndex = 5;
//
// textBoxSearch
//
this.textBoxSearch.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.textBoxSearch.BackColor = System.Drawing.Color.White;
this.textBoxSearch.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.textBoxSearch.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Bold);
this.textBoxSearch.Location = new System.Drawing.Point(25, 4);
this.textBoxSearch.Margin = new System.Windows.Forms.Padding(3, 4, 3, 2);
this.textBoxSearch.Name = "textBoxSearch";
this.textBoxSearch.ShortcutsEnabled = false;
this.textBoxSearch.Size = new System.Drawing.Size(129, 15);
this.textBoxSearch.TabIndex = 0;
this.textBoxSearch.TextChanged += new System.EventHandler(this.textBoxSearch_TextChanged);
//
// pictureBoxSearch
//
this.pictureBoxSearch.BackColor = System.Drawing.Color.White;
this.pictureBoxSearch.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.pictureBoxSearch.Location = new System.Drawing.Point(3, 3);
this.pictureBoxSearch.Name = "pictureBoxSearch";
this.pictureBoxSearch.Size = new System.Drawing.Size(16, 16);
this.pictureBoxSearch.TabIndex = 1;
this.pictureBoxSearch.TabStop = false;
//
// Menu
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
@ -215,12 +216,12 @@
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "SystemTrayMenu";
this.TopMost = true;
((System.ComponentModel.ISupportInitialize)(this.dgv)).EndInit();
this.tableLayoutPanel.ResumeLayout(false);
this.tableLayoutPanel.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.dgv)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxSearch)).EndInit();
this.tableLayoutPanelSearch.ResumeLayout(false);
this.tableLayoutPanelSearch.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxSearch)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@ -228,12 +229,12 @@
#endregion
private SystemTrayMenu.UserInterface.LabelNoCopy labelTitle;
private System.Windows.Forms.DataGridView dgv;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel;
private System.Windows.Forms.DataGridView dgv;
private System.Windows.Forms.DataGridViewImageColumn ColumnIcon;
private System.Windows.Forms.DataGridViewTextBoxColumn ColumnText;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanelSearch;
private System.Windows.Forms.TextBox textBoxSearch;
private System.Windows.Forms.PictureBox pictureBoxSearch;
private System.Windows.Forms.DataGridViewImageColumn ColumnIcon;
private System.Windows.Forms.DataGridViewTextBoxColumn ColumnText;
}
}

View file

@ -157,16 +157,22 @@ namespace SystemTrayMenu.UserInterface
case MenuType.Empty:
SetTitle(Translator.GetText("Folder empty"));
labelTitle.BackColor = MenuDefines.ColorTitleWarning;
this.pictureBoxSearch.Visible = false;
this.textBoxSearch.Visible = false;
this.tableLayoutPanelSearch.Visible = false;
break;
case MenuType.NoAccess:
SetTitle(Translator.GetText("Folder inaccessible"));
labelTitle.BackColor = MenuDefines.ColorTitleWarning;
this.pictureBoxSearch.Visible = false;
this.textBoxSearch.Visible = false;
this.tableLayoutPanelSearch.Visible = false;
break;
case MenuType.MaxReached:
SetTitle($"Max {MenuDefines.MenusMax - 1} Menus");
labelTitle.BackColor = MenuDefines.ColorTitleWarning;
this.pictureBoxSearch.Visible = false;
this.textBoxSearch.Visible = false;
this.tableLayoutPanelSearch.Visible = false;
break;
case MenuType.Main: