private void InitializeComponent() { // Initialize ImageList ImageList imglist = new ImageList(); imglist.Images.Add(ExocortexResources.GetBitmap("folderClosed.bmp")); imglist.Images.Add(ExocortexResources.GetBitmap("folderOpen.bmp")); imglist.Images.Add(ExocortexResources.GetBitmap("driveFloppy.bmp")); imglist.Images.Add(ExocortexResources.GetBitmap("driveStandard.bmp")); imglist.Images.Add(ExocortexResources.GetBitmap("driveCdrom.bmp")); imglist.Images.Add(ExocortexResources.GetBitmap("driveNetwork.bmp")); this.ImageList = imglist; // Add event handler this.BeforeSelect += new System.Windows.Forms.TreeViewCancelEventHandler(this.OnBeforeSelect); this.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.OnAfterSelect); this.BeforeExpand += new System.Windows.Forms.TreeViewCancelEventHandler(this.OnBeforeExpand); this.BeforeCollapse += new System.Windows.Forms.TreeViewCancelEventHandler(this.OnBeforeCollapse); }
public void DrawCheckmark(Graphics g, Rectangle bounds, bool selected) { if (bitmapCheckmark == null) { bitmapCheckmark = ExocortexResources.GetIcon("menuCheckmark.ico").ToBitmap(); ExoControlUtils.SetBitmapTransparency(bitmapCheckmark, Color.Magenta); } int checkTop = bounds.Top + (itemHeight - BITMAP_SIZE) / 2; int checkLeft = bounds.Left + (STRIPE_WIDTH - BITMAP_SIZE) / 2; if (selected) { Color darker = ScaleColor(selectionColor, 0.8f); //.A, (int)(selectionColor.R * 0.8), (int)(selectionColor.G * 0.8), (int)(selectionColor.B * 0.8) ); g.FillRectangle(new SolidBrush(darker), checkLeft - 1, checkTop - 1, BITMAP_SIZE + 3, BITMAP_SIZE + 3); } else { Color lighter = ScaleColor(selectionColor, 1.2f); //CreateColor( selectionColor.A, (int)(selectionColor.R * 1.2), (int)(selectionColor.G * 1.2), (int)(selectionColor.B * 1.2) ); g.FillRectangle(new SolidBrush(lighter), checkLeft - 1, checkTop - 1, BITMAP_SIZE + 3, BITMAP_SIZE + 3); } g.DrawImage(bitmapCheckmark, checkLeft, checkTop); g.DrawRectangle(new Pen(borderColor), checkLeft - 2, checkTop - 2, BITMAP_SIZE + 3, BITMAP_SIZE + 3); }