當前位置: 首頁>>代碼示例>>C#>>正文


C# Form.GetType方法代碼示例

本文整理匯總了C#中System.Windows.Forms.Form.GetType方法的典型用法代碼示例。如果您正苦於以下問題:C# Form.GetType方法的具體用法?C# Form.GetType怎麽用?C# Form.GetType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Windows.Forms.Form的用法示例。


在下文中一共展示了Form.GetType方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: AddForm

        public void AddForm(Form form)
        {
            if (_forms.ContainsKey(form.GetType()))
            {
                var formValues = _forms[form.GetType()];
                if (!formValues.Any(x => x == form))
                {
                    formValues.Add(form);
                }
            }
            else
            {
                _forms.Add(form.GetType(), new List<Form>() { form });
            }

            if (!_isPageRemovedEventAttached)
            {
                var pageTab = form.Parent as RadPageViewPage;
                if (pageTab != null)
                {
                    pageTab.Owner.PageRemoved += OwnerOnPageRemoved;
                }
                _isPageRemovedEventAttached = true;
            }
        }
開發者ID:silviaeaguilar,項目名稱:SistemaGestion,代碼行數:25,代碼來源:FormRegistry.cs

示例2: addSubfomHelper_

 Form addSubfomHelper_(Form par)
 {
     if(!windows_.ContainsKey(par.GetType()))
       {
     windows_.Add(par.GetType(),new ArrayList());
       }
       ArrayList storage = windows_[par.GetType()];
       storage.Add(par);
       return par;
 }
開發者ID:alexshemesh,項目名稱:ManagmentApp,代碼行數:10,代碼來源:MainWindow.cs

示例3: RestoreWindow

 static protected void RestoreWindow(Form aForm) {
     bool xShowForm = true;
     //http://social.msdn.microsoft.com/forums/en-US/winforms/thread/72b2edaf-0719-4d22-885e-48d643dc626b
     var x = Settings.DS.Window.FindByName(aForm.GetType().Name);
     if (x != null) {
         if (!x.IsLeftNull()) {
             aForm.Left = x.Left;
         }
         if (!x.IsTopNull()) {
             aForm.Top = x.Top;
         }
         if (!x.IsWidthNull()) {
             aForm.Width = x.Width;
         }
         if (!x.IsHeightNull()) {
             aForm.Height = x.Height;
         }
         // On load the often end up behind other apps, so we do this to force them up on first show
         if (!x.IsVisibleNull()) {
             // Technically we should do this if any size exists, generally
             // they should be all present or all missing. so we just use
             // this one attribute for now.
             aForm.StartPosition = FormStartPosition.Manual;
             xShowForm = x.Visible;
         }
     }
     if (xShowForm) {
         Show(aForm);
     }
 }
開發者ID:ChrisJamesSadler,項目名稱:Cosmos,代碼行數:30,代碼來源:Windows.cs

示例4: MobsModelChoice

 public MobsModelChoice(Form Window, TextBox Form)
 {
     if (Window.GetType() == typeof(LoadNPCTemplate))
     {
         loadNPCTemplateWindow = Window as LoadNPCTemplate;
         NPCTemplateModelTextBox = Form;
         this.Text = "NPCTemplate Models Chooser";
     }
     else if (Window.GetType() == typeof(LoadMob))
     {
         loadMobWindow = Window as LoadMob;
         MobModelTextBox = Form;
         this.Text = "Mob Model Chooser";
     }
     InitializeComponent();
 }
開發者ID:Dawn-of-Light,項目名稱:DolServerEditor,代碼行數:16,代碼來源:MobsModelChoice.cs

示例5: GetSettings

 public static CtrlSettings GetSettings(Form form)
 {
     Lewis.SST.Settings.CtrlSettings cs = null;
     if (form != null)
     {
         try
         {
             cs = new Lewis.SST.Settings.CtrlSettings(form.GetType().ToString());
             if (typeof(Lewis.SST.Gui.Main).IsInstanceOfType(form))
             {
                 cs.LastDirectory = ((Lewis.SST.Gui.Main)form).LastDirectory;
             }
             cs.Name = form.Name;
             cs.Location = form.Location;
             cs.Size = form.Size;
             ArrayList arl = WalkControls(form.Controls);
             if (arl != null && arl.Count > 0)
             {
                 cs.ChildCtrlsToPersist = (Lewis.SST.Settings.CtrlSettings[])arl.ToArray(typeof(Lewis.SST.Settings.CtrlSettings));
             }
         }
         catch (Exception ex)
         {
             logger.Error(SQLSchemaTool.ERRORFORMAT, ex.Message, ex.Source, ex.StackTrace);
         }
     }
     return cs;
 }
開發者ID:ViniciusConsultor,項目名稱:sqlschematool,代碼行數:28,代碼來源:XmlSettings.cs

示例6: LocalizeForm

 private static void LocalizeForm(Form frm)
 {
     var manager = new ComponentResourceManager(frm.GetType());
     manager.ApplyResources(frm, "$this");
     ApplyResources(manager, frm.Controls);
     
 }
開發者ID:MGnuskina,項目名稱:Tasks,代碼行數:7,代碼來源:CanvasLocalization.cs

示例7: ProcessDeletion

        private static void ProcessDeletion(Form AMainWindow, Int64 AConferenceKey, string AConferenceName)
        {
            TVerificationResultCollection VerificationResult;
            MethodInfo method;

            if (!TRemote.MConference.Conference.WebConnectors.DeleteConference(AConferenceKey, out VerificationResult))
            {
                MessageBox.Show(
                    string.Format(Catalog.GetString("Deletion of Conference '{0}' failed"), AConferenceName) + "\r\n\r\n" +
                    VerificationResult.BuildVerificationResultString(),
                    Catalog.GetString("Deletion failed"),
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
            }
            else
            {
                MessageBox.Show(
                    string.Format(Catalog.GetString("Conference '{0}' has been deleted"), AConferenceName),
                    Catalog.GetString("Deletion successful"),
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information);
            }

            method = AMainWindow.GetType().GetMethod("ShowCurrentConferenceInfoInStatusBar");

            if (method != null)
            {
                method.Invoke(AMainWindow, new object[] { });
            }
        }
開發者ID:Davincier,項目名稱:openpetra,代碼行數:30,代碼來源:DeleteConference.cs

示例8: Manage

		/// <summary>
		/// Instructs the listener to manage the specified form
		/// </summary>
		/// <param name="f">The form to manage</param>
		/// <param name="key">The key under which this form's settings will be saved</param>
		/// <param name="restore">A flag that indicates whether the form's state should be initially restored</param>
		/// <returns></returns>
		public bool Manage(Form f, string key, bool restore)
		{	
			// save the form reference		
			_form = f;
			_key  = key;
			_restore = restore;

			// format a path to this form's data
			_path = System.IO.Path.Combine(_path, f.GetType().FullName);
			_path = System.IO.Path.Combine(_path, key);
			
			// bind the the form's relevent events			
			f.Load += new EventHandler(OnLoad);
			f.SizeChanged += new EventHandler(OnSizeChanged);
			f.LocationChanged += new EventHandler(OnLocationChanged);
			f.Move += new EventHandler(OnMove);
			f.Closed += new EventHandler(OnClosed);

			// start out with updated information
			this.GleamWindowData();

			// if we need to
			if (restore && f.Visible)
			{
				// immediately restore the form's information
				this.ReadWindowData();
				this.ApplyWindowData();
			}
			return true;
		}
開發者ID:FireBall1725,項目名稱:Razor.Framework,代碼行數:37,代碼來源:WindowPositionListener.cs

示例9: InstanceFormChild

        public static void InstanceFormChild(Form frmChild, Form frmParent, bool modal)
        {
            if (frmParent != null)
                foreach (var item in frmParent.MdiChildren)
                {
                    if (item.GetType() == frmChild.GetType())
                    {
                        frmChild.Focus();
                        frmChild.BringToFront();
                        frmChild.Activate();
                        return;
                    }
                }

            frmChild.ShowInTaskbar = false;

            if (modal)
            {
                frmChild.TopLevel = true;
                frmChild.ShowDialog();
            }
            else
            {
                if (frmParent != null)
                    frmChild.MdiParent = frmParent;

                frmChild.Show();
            }
        }
開發者ID:tonfranco,項目名稱:LR,代碼行數:29,代碼來源:FormUtil.cs

示例10: ProcessDeletion

        private static void ProcessDeletion(Form AMainWindow, Int32 ALedgerNumber, string ALedgerNameAndNumber)
        {
            TVerificationResultCollection VerificationResult;
            MethodInfo method;

            if (!TRemote.MFinance.Setup.WebConnectors.DeleteLedger(ALedgerNumber, out VerificationResult))
            {
                MessageBox.Show(
                    string.Format(Catalog.GetString("Deletion of Ledger '{0}' failed"), ALedgerNameAndNumber) + "\r\n\r\n" +
                    VerificationResult.BuildVerificationResultString(),
                    Catalog.GetString("Deletion failed"),
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
            }
            else
            {
                MessageBox.Show(
                    string.Format(Catalog.GetString("Ledger '{0}' has been deleted"), ALedgerNameAndNumber),
                    Catalog.GetString("Deletion successful"),
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information);
            }

            method = AMainWindow.GetType().GetMethod("ShowCurrentLedgerInfoInStatusBar");

            if (method != null)
            {
                method.Invoke(AMainWindow, new object[] { });
            }
        }
開發者ID:Davincier,項目名稱:openpetra,代碼行數:30,代碼來源:DeleteLedger.cs

示例11: CloseAllWindows

        /// <summary>
        /// 關閉窗體及其所有的屬性中定義的窗體
        /// </summary>
        /// <param name="form">窗體</param>
        /// <returns>屬性中定義的窗體是否已經全部關閉</returns>
        public static bool CloseAllWindows(Form form)
        {
            bool result = true;

            try // 獲取屬性的過程可能會產生異常
            {
                Type t = form.GetType();
                foreach (PropertyInfo pi in t.GetProperties()) // 用反射獲取窗體的所有屬性,並將屬性窗體關閉
                {
                    object o = t.InvokeMember(pi.Name, BindingFlags.GetProperty, null, form, null);
                    if (o is Form) // 窗口屬性
                    {
                        Form newForm = o as Form;
                        if (newForm != null)
                        {
                            newForm.Close();
                            if (!newForm.IsDisposed && newForm.Visible) // 部分窗口如表元編輯器,隻隱藏沒關閉,需要做特殊判斷
                            {
                                result = false;
                                break;
                            }
                        }
                    }
                }
            }
            catch { } // 忽略異常

            if(result) // 所有窗體屬性已經成功關閉
            {
                IntPtr ptr = FindWindow(null, form.Text);
                PostMessage(ptr, 0x10, IntPtr.Zero, null);
            }

            return result;
        }
開發者ID:viticm,項目名稱:pap2,代碼行數:40,代碼來源:Helper.cs

示例12: PFTableForm

 public PFTableForm(Form parent)
 {
     InitializeComponent();
     if (parent.GetType() == typeof(ApplicationForm))
     {
         this.parent = parent as ApplicationForm;
     }
 }
開發者ID:Igonina,項目名稱:RadugaTour,代碼行數:8,代碼來源:PFTableForm.cs

示例13: showFormInfo

 public static void showFormInfo(Form form)
 {
     StringBuilder str = new StringBuilder();
     str.Append("Tên lớp: " + form.GetType().FullName);
     str.AppendLine();
     str.Append("Màn hình public: " + (form is IPublicForm ? "Có" : "Không"));
     HelpDebug.ShowString(str.ToString());
 }
開發者ID:khanhdtn,項目名稱:my-fw-win,代碼行數:8,代碼來源:RightClickTitleBarHelper.cs

示例14: RemoveForm

		public void RemoveForm(Form form)
		{
			var type = form.GetType();
			if (_allForms.ContainsKey(type) == false)
				return;

			_allForms[type].Remove(form);
		}
開發者ID:josh-jeong,項目名稱:Rhyme.Tools,代碼行數:8,代碼來源:frmMainContainer.cs

示例15: LocalizeControls

		public void LocalizeControls(Form form)
		{
			XmlNode controlsNode = this.langDoc.SelectSingleNode("//" + form.Name + "/Controls");
			if(controlsNode == null)
			{
				return;
			}
			foreach(XmlNode node in controlsNode.ChildNodes)
			{
				if(node.HasChildNodes && node.FirstChild.NodeType != XmlNodeType.Text)
				{
					FieldInfo fi = form.GetType().GetField(
						node.Name,
						BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
					PropertyInfo items = fi.FieldType.GetProperty("Items");
					MethodInfo clear = items.PropertyType.GetMethod("Clear");
					clear.Invoke(items.GetValue(fi.GetValue(form),null),null);
					foreach(XmlNode itemNode in node.ChildNodes)
					{
						MethodInfo add = items.PropertyType.GetMethod("Add");
						object [] addParams = new object[1];
						addParams[0] = itemNode.InnerText;
						add.Invoke(items.GetValue(fi.GetValue(form),null),addParams);
					}
					if(node.Attributes["ToolTipText"] != null)
					{
						PropertyInfo pi = fi.FieldType.GetProperty("ToolTipText");
						pi.SetValue(fi.GetValue(form),node.Attributes["ToolTipText"].Value,null);
					}
				}
				else if(node.NodeType != XmlNodeType.Comment)
				{
					if(node.InnerText != string.Empty)
					{
						if(node.Name.ToUpper() == "SELF")
						{
							form.Text = node.InnerText;
						}
						else
						{
							FieldInfo fi = form.GetType().GetField(
								node.Name,
								BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
							PropertyInfo pi = fi.FieldType.GetProperty("Text");
							pi.SetValue(fi.GetValue(form),node.InnerText,null);
						}
					}
					if(node.Attributes["ToolTipText"] != null)
					{
						FieldInfo fi = form.GetType().GetField(
							node.Name,
							BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
						PropertyInfo pi = fi.FieldType.GetProperty("ToolTipText");
						pi.SetValue(fi.GetValue(form),node.Attributes["ToolTipText"].Value,null);
					}
				}
			}
		}
開發者ID:xuchuansheng,項目名稱:GenXSource,代碼行數:58,代碼來源:Localizer.cs


注:本文中的System.Windows.Forms.Form.GetType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。