Example #1
0
        private void AddButton(PreferencePanel panel)
        {
            var btn = new PreferencePanelButton(panel);

            Panel1.Controls.Add(btn);
            btn.ButtonClick += new PreferencePanelButton.ButtonClickEventHandler(btn_ButtonClick);
        }
Example #2
0
 public void AddPanel(PreferencePanel prefPanel)
 {
     if (preferenceContainer1 != null)
     {
         preferenceContainer1.AddPanel(prefPanel);
     }
 }
Example #3
0
 public void AddPanel(PreferencePanel panel)
 {
     if (!ExistButton(panel))
     {
         AddButton(panel);
     }
 }
Example #4
0
 public PreferencePanelButton(PreferencePanel prefPanel)
 {
     TextAlign      = System.Drawing.ContentAlignment.MiddleLeft;
     Text           = prefPanel.ButtonText;
     Dock           = DockStyle.Top;
     UseStyleColors = true;
     Image          = prefPanel.ButtonImage;
     ImageAlign     = ContentAlignment.MiddleRight;
     Size           = new System.Drawing.Size(127, 24);
     MinimumSize    = new System.Drawing.Size(10, 24);
     PrefPanel      = prefPanel;
 }
Example #5
0
 private bool ExistButton(PreferencePanel panel)
 {
     foreach (Control ctrl in Panel1.Controls)
     {
         if (ctrl.GetType().Equals(typeof(PreferencePanelButton)) &&
             ctrl.Text == panel.ButtonText)
         {
             return(true);
         }
     }
     return(false);
 }
Example #6
0
 private void btn_ButtonClick(PreferencePanelButton btn, PreferencePanel Panel)
 {
     if (CanAddPanel(Panel))
     {
         if (Panel2.Controls.Count > 0)
         {
             Panel2.Controls.RemoveAt(0);
         }
         Panel2.Controls.Add(Panel);
         btn.Selected = true;
     }
     Panel.Dock           = DockStyle.Fill;
     Panel.DocumentClose += Panel_DocumentClose;
 }
Example #7
0
 private void Panel_DocumentClose(object sender, PreferencePanel prefPanel)
 {
     Panel2.Controls.Remove(prefPanel);
 }