/// <summary> /// Initializes MdiClient visual components. /// </summary> /// private void SetupMdiClientArea() { // Find out MDI client area between controls // this.MdiClient = null; foreach (Control child in this.Controls) { this.MdiClient = child as MdiClient; if (this.MdiClient != null) { break; } } ///////////////////////////////////////////////////////////////////////////////// // Prevent flickering, on MdiClient i.e. set ControlStyles.DoubleBuffer // for MdiClient instance using reflection (as it is not directly available). // try { BindingFlags flags = BindingFlags.NonPublic | BindingFlags.Instance; MethodInfo method = typeof(MdiClient).GetMethod("SetStyle", flags); object[] parameters = { ControlStyles.DoubleBuffer, true }; method.Invoke(MdiClient, parameters); } catch (System.Security.SecurityException) { // Ignored. Assembly doesn't have reflection permission. // This code is running under partially trusted context. } ///////////////////////////////////////////////////////////////////////////////// // Setup how MDI should look like this.MdiClient.BackColor = Color.FromArgb(0xAD, 0xA7, 0x5B); // Very Dark Khaki this.MdiClient.Paint += EH_MdClient_Paint; this.MdiClient.Resize += delegate { this.MdiClient.Invalidate(); }; }
protected virtual void ShowForm(BaseForm form, bool showTab, bool canClose) { if (form == null) { throw new ArgumentNullException(); } if (MdiClient != null) { MdiClient.ShowMdiForm(form); } else if (IsMdiContainer) { form.MdiParent = this; form.WindowState = FormWindowState.Maximized; //form.FormBorderStyle = FormBorderStyle.None; form.ControlBox = false; form.Show(); } form.TextChanged += new EventHandler(Form_TextChanged); form.Activated += new EventHandler(Form_Activated); form.FormClosed += new FormClosedEventHandler(Form_FormClosed); if (showTab && TaskBar != null) { var ti = new TabItem(); ti.Text = form.Text; ti.CanClose = canClose; ti.Tag = form; if (form is BaseForm) { ti.Icon = ((BaseForm)form).IconImage; } else { ti.Icon = PaintHelper.IconToImage(form.Icon); } TaskBar.Items.Add(ti); TaskBar.SelectedItem = ti; } if (!Forms.Contains(form)) { Forms.Add(form); } }
private void SetMdiClient() { if (!IsMdiContainer) { return; } MdiClient mdi = GetMdiClient(); if (mdi != null) { SetMdiStyles(mdi); UpdateMdiStyles(mdi); SetMdiClientLocation(mdi); } }
public Main() { InitializeComponent(); foreach (Control control in this.Controls) { MdiClient client = control as MdiClient; if (!(client == null)) { client.BackColor = Color.White; break; } } lbl_user_name.Text = BL.Users.GetUserFullname(Program.UserID).ToString(); session_date.Text = DateTime.Now.ToString(); }
/// <summary> /// Initializes a new instance of the <see cref="Slusser.Components.MdiClientController"/> class /// for the given MDI form. /// </summary> /// <param name="parentForm">The MDI form.</param> public MdiClientController(Form parentForm) { // Initialize the variables. this.site = null; this.parentForm = null; this.mdiClient = null; this.backColor = SystemColors.AppWorkspace; this.borderStyle = BorderStyle.Fixed3D; this.autoScroll = true; this.image = null; this.imageAlign = ContentAlignment.MiddleCenter; this.stretchImage = false; // Set the ParentForm property. this.ParentForm = parentForm; }
public Container() { InitializeComponent(); MdiClient myMdiClient = myGetMdiClient(); myMdiClient.Click += new EventHandler(myMdiClient_Click); Child myChild_1 = new Child("Child 1"); myChild_1.MdiParent = this; myChild_1.Show(); Child myChild_2 = new Child("Child 2"); myChild_2.MdiParent = this; myChild_2.Show(); }
private void updateStyles() { // To show style changes, the non-client area must be repainted. Using the // control's Invalidate method does not affect the non-client area. // Instead use a Win32 call to signal the style has changed. MdiClient mdiClient = getMdiClient(); NativeMethods.SetWindowPos(mdiClient.Handle, IntPtr.Zero, 0, 0, 0, 0, Win32.FlagsSetWindowPos.SWP_NOACTIVATE | Win32.FlagsSetWindowPos.SWP_NOMOVE | Win32.FlagsSetWindowPos.SWP_NOSIZE | Win32.FlagsSetWindowPos.SWP_NOZORDER | Win32.FlagsSetWindowPos.SWP_NOOWNERZORDER | Win32.FlagsSetWindowPos.SWP_FRAMECHANGED); }
public static MdiClient GetMdiClient(Form parent) { if (mdiClient != null) { return(mdiClient); } foreach (Control control in parent.Controls) { mdiClient = control as MdiClient; if (mdiClient != null) { break; } } return(mdiClient); }
private void InitilizeObjects() { // clsCloseOtherForms = new clsClose_Other_Forms(); // clsLogouts = new clsLogout(); foreach (Control control in this.Controls) { MdiClient client = control as MdiClient; if (!(client == null)) { client.BackColor = Color.White; break; } } }
private void changeColorMainForm() { //#1 foreach (Control control in this.Controls) { // #2 MdiClient client = control as MdiClient; if (!(client == null)) { // #3 client.BackColor = Color.Lavender; // 4# break; } } }
private void CarregaForm() { foreach (var control in this.Controls) { MdiClient client = control as MdiClient; if (!(client == null)) { client.BackColor = Color.White; break; } } b.Interval = 1; b.Enabled = true; b.Start(); b.Tick += new EventHandler(OnTimedEvent2); }
private void FrmMain_Load(object sender, EventArgs e) { this.Text = ConstantFlags.APP_NAME; //改变MDI父窗口背景 foreach (Control ctl in this.Controls) { try { MdiClient ctlMDI = (MdiClient)ctl; ctlMDI.BackColor = this.BackColor; } catch (Exception) { } } CheckEnableVisible_Status(); }
private void muestraControles() { foreach (Control control in this.Controls) { MdiClient client = control as MdiClient; if (!(client == null)) { client.BackColor = System.Drawing.Color.LightGray; lblusuario.Text = General.GetUsuario; lblFecha.Text = General.gFechaOp.ToString().Substring(0, 10); lblusuario1.Text = "Usuario: " + General.GetUsuario.Trim() + " | " + General.gRol_Dsc.Trim(); lblFecha1.Text = "Fecha: " + General.gFechaOp.ToString().Substring(0, 10); break; } } }
private void frmPpal_Load(object sender, EventArgs e) { MdiClient ctlMDI = default(MdiClient); foreach (Control ctl in this.Controls) { try { ctlMDI = (MdiClient)ctl; ctlMDI.BackColor = Color.White; } catch (InvalidCastException ex) { //throw new Exception(ex.Message); } } }
private void FindMdiClient() { if (this.dockManager.ParentForm == null) { return; } foreach (Control child in this.dockManager.ParentForm.Controls) { this.mdiClient = child as MdiClient; if (this.mdiClient != null) { this.mdiClient.ControlAdded += new ControlEventHandler(OnMdiClient_ControlAdded); break; } } }
// SUB NEW // ============================================================================= public frmPrincipal() { InitializeComponent(); pnlTop.BackColor = Properties.Settings.Default.PanelTopColor; lblTitulo.Text = AplicacaoTitulo; foreach (Control control in this.Controls) { MdiClient client = control as MdiClient; if (!(client == null)) { BackgroundImageLayout = ImageLayout.Zoom; client.BackgroundImage = Properties.Resources.Logo_ADRJ_Fundo; } } }
public void SetMdiBackColor() { MdiClient ctlMDI = new MdiClient(); int i = 0; for (i = 0; i <= this.Controls.Count; i++) { try { ctlMDI = (MdiClient)this.Controls[i]; ctlMDI.BackColor = this.BackColor; } catch (Exception error) { } } }
public frmPrincipal() { InitializeComponent(); foreach (Control control in this.Controls) { MdiClient client = control as MdiClient; if (!(client == null)) { client.BackColor = this.BackColor; break; } } List <String> credentials = UtilVarios.GetCredentialsFTP(); string server = credentials[0]; string user = credentials[1]; string pass = credentials[2]; }
public FrmBackground() { InitializeComponent(); this.WindowState = FormWindowState.Maximized; this.FormClosing += FrmBackground_FormClosing; foreach (Control control in this.Controls) { // #2 MdiClient client = control as MdiClient; if (!(client == null)) { // #3 client.BackColor = Color.CornflowerBlue; // 4# break; } } }
private void ValidateForm_Load(object sender, EventArgs e) { var t = typeof(MainForm); var pi = t.GetProperty("MdiClient", BindingFlags.Instance | BindingFlags.NonPublic); MdiClient cli = (MdiClient)pi.GetValue(this.MdiParent, null); Location = new Point(0, 0); Size = new Size(cli.Width - 4, cli.Height - 4); bsValidate.DataSource = validateModel; egvPorValidar.Initialize(typeof(Movimento), new List <Movimento>()); egvValidados.Initialize(typeof(Validado), new List <Validado>()); egvAnalisados.Initialize(typeof(Movimento), new List <Movimento>()); egvPorValidar.OnCellMouseMiddleClicked += EgvPorValidar_OnCellMouseRightClicked; }
private void EH_winSubCyan_KeyDown(object sender, KeyEventArgs e) { Window w = sender as Window; switch (e.KeyCode) { case Keys.Escape: w.UnloadParent(); Menu.Focus(); e.StopHandling(); break; case Keys.Enter: MdiClient.SelectNextControl(w); e.StopHandling(); break; } }
void TaskBar_SelectedItemChanged(object sender, EventArgs e) { if (TaskBar.SelectedItem != null) { Form form = TaskBar.SelectedItem.Tag as Form; if (form != null) { if (MdiClient != null) { MdiClient.ActiveMdiForm(form); } else { form.Activate(); } } } }
private void estableceFondo() { foreach (Control control in this.Controls) { // #2 MdiClient client = control as MdiClient; if (!(client == null)) { // #3 client.BackColor = Color.FromArgb(68, 114, 196); // 4# break; } } }
public MainContainer() { PathUtils.DataPath = Path.GetFullPath(@"..\..\Data"); InitializeComponent(); foreach (Control ctl in this.Controls) { if (ctl is MdiClient) { ClientArea = ctl as MdiClient; break; } } knowledgeBuilderToolStripMenuItem.Checked = true; //this.ClientSize = this.Size; }
bool IMdiClientWindow.Activate(UltraTabbedMdiManager manager, MdiClient mdiClient) { if (mdiClient == null || manager == null) { return(false); } if (this.manager == manager && mdiClient.Handle == base.Handle) { return(true); } if (base.Handle != mdiClient.Handle) { return(false); } this.manager = manager; UpdateBorderStyle(); return(true); }
public MdiClientController(Form parentForm) { // Initialize the variables. this.site = null; this.parentForm = null; this.mdiClient = null; this.borderStyle = BorderStyle.Fixed3D; this.autoScroll = true; _hook = IntPtr.Zero; _dropDownFileList = new MetroDropDownPanel(); _dropDownFileListSymbolFont = new Font("Webdings", 9); _dropDownFileListButtonState = EDropDownFileListButtonState.NORMAL; _bDropDownFileListVisible = false; // Set the ParentForm property. this.ParentForm = parentForm; }
///////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Draws MdiClient background and application version info. /// </summary> /// private void DrawMdiClientWindow() { MdiClient.BorderBackColor = Color.Black; MdiClient.BorderBackColorInact = Color.Black; MdiClient.BorderForeColor = Color.DarkCyan; MdiClient.BorderForeColorInact = Color.DarkCyan; MdiClient.BackColor = Color.Black; MdiClient.ForeColor = Color.DarkCyan; MdiClient.FillRectangle(0, 0, MdiClient.Width, MdiClient.Height, ' '); ///////////////////////////////////////////////////////////////////////////////// // Display application version info. // string info = GetVerboseVersionInfo(); TaggedTextCollection lines = TaggedText.SplitTextInLines(info); int left = MdiClient.Width - 2 - lines.MaxTextLength; int top = MdiClient.Height - 1 - lines.Count; for (int i = 0; i < lines.Count; ++i) { MdiClient.At(left, top + i).Write(lines[i].Text); } // Display information about tracing, if any. // Debug.IfTracingExecute(() => { MdiClient.ForeColor = Color.DarkMagenta; MdiClient.At(2, MdiClient.Height - 3); MdiClient.Write("Tracing to: "); MdiClient.Write(System.IO.Path.GetFileName(Debug.TraceFile.Name)); MdiClient.At(2, MdiClient.Height - 2); MdiClient.Write("Trace flags: "); MdiClient.Write(Debug.TraceFlags.Verbose()); }); }
private void ParentForm_Load(object sender, EventArgs e) { Control control = default(Control); MdiClient ctlMDI = default(MdiClient); // Loop through all of the form's controls looking for the control of type MdiClient. foreach (Control ctl in this.Controls) { try { // Attempt to cast the control to type MdiClient. ctlMDI = (MdiClient)control; } catch (InvalidCastException exc) { // Catch and ignore the error if casting failed. } } }
private void Form1_Load(object sender, EventArgs e) { foreach (Control c in this.Controls) { _mdiClient = c as MdiClient; if (_mdiClient != null) { break; } } _mdiClient.Resize += new EventHandler(_mdiClient_Resize); ShowWaterMark(); SetConnString(); Forms.MDIBackground background = new Forms.MDIBackground(); background.MdiParent = this; background.Show(); }
///////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Opens new form of FormBase subtype T in AddNew mode. /// </summary> /// private bool OpenAddNew <T> () where T : FormBase, new () { T form = null; MdiClient.IfValidateOk(() => { form = Find <T> (); // Open form if exists // if (form != null) { form.OpenForm(OpenMode.AddNew); } }); return(form != null); }
// Constructors public ControlCollection(MdiClient owner) {}