示例#1
0
文件: MnuFrm.cs 项目: markup007/Roys
        void sub_Click(object sender, EventArgs e)
        {
            _idleTime = DateTime.Now;
            foreach (Form f in Application.OpenForms)
            {
                if (f.Name == "CB_002" && ((System.Windows.Forms.ToolStripDropDownItem)(sender)).Tag.ToString() == "CB_002")
                {
                    PLABS.MessageBoxPL.Show("Multiple Instances Cannot Be Allowed For This Window");
                    goto last;
                }
            }
            //throw new NotImplementedException();
            String FormId      = "RoysGold." + ((System.Windows.Forms.ToolStripDropDownItem)(sender)).Tag.ToString();
            String FormCaption = ((System.Windows.Forms.ToolStripDropDownItem)(sender)).Text;

            PLABS.MasterForm frm = new PLABS.MasterForm();

            Type tp = Type.GetType(FormId);

            if (tp != null)
            {
                frm               = ((PLABS.MasterForm)Activator.CreateInstance(tp));
                frm.MdiParent     = this;
                frm.Text          = FormCaption;
                frm.Location      = new Point(1, 1);
                frm.StartPosition = FormStartPosition.Manual;

                frm.Show();
                frm.BringToFront();
            }
last:
            int i = 0;
        }
示例#2
0
文件: MnuFrm.cs 项目: markup007/Roys
        void MnuFrm_KeyDown(object sender, KeyEventArgs e)
        {
            _idleTime = DateTime.Now;
            if (e.KeyCode == Keys.F12)
            {
                //DD_001 objdd001 = new DD_001();
                //objdd001.ShowDialog();
                //objdd001.Close();
            }
            else if (e.Modifiers == Keys.Control && e.KeyCode == Keys.T)
            {
                GT_001 obj = new GT_001();
                obj.ShowDialog();
            }
            else
            {
                DataRow[] dr = dt.Select(string.Format("Key='{0}'", e.KeyCode.ToString()), "");
                if (dr.Length != 0)
                {
                    String           FormId      = "RoysGold." + dr[0]["frm_nam"].ToString();
                    String           FormCaption = dr[0]["frm_desc"].ToString();
                    PLABS.MasterForm frm         = new PLABS.MasterForm();

                    Type tp = Type.GetType(FormId);
                    if (tp != null)
                    {
                        frm               = ((PLABS.MasterForm)Activator.CreateInstance(tp));
                        frm.MdiParent     = this;
                        frm.Text          = FormCaption;
                        frm.Location      = new Point(1, 1);
                        frm.StartPosition = FormStartPosition.Manual;

                        frm.Show();
                        frm.BringToFront();
                    }
                }
            }
        }