private static void UpdateOpenedWindowsToolStrip(FormWithKey form, string addedText) { ToolStripButton item = new ToolStripButton(); item.Text = form.Text; item.DisplayStyle = ToolStripItemDisplayStyle.Image; item.ImageTransparentColor = System.Drawing.Color.Magenta; item.Name = MakeToolBarItemName(form); item.Tag = form; item.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText; item.Click += new EventHandler(item_Click); m_openedWindowToolStrip.Items.Add(item); }
private static void AssignParameters(ref FormWithKey form, params object[] parameters) { Type type = form.GetType(); if (parameters != null) { for (int i = 0; i < parameters.Length; i += 2) { PropertyInfo propertyInfo = type.GetProperty(parameters[i].ToString()); if (propertyInfo != null && propertyInfo.CanWrite) propertyInfo.SetValue(form, parameters[i + 1], null); } } }
private static string MakeToolBarItemName(FormWithKey form) { return String.Format("{0}.Item", form.Key == null ? form.Name : form.Key); }
private static void AssignEventHandlers(FormWithKey form) { form.FormClosed += new FormClosedEventHandler(formClosed); form.Activated += new EventHandler(form_Activated); form.Deactivate += new EventHandler(form_Deactivate); }