private void frmMain_Load(object sender, System.EventArgs e) { // Help for the options toolTip1 = new ToolTip(); toolTip1.AutoPopDelay = 5000; toolTip1.InitialDelay = 500; toolTip1.ReshowDelay = 500; this.cmnuTray.MenuItems.Clear(); for (int i = 0; i < CMOptions.Length; ++i) { optionFlag option = CMOptions[i]; // add system tray menuitem MenuItem it = new System.Windows.Forms.MenuItem(option.text); it.Checked = option.active; it.Click += new EventHandler(clipboardOptionChange); this.cmnuTray.MenuItems.Add(it); // add form button CheckBox btn = new System.Windows.Forms.CheckBox(); btn.Appearance = System.Windows.Forms.Appearance.Button; btn.Location = new System.Drawing.Point(8, 8 + i * 32); btn.Name = "btn" + i; btn.Size = new System.Drawing.Size(95, 23); btn.TabIndex = 1; btn.UseVisualStyleBackColor = true; btn.Text = option.shorttext; toolTip1.SetToolTip(btn, option.desc); btn.Checked = option.active; btn.Click += new EventHandler(clipboardOptionBtnChange); this.Controls.Add(btn); CMOptions[i].menuItem = it; CMOptions[i].buttonToggle = btn; } this.cmnuTray.MenuItems.Add(itmSep1); this.cmnuTray.MenuItems.Add(itmHide); this.cmnuTray.MenuItems.Add(toggleEnabled); this.cmnuTray.MenuItems.Add(itmSep2); this.cmnuTray.MenuItems.Add(itmExit); // add link URLs this.linkLabel1.Links.Add(0, 38, "pospi.spadgos.com/projects/cp1252fixer"); loadPrefs(); RegisterClipboardViewer(); // hide window when loading up this.Visible = false; }
private void setOption(ref optionFlag option, bool enabled) { option.active = enabled; option.menuItem.Checked = enabled; option.buttonToggle.Checked = enabled; }