private Panel CreatePanel(Window window) { var panel = new Panel(); panel.SuspendLayout(); panel.AutoSize = false; panel.Location = new Point(left, 0); panel.ForeColor = normalForegroundColor; panel.BackColor = normalBackgroundColor; var pictureBox = new PictureBox { Size = new Size(this.bar.GetBarHeight(), this.bar.GetBarHeight()), SizeMode = PictureBoxSizeMode.CenterImage }; pictureBox.Click += this.OnApplicationTabClick; panel.Controls.Add(pictureBox); Utilities.GetWindowSmallIconAsBitmap(window.hWnd, bitmap => pictureBox.Image = bitmap); var label = bar.CreateLabel(window.DisplayName, bar.GetBarHeight(), 0); label.Click += this.OnApplicationTabClick; panel.Controls.Add(label); panel.ResumeLayout(); return(panel); }