public PropertiesExplorer() { tabPages = new List <PropertyPage>(); listBox = new ListBox(); // a ListBox which only becomes visible (and positioned and filled) when a drop-down button of an PropertyEntry has been clicked listBox.Visible = false; listBox.LostFocus += ListBox_LostFocus; listBox.SelectedIndexChanged += ListBox_SelectedIndexChanged; listBox.MouseClick += ListBox_MouseClick; listBox.DrawMode = DrawMode.OwnerDrawFixed; listBox.Name = "the list box"; listBox.TabStop = false; listBox.DrawItem += ListBox_DrawItem; textBox = new TextBox(); textBox.Visible = false; textBox.KeyUp += TextBox_KeyUp; textBox.Name = "the text box"; textBox.TabStop = false; labelExtension = new Label(); labelExtension.Visible = false; labelExtension.Name = "the label extension"; labelExtension.TabStop = false; labelExtension.Paint += LabelExtension_Paint; tabControl = new TabControl(); tabControl.Dock = DockStyle.Fill; tabControl.Name = "the tab control"; tabControl.TabStop = false; // we have our own tab handling mechanism tabControl.SelectedIndexChanged += TabControl_SelectedIndexChanged; tabControl.DrawMode = TabDrawMode.OwnerDrawFixed; tabControl.SizeMode = TabSizeMode.Fixed; tabControl.ItemSize = new Size(27, 21); tabControl.DrawItem += tabControl_DrawItem; tabControl.ShowToolTips = true; Controls.Add(tabControl); Controls.Add(listBox); Controls.Add(textBox); Controls.Add(labelExtension); ImageList imageList = new ImageList(); imageList.ImageSize = new Size(16, 16); System.Drawing.Bitmap bmp = BitmapTable.GetBitmap("Icons.bmp"); Color clr = bmp.GetPixel(0, 0); if (clr.A != 0) { bmp.MakeTransparent(clr); } imageList.Images.AddStrip(bmp); tabControl.ImageList = imageList; entriesToHide = new HashSet <string>(); }
/// <summary> /// Returns a bitmap from the specified embeded resource. the name is in the form filename:index /// </summary> /// <param name="name"></param> /// <returns></returns> Bitmap IUIService.GetBitmap(string name) { string[] parts = name.Split(':'); if (parts.Length == 2) { ImageList il = BitmapTable.GetImageList(parts[0], 15, 15); if (il != null) { try { int ind = int.Parse(parts[1]); return(il.Images[ind] as Bitmap); } catch (FormatException) { } catch (OverflowException) { } catch (ArgumentOutOfRangeException) { } } } return(null); }