private static void formatControlInForms( string ip_str_form_name, IControlerControl i_objControlerControl, System.Windows.Forms.Control ip_control) { //If (ip_control.ToString().IndexOf("SIS.Controls.Button.SiSButton") >= 0) Then // If (i_objControlerControl.CanUseControl(ip_str_form_name, ip_control.Name, "") = False) Then // ip_control.Visible = False // ip_control.Enabled = False // End If //End If if (ip_control is Label) { ip_control.Font = getRegularFont(); ip_control.ForeColor = getSpecialForeColor(); ip_control.BackColor = getRegularBackColor(); } else if (ip_control is TextBox) { ip_control.Font = getRegularFont(); ip_control.ForeColor = getRegularForeColor(); } else if (ip_control is GroupBox) { ip_control.Font = getBoldFont(); ip_control.ForeColor = getSpecialForeColor(); ip_control.BackColor = getRegularBackColor(); } else if (ip_control is ComboBox) { ip_control.Font = getRegularFont(); ip_control.ForeColor = getRegularForeColor(); } else if (ip_control is CheckBox) { ip_control.Font = getRegularFont(); ip_control.ForeColor = getRegularForeColor(); } else if (ip_control is DateTimePicker) { ip_control.Font = getRegularFont(); ip_control.ForeColor = getRegularForeColor(); } else if (ip_control is Button) { ip_control.Font = getBoldFont(); ip_control.ForeColor = getSpecialForeColor(); if (i_objControlerControl.CanUseControl(ip_str_form_name, ip_control.Name, "") == false) { ip_control.Visible = false; ip_control.Enabled = false; } } else if (ip_control is DateTimePicker) { ((DateTimePicker) ip_control).CalendarForeColor = getRegularForeColor(); ((DateTimePicker) ip_control).CalendarTitleForeColor = getRegularForeColor(); ((DateTimePicker) ip_control).CalendarTrailingForeColor = getRegularForeColor(); } else if (ip_control is MenuStrip) { ToolStripMenuItem v_obj_tool_strip = default(ToolStripMenuItem); foreach (ToolStripMenuItem tempLoopVar_v_obj_tool_strip in ((MenuStrip) ip_control).Items) { v_obj_tool_strip = tempLoopVar_v_obj_tool_strip; formatToolStripMenuItem(ip_str_form_name, i_objControlerControl, v_obj_tool_strip); } } if (ip_control is TabControl) { ip_control.Font = getRegularFont(); ip_control.ForeColor = getRegularForeColor(); } System.Windows.Forms.Control v_control = default(System.Windows.Forms.Control); foreach (System.Windows.Forms.Control tempLoopVar_v_control in ip_control.Controls) { v_control = tempLoopVar_v_control; formatControlInForms(ip_str_form_name, i_objControlerControl, v_control); } }
private static void formatToolStripMenuItem( string ip_str_form_name, IControlerControl i_objControlerControl, System.Windows.Forms.ToolStripMenuItem ip_obj_toolstripMenuItem) { if (i_objControlerControl.CanUseControl(ip_str_form_name, ip_obj_toolstripMenuItem.Name, "") == false) { //v_obj_tool_strip.Visible = False ip_obj_toolstripMenuItem.Enabled = false; } else { ToolStripMenuItem v_obj_tool_strip = default(ToolStripMenuItem); foreach (ToolStripMenuItem tempLoopVar_v_obj_tool_strip in ip_obj_toolstripMenuItem.DropDownItems) { v_obj_tool_strip = tempLoopVar_v_obj_tool_strip; formatToolStripMenuItem(ip_str_form_name, i_objControlerControl, v_obj_tool_strip); } } }
public static void setFormStyle(Form i_form, IControlerControl i_objControlerControl, IPFormStyle i_form_style = IPFormStyle.DialogForm) { try { i_form.KeyDown += i_form_KeyDown; System.Windows.Forms.Control v_Control; i_form.KeyPreview = true; Form with_1 = i_form; //.AutoScaleBaseSize = New System.Drawing.Size(6, 15) with_1.BackColor = getRegularBackColor(); with_1.Font = getRegularFont(); with_1.ForeColor = getRegularForeColor(); switch (i_form_style) { case IPFormStyle.DialogForm: with_1.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; with_1.MaximizeBox = false; with_1.MinimizeBox = false; with_1.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; with_1.ShowInTaskbar = true; break; case IPFormStyle.DockableTopForm: with_1.FormBorderStyle = FormBorderStyle.Sizable; with_1.MaximizeBox = true; with_1.MinimizeBox = true; with_1.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; with_1.ShowInTaskbar = false; break; default: break; } //.ResumeLayout(False) //Tund sửa ngày 11/06/2008 formatControlInForms(i_form.Name, i_objControlerControl, i_form); } catch (Exception exp) { MessageBox.Show(exp.Message, i_form.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Stop); } finally { } }