private void CreateButton(ViewType type, bool on = true) { int size = this.flowLayoutPanel1.Height; StatusImageButton button = new StatusImageButton(); this.flowLayoutPanel1.Controls.Add(button); button.Image = type.Bitmap(); button.Location = new System.Drawing.Point(0, 0); button.Name = type.ToString(); button.Tag = type; button.OffImageType = Sardauscan.Gui.Controls.eOffButtonType.NotSelected; button.On = on; button.Size = new System.Drawing.Size(size, size); button.Click += OnButtonClick; button.Margin = new Padding(0); this.ToolTip.SetToolTip(button, type.ToString()); flowLayoutPanel1.Width = size * flowLayoutPanel1.Controls.Count; flowLayoutPanel1.Height = size; }