コード例 #1
0
ファイル: MainFormGUI.cs プロジェクト: complabs/TextUI
    /// <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();
        };
    }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
        private void SetMdiClient()
        {
            if (!IsMdiContainer)
            {
                return;
            }

            MdiClient mdi = GetMdiClient();

            if (mdi != null)
            {
                SetMdiStyles(mdi);
                UpdateMdiStyles(mdi);
                SetMdiClientLocation(mdi);
            }
        }
コード例 #4
0
        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();
        }
コード例 #5
0
        /// <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;
        }
コード例 #6
0
        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();
        }
コード例 #7
0
        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);
        }
コード例 #8
0
ファイル: StickyWindow.cs プロジェクト: dlech/NXTCamView
 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);
 }
コード例 #9
0
        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;
                }
            }
        }
コード例 #10
0
 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;
         }
     }
 }
コード例 #11
0
        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);
        }
コード例 #12
0
        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();
        }
コード例 #13
0
        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;
                }
            }
        }
コード例 #14
0
ファイル: frmPpal.cs プロジェクト: aaraujo2019/PEQMIMERIA
        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);
                }
            }
        }
コード例 #15
0
        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;
                }
            }
        }
コード例 #16
0
        // 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;
                }
            }
        }
コード例 #17
0
        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)
                {
                }
            }
        }
コード例 #18
0
 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];
 }
コード例 #19
0
 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;
         }
     }
 }
コード例 #20
0
        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;
        }
コード例 #21
0
ファイル: TestClient_TUI.cs プロジェクト: complabs/TextUI
        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;
            }
        }
コード例 #22
0
 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();
             }
         }
     }
 }
コード例 #23
0
ファイル: MainFrm.cs プロジェクト: hugoaraujor/GoldenAures
      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;
              }
          }
      }
コード例 #24
0
        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;
        }
コード例 #25
0
 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);
 }
コード例 #26
0
            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;
            }
コード例 #27
0
ファイル: MainFormTextUI.cs プロジェクト: complabs/TextUI
    /////////////////////////////////////////////////////////////////////////////////////

    /// <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());
        });
    }
コード例 #28
0
ファイル: ParentForm.cs プロジェクト: ntokozo-shagala/SIMS
        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.
                }
            }
        }
コード例 #29
0
ファイル: Form1.cs プロジェクト: matija-horvat/Bills2
        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();
        }
コード例 #30
0
ファイル: MainFormMdi.cs プロジェクト: complabs/TextUI
    /////////////////////////////////////////////////////////////////////////////////////

    /// <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) {}