本文整理汇总了C#中Form类的典型用法代码示例。如果您正苦于以下问题:C# Form类的具体用法?C# Form怎么用?C# Form使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Form类属于命名空间,在下文中一共展示了Form类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: CleaniREB
public void CleaniREB()
{
MDIMain.dfuinstructions.Visible = false;
MDIMain.dfuinstructionstxt.Visible = false;
MDIMain.blue.Visible = false;
MDIMain.Button1.Visible = false;
BackgroundWorker1.Dispose();
BackgroundWorker2.Dispose();
// Display a child form.
Form frm = new Form();
frm.MdiParent = MDIMain;
frm.Width = this.Width / 2;
frm.Height = this.Height / 2;
frm.Show();
frm.Hide();
Welcome.MdiParent = MDIMain;
Welcome.Show();
Welcome.Button1.Enabled = false;
About.MdiParent = MDIMain;
About.Show();
About.BringToFront();
MDIMain.done.Enabled = false;
MDIMain.done.Checked = false;
MDIMain.donetxt.ForeColor = Color.DimGray;
this.Dispose();
}
开发者ID:bobbytdotcom,项目名称:iFaith,代码行数:28,代码来源:DFU.cs
示例17: AiDemo
public AiDemo(Control paramGameController, Form paramPongGameForm)
{
pongGameForm = paramPongGameForm;
gameController = paramGameController;
picBoxAI1 = new PictureBox();//
picBoxAI2 = new PictureBox();//Initializes the PictureBoxes
picBoxBall = new PictureBox();//
gameTime = new Timer();//Initializes the Timer
gameTime.Enabled = true;//Enables the Timer
gameTime.Interval = iGameTimeInterval;//Set the timer's interval
gameTime.Tick += new EventHandler(gameTime_Tick);//Creates the Timer's Tick event
pongGameForm.StartPosition = FormStartPosition.CenterScreen;//opens the form in center of the screen
picBoxAI1.Size = sizePlayer;//sets the size of the picturebox
picBoxAI1.Location = new Point(picBoxAI1.Width / 2, pongGameForm.Height / 2 - picBoxAI1.Height / 2);//sets it's location (centered)
picBoxAI1.BackColor = Color.Blue;//fills the picturebox with a color
gameController.Controls.Add(picBoxAI1);//adds the picture box to the form
picBoxAI2.Size = sizeAI;
picBoxAI2.Location = new Point(pongGameForm.Width - (picBoxAI2.Width + picBoxAI2.Width / 2), pongGameForm.Height / 2 - picBoxAI1.Height / 2);
picBoxAI2.BackColor = Color.Red;
gameController.Controls.Add(picBoxAI2);
picBoxBall.Size = sizeBall;
picBoxBall.Location = new Point(pongGameForm.Width / 2 - picBoxBall.Width / 2, pongGameForm.Height / 2 - picBoxBall.Height / 2);
picBoxBall.BackColor = Color.Green;
gameController.Controls.Add(picBoxBall);
}
开发者ID:h3rska,项目名称:.NetPongGame,代码行数:33,代码来源:AiDemoAlgorithms.cs
示例18: CreateEditableGridControl
protected override IEditableGridControl CreateEditableGridControl()
{
EditableGridControlVWG editableGridControlVWG = new EditableGridControlVWG(GetControlFactory());
Form frm = new Form();
frm.Controls.Add(editableGridControlVWG);
return GetControlledLifetimeFor(editableGridControlVWG);
}
开发者ID:Chillisoft,项目名称:habanero.faces,代码行数:7,代码来源:TestEditableGridControlVWG.cs
示例19: CSharpPendulum
public CSharpPendulum()
{
_form = new Form() { Text = "Pendulum", Width = 200, Height = 200 };
_timer = new Timer() { Interval = 30 };
_timer.Tick += delegate(object sender, EventArgs e)
{
int anchorX = (_form.Width / 2) - 12,
anchorY = _form.Height / 4,
ballX = anchorX + (int)(Math.Sin(_angle) * _length),
ballY = anchorY + (int)(Math.Cos(_angle) * _length);
_angleAccel = -9.81 / _length * Math.Sin(_angle);
_angleVelocity += _angleAccel * _dt;
_angle += _angleVelocity * _dt;
Bitmap dblBuffer = new Bitmap(_form.Width, _form.Height);
Graphics g = Graphics.FromImage(dblBuffer);
Graphics f = Graphics.FromHwnd(_form.Handle);
g.DrawLine(Pens.Black, new Point(anchorX, anchorY), new Point(ballX, ballY));
g.FillEllipse(Brushes.Black, anchorX - 3, anchorY - 4, 7, 7);
g.FillEllipse(Brushes.DarkGoldenrod, ballX - 7, ballY - 7, 14, 14);
f.Clear(Color.White);
f.DrawImage(dblBuffer, new Point(0, 0));
};
_timer.Start();
Application.Run(_form);
}
开发者ID:travis1230,项目名称:RosettaCodeData,代码行数:31,代码来源:animate-a-pendulum.cs
示例20: Main
public void Main(string ApplicationPath, string[] Args)
{
Form frmPacman = new Form("frmPacman");
frmPacman.ButtonPressed += frmPacman_ButtonPressed;
Bitmap bmpGame;
Picturebox pbGame;
bmpGame = new Bitmap(320, 240);
if (Prompt.Show("Resolution Adjust", "Would you like to play at 640x480?", Fonts.Calibri18Bold, Fonts.Calibri14, PromptType.YesNo) == PromptResult.Yes)
{
pbGame = new Picturebox("pbGame", bmpGame, frmPacman.Width / 2 - 320, frmPacman.Height / 2 - 240, 640, 480, BorderStyle.BorderNone);
pbGame.ScaleMode = ScaleMode.Stretch;
}
else
pbGame = new Picturebox("pbGame", bmpGame, frmPacman.Width / 2 - 160, frmPacman.Height / 2 - 140, BorderStyle.BorderNone);
pbGame.Background = Colors.Black;
game = new PacmanGame(bmpGame, pbGame);
frmPacman.AddControl(pbGame);
Graphics.ActiveContainer = frmPacman;
Thread.Sleep(100);
if (joystick != null)
{
game.InputManager.AddInputProvider(joystick);
game.Initialize();
}
}
开发者ID:joram,项目名称:Gadgeteer,代码行数:31,代码来源:Class1.cs
注:本文中的Form类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论