Пример #1
0
 void ControlsManager_ControlSelectionChanged(object sender, ControlSelectedEventArgs e)
 {
     if (e.Type == ControlType.Components)
     {
         // add all eventhadlers
         this.tvComponents.MouseClick      += new System.Windows.Forms.MouseEventHandler(this.tvComponents_MouseClick);
         this.tvComponents.DragDrop        += new System.Windows.Forms.DragEventHandler(this.tvComponents_DragDrop);
         this.tvComponents.AfterSelect     += new System.Windows.Forms.TreeViewEventHandler(this.tvComponents_AfterSelect);
         this.tvComponents.DragEnter       += new System.Windows.Forms.DragEventHandler(this.Components_DragEnter);
         this.tvComponents.BeforeLabelEdit += new System.Windows.Forms.NodeLabelEditEventHandler(this.tvComponents_BeforeLabelEdit);
         this.tvComponents.KeyDown         += new System.Windows.Forms.KeyEventHandler(this.tvComponents_KeyDown);
         this.tvComponents.ItemDrag        += new System.Windows.Forms.ItemDragEventHandler(this.tvComponents_ItemDrag);
         tabControlComponents_SelectedIndexChanged(null, null);
     }
     else
     {
         this.tvComponents.MouseClick      -= new System.Windows.Forms.MouseEventHandler(this.tvComponents_MouseClick);
         this.tvComponents.DragDrop        -= new System.Windows.Forms.DragEventHandler(this.tvComponents_DragDrop);
         this.tvComponents.AfterSelect     -= new System.Windows.Forms.TreeViewEventHandler(this.tvComponents_AfterSelect);
         this.tvComponents.DragEnter       -= new System.Windows.Forms.DragEventHandler(this.Components_DragEnter);
         this.tvComponents.BeforeLabelEdit -= new System.Windows.Forms.NodeLabelEditEventHandler(this.tvComponents_BeforeLabelEdit);
         this.tvComponents.KeyDown         -= new System.Windows.Forms.KeyEventHandler(this.tvComponents_KeyDown);
         this.tvComponents.ItemDrag        -= new System.Windows.Forms.ItemDragEventHandler(this.tvComponents_ItemDrag);
     }
 }
Пример #2
0
        public static void NotifyControlSelectionChanged(ControlType controlType)
        {
            ControlSelectedEventArgs args = new ControlSelectedEventArgs(controls[controlType], controlType);

            if (ControlSelectionChanged != null)
            {
                selectedControlType = controlType;
                ControlSelectionChanged(null, args);
            }
        }
Пример #3
0
 void ControlsManager_ControlSelectionChanged(object sender, ControlSelectedEventArgs e)
 {
     if (InvokeRequired)
     {
         Invoke(new ControlsManager_ControlSelectionChangedDelegate(ControlsManager_ControlSelectionChanged), sender, e);
     }
     else
     {
         Control selectedControl = e.Control;
         if (selectedControl != null)
         {
             selectedControl.Dock = DockStyle.Fill;
             splitContainerMain.Panel2.Controls.Clear();
             splitContainerMain.Panel2.Controls.Add(selectedControl);
         }
     }
 }