Example #1
0
 void item_Click(object sender, MouseEventArgs e)
 {
     if (selectedItem != null)
         selectedItem.IsActive = false;
     selectedItem = (ImageViewer)sender;
     selectedItem.IsActive = true;
 }
        public ImageViewer Add(Bitmap bitmap, String name, bool Text)
        {
            ImageViewer imageViewer = new ImageViewer();
            imageViewer.Dock = DockStyle.Bottom;
            imageViewer.Image = new Bitmap(bitmap); // Copying the bitmap for thread safety
            imageViewer.IsText = Text;
            imageViewer.Width = bitmap.Width + 8;
            imageViewer.Height = bitmap.Height + 8 + ((Text) ? 12 : 0);
            imageViewer.Name = name;
            imageViewer.IsThumbnail = false;

            Controls.Add(imageViewer);

            return imageViewer;
        }
Example #3
0
        public CommonPanel(HaCreatorStateManager hcsm)
        {
            this.hcsm = hcsm;
            InitializeComponent();

            ImageViewer[] commonItems = new ImageViewer[] {
                miscItemsContainer.Add(CreateColoredBitmap(WzInfoTools.XNAToDrawingColor(UserSettings.FootholdColor)), "Foothold", true),
                miscItemsContainer.Add(CreateColoredBitmap(WzInfoTools.XNAToDrawingColor(UserSettings.RopeColor)), "Rope", true),
                miscItemsContainer.Add(CreateColoredBitmap(WzInfoTools.XNAToDrawingColor(UserSettings.ChairColor)), "Chair", true),
                miscItemsContainer.Add(CreateColoredBitmap(WzInfoTools.XNAToDrawingColor(UserSettings.ToolTipColor)), "Tooltip", true),
                miscItemsContainer.Add(CreateColoredBitmap(WzInfoTools.XNAToDrawingColor(UserSettings.MiscColor)), "Clock", true)
            };
            foreach (ImageViewer item in commonItems)
            {
                item.MouseDown += new MouseEventHandler(commonItem_Click);
                item.MouseUp += new MouseEventHandler(ImageViewer.item_MouseUp);
            }
        }