当前位置: 首页>>代码示例>>C#>>正文


C# Form类代码示例

本文整理汇总了C#中Form的典型用法代码示例。如果您正苦于以下问题:C# Form类的具体用法?C# Form怎么用?C# Form使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Form类属于命名空间,在下文中一共展示了Form类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SubmitForm

 public override void SubmitForm(Form form)
 {
     base.SubmitForm(form);
     BlockWidth = (int)form.Datas["BlockWidth"];
     BlockHeight = (int)form.Datas["BlockHeight"];
     BlockCenter = (Point)form.Datas["BlockCenter"];
 }
开发者ID:BlaisePascalSi,项目名称:PokeSi,代码行数:7,代码来源:MultiTileTile.cs

示例2: SetPdfField

 public static void SetPdfField(Form pdfForm, Dictionary<string, string> mapper, string key, string value)
 {
     if (value != null)
     {
         pdfForm.Fields[mapper[key]].Value = value;
     }
 }
开发者ID:KonstantinDavidov,项目名称:mytestRep,代码行数:7,代码来源:Utils.cs

示例3: DxCanvas

    public DxCanvas(Form form, int newWidth, int newHeight)
    {
        DX.SetUserWindow(form.Handle);
        DX.DxLib_Init();

        Resize(newWidth, newHeight);
    }
开发者ID:oxyflour,项目名称:old-repos,代码行数:7,代码来源:canvas.cs

示例4: MenuItemClickHandler

        private void MenuItemClickHandler(object sender, EventArgs e)
        {
            try
            {
                ToolStripMenuItem clickedItem = (ToolStripMenuItem)sender;

                string selectClickedForm = string.Format("SELECT [menu_id] ,[parent_menu_id],[menu_name],[form_name],[menu_level] FROM [IMS].[dbo].[menu] where menu_id='{0}'", clickedItem.Name);
                DataSet ds = dbadmin.ReturnDataSet(selectClickedForm);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    CloseAllRunForm();
                    Type type = Type.GetType("WindowsFormsApplication1." + ds.Tables[0].Rows[0][3].ToString());
                    frmObj = Activator.CreateInstance(type) as Form;
                    frmObj.MdiParent = this;

                    //frmObj1 = Activator.CreateInstance(type) as object;
                    //InsertComand = type.GetMethod("InsertComand");
                    //EditComand = type.GetMethod("EditComand");
                    //DeleteComand = type.GetMethod("DeleteComand");
                    //resize = type.GetMethod("resizeGroupBox");

                    frmObj.Show();

                }
            }
            catch (Exception)
            {

                MessageBox.Show("Form not found. ");
            }
        }
开发者ID:monzurmorshed,项目名称:POS,代码行数:31,代码来源:MainForm.cs

示例5: MainForm_Load

	void MainForm_Load (object sender, EventArgs e)
	{
		InstructionsForm instructionsForm = new InstructionsForm ();
		instructionsForm.Show ();

		Form child1 = new Form ();
		child1.BackColor = Color.Blue;
		child1.Height = 200;
		child1.MdiParent = this;
		child1.Text = "Child #1";
		child1.Show ();

		Form child2 = new Form ();
		child2.BackColor = Color.Red;
		child2.Height = 200;
		child2.MdiParent = this;
		child2.Text = "Child #2";
		child2.Show ();

		Form child3 = new Form ();
		child3.BackColor = Color.Green;
		child3.Height = 200;
		child3.MdiParent = this;
		child3.Text = "Child #3";
		child3.Show ();
	}
开发者ID:mono,项目名称:gert,代码行数:26,代码来源:MainForm.cs

示例6: Fun

        /// <summary>
        /// Included for API test stability purposes. Moves a Ranorex.Form such as a browser window down and up quickly four times.
        /// </summary>
        /// <param name="form">The Ranorex.Form to move.</param>
        protected void Fun(Form form)
        {
            int currentXCor = form.Element.ScreenLocation.X;
            int currentYCor = form.Element.ScreenLocation.Y;

            for (int l = 1; l <= 4; l++)
            {
                for (int i = 1; i <= 100; i++)
                {
                    form.Move(currentXCor + i, currentYCor + i);
                    Ranorex.Delay.Milliseconds(1);
                }

                currentXCor = form.Element.ScreenLocation.X;
                currentYCor = form.Element.ScreenLocation.Y;

                for (int i = 1; i <= 100; i++)
                {
                    form.Move(currentXCor - i, currentYCor - i);
                    Ranorex.Delay.Milliseconds(1);
                }

                currentXCor = form.Element.ScreenLocation.X;
                currentYCor = form.Element.ScreenLocation.Y;
            }
        }
开发者ID:svatarlea,项目名称:test,代码行数:30,代码来源:BrowserBasic.cs

示例7: StartFullScreen

    /// <summary>
    /// Set Full Screen Mode
    /// </summary>
    /// <param name="form"></param>
    public static void StartFullScreen(Form form)
    {
        //if not Pocket Pc platform
        if (!Platform.PlatformDetection.IsPocketPC())
        {
            //Set Full Screen For Windows CE Device

            //Normalize windows state
            form.WindowState = FormWindowState.Normal;

            IntPtr iptr = form.Handle;
            SHFullScreen(iptr, (int)FullScreenFlags.HideStartIcon);

            //detect taskbar height
            int taskbarHeight = Screen.PrimaryScreen.Bounds.Height - Screen.PrimaryScreen.WorkingArea.Height;

            // move the viewing window north taskbar height to get rid of the command
            //bar
            MoveWindow(iptr, 0, -taskbarHeight, Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height + taskbarHeight, 1);

            // move the task bar south taskbar height so that its not visible anylonger
            IntPtr iptrTB = FindWindowW("HHTaskBar", null);
            MoveWindow(iptrTB, 0, Screen.PrimaryScreen.Bounds.Height, Screen.PrimaryScreen.Bounds.Width, taskbarHeight, 1);
        }
        else //pocket pc platform
        {
            //Set Full Screen For Pocket Pc Device
            form.Menu = null;
            form.ControlBox = false;
            form.FormBorderStyle = FormBorderStyle.None;
            form.WindowState = FormWindowState.Maximized;
            form.Text = string.Empty;
        }
    }
开发者ID:partizanes,项目名称:INVENTORY_V2,代码行数:38,代码来源:FullScreen.cs

示例8: InitializeComponent

public void InitializeComponent()
{
this.frm = new Form();
this.frm.Size = new Size(800, 800);
this.ClientSize = new Size(800, 800);
this.Paint += new PaintEventHandler(rect_paint);
}
开发者ID:EdiCarlos,项目名称:MyPractices,代码行数:7,代码来源:rectangle.cs

示例9: Page_Loaded

 private void Page_Loaded(object sender, RoutedEventArgs e)
 {
     frm = new Form();
     frm.Navigation(this.LayoutRoot);
     txtName.Focus();
   
 }
开发者ID:sajidk,项目名称:Estimate-SL,代码行数:7,代码来源:UILogin.xaml.cs

示例10: ShowDialog

 public static string ShowDialog(string baseSite,string text, string caption)
 {
     Form prompt = new Form();
     string resultURL="";
     prompt.Width = 600;
     prompt.Height = 420;
     prompt.Text = caption;
     
     Label textLabel = new Label() { Left = 10, Top=10, Width=580, Text=text };
     ListBox lbCounty = new ListBox() { Left = 10, Top=40, Width=250, Height = 340, DisplayMember = "Label" };
     Button confirmation = new Button() { Text = "Ok", Left=370, Width=100, Top=350 };
     Button cancel = new Button() { Text = "Cancel", Left=480, Width=100, Top=350 };
     
     confirmation.Click += (sender, e) => {
             if(lbCounty.SelectedItem!=null) {resultURL=lbCounty.SelectedItem.ToString();}
             prompt.Close();
         };
     lbCounty.DoubleClick += (sender, e) => { confirmation.PerformClick();};
     cancel.Click += (sender, e) => { resultURL = "";prompt.Close(); };
     
     prompt.Controls.Add(confirmation);
     prompt.Controls.Add(cancel);
     prompt.Controls.Add(textLabel);
     prompt.Controls.Add(lbCounty);
     
     FillLbCounty(lbCounty,baseSite);
     
     prompt.ShowDialog();
     return resultURL;
 }
开发者ID:gahadzikwa,项目名称:GAPP,代码行数:30,代码来源:Update+Archived+from+Xylanthrop.cs

示例11: listView1_DoubleClick

 private void listView1_DoubleClick(object sender, EventArgs e)
 {
     Form f = new Form();
     ListView lv = new ListView();
     lv.Columns.Add("Value", 500);
     foreach (string item in listView1.SelectedItems[0].SubItems[1].Text.Split(';'))
     {
         lv.Items.Add(item);
     }
     lv.DoubleClick += (sender2, e2) =>
         {
             ListView lv2 = (ListView)sender2;
             string path = lv2.SelectedItems[0].Text;
             if (!System.IO.Directory.Exists(path))
             {
                 return;
             }
             System.Diagnostics.Process.Start("explorer.exe", path);
         };
     lv.View = View.Details;
     lv.Dock = DockStyle.Fill;
     f.Controls.Add(lv);
     f.Text = listView1.SelectedItems[0].Text;
     f.ShowDialog();
 }
开发者ID:coq12,项目名称:EnvironmentVariableViewer,代码行数:25,代码来源:Form1.cs

示例12: Main

	public static void Main ()
	{
		int x = 25;

		foreach (FormBorderStyle style in Enum.GetValues (typeof(FormBorderStyle))) {
			Form f1 = new Form();
			f1.FormBorderStyle = style;
			f1.Location = new Point (x, 25);
			f1.Size = new Size (200, 200);
			f1.StartPosition = FormStartPosition.Manual;
			f1.Menu = CreateMenu ("");
			f1.Text = style.ToString ();
			
			f1.Show ();					
			
			x += f1.Width + 25;
		}
		
		Form mdi = new Form ();
		Form child = new Form ();
		mdi.IsMdiContainer = true;
		mdi.StartPosition = FormStartPosition.Manual;
		mdi.Location = new Point (25, 250);
		mdi.Size = new Size (600, 400);
		mdi.Menu = CreateMenu ("Main ");
		child.MdiParent = mdi;
		child.StartPosition = FormStartPosition.Manual;
		child.Location = new Point (25, 25);
		child.Size = new Size (200, 200);
		child.Menu = CreateMenu ("Child ");			
		child.Show ();
		Application.Run (mdi);
	}
开发者ID:hitswa,项目名称:winforms,代码行数:33,代码来源:swf-menus.cs

示例13: DoValidate

		/// <summary>
		/// Validates the state of this control.
		/// </summary>
		/// <param name="context">The <see cref="IMansionWebContext"/>.</param>
		/// <param name="form">The <see cref="Form"/> to which this control belongs.</param>
		/// <param name="results">The <see cref="ValidationResults"/> in which the validation results are stored.</param>
		protected override void DoValidate(IMansionWebContext context, Form form, ValidationResults results)
		{
			// loop over all the controls
			foreach (var control in FormControls)
				control.Validate(context, form, results);
			base.DoValidate(context, form, results);
		}
开发者ID:Erikvl87,项目名称:Premotion-Mansion,代码行数:13,代码来源:FormControlContainer.cs

示例14: Main

    public static void Main()
    {
        Form fm = new Form();
        fm.Text = "チャプター3";

        fm.Width = 600;
        fm.Height = 600;

        Label lb = new Label();
        lb.Text = "真ん中に表示するテキスト";

        lb.Top = (fm.Height - lb.Height) / 2;
        lb.Left = (fm.Width - lb.Width) /2;

        Label lb1 = new Label();
        Label lb2 = new Label();

        lb1.Text = "左詰め";
        lb2.Text = "+100";
        lb2.Left = lb1.Width + 100;

        lb.Parent = fm;
        lb1.Parent = fm;
        lb2.Parent = fm;

        Application.Run(fm);
    }
开发者ID:uwan,项目名称:C-Primer,代码行数:27,代码来源:CodeFile1.cs

示例15: Main

    public static void Main()
    {
        Form form = new Form();
        form.Controls.Add(GetRichTextBox("kasddddd sfasd asd\n fasdfas"));

        Application.Run(form);
    }
开发者ID:numerodix,项目名称:solarbeam,代码行数:7,代码来源:SelectionTest.cs


注:本文中的Form类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。