本文整理汇总了C#中System.Windows.Forms.Form类的典型用法代码示例。如果您正苦于以下问题:C# System.Windows.Forms.Form类的具体用法?C# System.Windows.Forms.Form怎么用?C# System.Windows.Forms.Form使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
System.Windows.Forms.Form类属于命名空间,在下文中一共展示了System.Windows.Forms.Form类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Game1
public Game1(IntPtr drawSurface,
System.Windows.Forms.Form parentForm,
System.Windows.Forms.PictureBox surfacePictureBox)
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
this.drawSurface = drawSurface;
this.parentForm = parentForm;
this.pictureBox = surfacePictureBox;
graphics.PreparingDeviceSettings +=
new EventHandler<PreparingDeviceSettingsEventArgs>(
graphics_PreparingDeviceSettings);
Mouse.WindowHandle = drawSurface;
gameForm =
System.Windows.Forms.Control.FromHandle(this.Window.Handle);
gameForm.VisibleChanged += new EventHandler(gameForm_VisibleChanged);
pictureBox.SizeChanged += new EventHandler(pictureBox_SizeChanged);
vscroll =
(System.Windows.Forms.VScrollBar)parentForm.Controls["vScrollBar1"];
hscroll =
(System.Windows.Forms.HScrollBar)parentForm.Controls["hScrollBar1"];
}
示例2: CloseForm
protected override void CloseForm()
{
if (_form == null) return;
_form.Close();
_form.Dispose();
_form = null;
}
示例3: CreateSelector
protected override IBOColSelectorControl CreateSelector()
{
IEditableGridControl readOnlyGridControl = GetControlFactory().CreateEditableGridControl();
System.Windows.Forms.Form frm = new System.Windows.Forms.Form();
frm.Controls.Add((System.Windows.Forms.Control)readOnlyGridControl);
return GetControlledLifetimeFor(readOnlyGridControl);
}
示例4: CreateGridBaseStub
protected override IGridBase CreateGridBaseStub()
{
GridBaseWinStub gridBase = new GridBaseWinStub();
System.Windows.Forms.Form frm = new System.Windows.Forms.Form();
frm.Controls.Add(gridBase);
return GetControlledLifetimeFor(gridBase);
}
示例5: GetGraph
public void GetGraph(Stream outputstream, DateTime from)
{
ObjectCache cache = MemoryCache.Default;
Bitmap bm = cache["graph"] as Bitmap;
if (bm == null)
{
bm = DrawGraph(from);
}
if (!System.Diagnostics.Debugger.IsAttached)
bm.Save(outputstream, System.Drawing.Imaging.ImageFormat.Jpeg);
else
{
System.Windows.Forms.Form f = new System.Windows.Forms.Form();
f.Height = 610;
f.Width = 810;
System.Windows.Forms.PictureBox pb = new System.Windows.Forms.PictureBox();
pb.Top = 1;
pb.Left = 1;
pb.Width = 800;
pb.Height = 600;
pb.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
pb.Visible = true;
f.Controls.Add(pb);
pb.Image = bm;
System.Windows.Forms.Application.Run(f);
}
}
示例6: GetInterface
private void GetInterface()
{
int hr;
System.Windows.Forms.Form f = new System.Windows.Forms.Form();
hr = MFExtern.MFCreateVideoRendererActivate(IntPtr.Zero, out m_a);
MFError.ThrowExceptionForHR(hr);
}
示例7: Run
public void Run()
{
// 初期設定を行う。
var option = new asd.EngineOption
{
IsFullScreen = false
};
bool closed = false;
System.Windows.Forms.Form form = new System.Windows.Forms.Form();
form.FormClosed += (object sender, System.Windows.Forms.FormClosedEventArgs e) =>
{
closed = true;
};
form.Show();
// aceを初期化する。
asd.Engine.InitializeByExternalWindow(form.Handle, IntPtr.Zero, form.Size.Width, form.Size.Height, option);
// aceが進行可能かチェックする。
while (asd.Engine.DoEvents())
{
System.Windows.Forms.Application.DoEvents();
if (closed) break;
// aceを更新する。
asd.Engine.Update();
}
// aceを終了する。
asd.Engine.Terminate();
}
示例8: DoSomething
/// <summary>
/// Just uses a messagebox to show the external request.
/// </summary>
/// <param name="someParameter"></param>
/// <returns></returns>
public bool DoSomething(string someParameter)
{
if (mMainWindow == null)
{
mMainWindow = System.Windows.Forms.Control.FromHandle(System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle) as System.Windows.Forms.Form;
}
// Just a few manipulations of the main window
if (mMainWindow != null)
{
someParameter = someParameter.ToLowerInvariant();
switch(someParameter)
{
case "hide":
mMainWindow.Hide();
break;
case "show":
mMainWindow.Show();
break;
case "min":
mMainWindow.WindowState = System.Windows.Forms.FormWindowState.Minimized;
break;
case "max":
mMainWindow.WindowState = System.Windows.Forms.FormWindowState.Maximized;
break;
}
}
else
{
System.Windows.Forms.MessageBox.Show("Could not get main window");
}
return System.Windows.Forms.MessageBox.Show(String.Format("Plugin does something on remote request: {0}\nSucceeded?", someParameter),
"Remote request to plugin",
System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes;
}
示例9: openShortnDialog
/// <summary>
/// Open the Shortn dialog window. Used internally after the Shortn button is pressed, and by Ribbon for the debugging
/// </summary>
/// <param name="data"></param>
public static void openShortnDialog(ShortnData data)
{
System.Windows.Forms.Form newForm = new System.Windows.Forms.Form();
newForm.Width = 1200;
newForm.Height = int.MaxValue;
newForm.BackColor = System.Drawing.Color.White;
// Create the ElementHost control for hosting the
// WPF UserControl.
ElementHost host = new ElementHost();
host.Dock = System.Windows.Forms.DockStyle.Fill;
// Create the WPF UserControl.
ShortnDialog sd = new ShortnDialog(data);
// Assign the WPF UserControl to the ElementHost control's
// Child property.
host.Child = sd;
newForm.Visible = false;
// Add the ElementHost control to the form's
// collection of child controls.
newForm.Controls.Add(host);
newForm.Show();
// set the form's height based on what the textbox wants to be
int dialogHeight = (int)sd.grid.DesiredSize.Height;
newForm.Height = (int)(sd.DesiredSize.Height + newForm.Padding.Vertical + System.Windows.Forms.SystemInformation.CaptionHeight + System.Windows.SystemParameters.ScrollWidth);
sd.grid.Height = sd.grid.DesiredSize.Height;
newForm.Width = 1200;
host.MaximumSize = new System.Drawing.Size(1200, System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height);
newForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
newForm.Visible = true;
}
示例10: Main
static void Main(string[] args)
{
#if DEBUG
Microsoft.Msagl.GraphViewerGdi.DisplayGeometryGraph.SetShowFunctions();
#endif
//create a form
System.Windows.Forms.Form form = new System.Windows.Forms.Form();
//create a viewer object
Microsoft.Msagl.GraphViewerGdi.GViewer viewer = new Microsoft.Msagl.GraphViewerGdi.GViewer();
//associate the viewer with the form
form.SuspendLayout();
viewer.Dock = System.Windows.Forms.DockStyle.Fill;
form.Controls.Add(viewer);
form.ResumeLayout();
//create a graph object
#if GraphModel
Graph graph = DgmlParser.DgmlParser.Parse("fullstring.dgml");
SugiyamaLayoutSettings ss = graph.LayoutAlgorithmSettings as SugiyamaLayoutSettings;
// uncomment this line to see the wide graph
// ss.MaxAspectRatioEccentricity = 100;
// uncommment this line to us Mds
// ss.FallbackLayoutSettings = new MdsLayoutSettings {AdjustScale = true};
// or uncomment the following line to use the default layering layout with vertical layer
// graph.Attr.LayerDirection = LayerDirection.LR;
viewer.Graph = graph;
form.ShowDialog();
#endif
}
示例11: CapturedItemsListController
private CapturedItemsListController(MainWindow mainWindow)
{
this.mainWindow = mainWindow;
this.mainWindowPtr = new System.Windows.Interop.WindowInteropHelper(mainWindow).Handle;
f = new System.Windows.Forms.Form();
sh = new ShellHook(f.Handle);
sh.WindowActivated += sh_WindowActivated;
sh.RudeAppActivated += sh_WindowActivated;
ch = new ClipboardHelper(f.Handle);
ch.ClipboardGrabbed += ch_ClipboardGrabbed;
ch.RegisterClipboardListener();
gh = new GlobalHotkeyHelper(f.Handle);
gh.GlobalHotkeyFired += new GlobalHotkeyHandler(gh_GlobalHotkeyFired);
gh.RegisterHotKey(666, KeyModifiers.Alt | KeyModifiers.Control | KeyModifiers.Shift, VirtualKeys.VK_Z);
gh.RegisterHotKey(667, KeyModifiers.Alt | KeyModifiers.Control | KeyModifiers.Shift, VirtualKeys.VK_1);
gh.RegisterHotKey(668, KeyModifiers.Alt | KeyModifiers.Control | KeyModifiers.Shift, VirtualKeys.VK_2);
gh.RegisterHotKey(669, KeyModifiers.Alt | KeyModifiers.Control | KeyModifiers.Shift, VirtualKeys.VK_3);
gh.RegisterHotKey(670, KeyModifiers.Alt | KeyModifiers.Control | KeyModifiers.Shift, VirtualKeys.VK_4);
gh.RegisterHotKey(671, KeyModifiers.Alt | KeyModifiers.Control | KeyModifiers.Shift, VirtualKeys.VK_5);
gh.RegisterHotKey(672, KeyModifiers.Alt | KeyModifiers.Control | KeyModifiers.Shift, VirtualKeys.VK_6);
gh.RegisterHotKey(673, KeyModifiers.Alt | KeyModifiers.Control | KeyModifiers.Shift, VirtualKeys.VK_7);
gh.RegisterHotKey(674, KeyModifiers.Alt | KeyModifiers.Control | KeyModifiers.Shift, VirtualKeys.VK_8);
gh.RegisterHotKey(675, KeyModifiers.Alt | KeyModifiers.Control | KeyModifiers.Shift, VirtualKeys.VK_9);
gh.RegisterHotKey(676, KeyModifiers.Alt | KeyModifiers.Control | KeyModifiers.Shift, VirtualKeys.VK_0);
}
示例12: HandlePluginLaunch
private void HandlePluginLaunch(object sender, EventArgs e)
{
//NWN2Toolset.NWN2.Data.Blueprints.NWN2GlobalBlueprintManager bpManager = new NWN2Toolset.NWN2.Data.Blueprints.NWN2GlobalBlueprintManager();
//bpManager.Initialize();
NWN2Toolset.NWN2.Data.TypedCollections.NWN2BlueprintCollection items = NWN2Toolset.NWN2.Data.Blueprints.NWN2GlobalBlueprintManager.GetBlueprintsOfType(NWN2Toolset.NWN2.Data.Templates.NWN2ObjectType.Item);
ALFAItemBlueprint scroll;
System.Windows.Forms.Form form = new System.Windows.Forms.Form();
/*System.Windows.Forms.TextBox text = new System.Windows.Forms.TextBox();
text.Size = new System.Drawing.Size(400, 300);
text.Multiline = true;
text.WordWrap = false;
text.AcceptsReturn = true;
text.AcceptsTab = true;
text.ScrollBars = System.Windows.Forms.ScrollBars.Both;
text.Text = scroll.ToString();*/
System.Windows.Forms.ListBox listBox = new System.Windows.Forms.ListBox();
listBox.Sorted = true;
listBox.HorizontalScrollbar = true;
listBox.Size = new System.Drawing.Size(400, 300);
form.Controls.Add(listBox);
form.Size = new System.Drawing.Size(430, 330);
form.Show();
//items.Add(scroll.ItemBlueprint);
//scroll.TemplateResRef = "TEST RESREF";
//scroll.AddItemProperty(ALFAItemProperty.CastSpell1ChargeItemProperty(0));
//scroll.AddItemProperty(ALFAItemProperty.WizardOnlyItemProperty());
//items.Add(scroll.ItemBlueprint);
ConsumableCreator cc = new ConsumableCreator();
cc.Run();
}
示例13: CreateSelector
protected override IBOColSelectorControl CreateSelector()
{
MultiSelectorWin<MyBO> multiSelectorWin = new MultiSelectorWin<MyBO>(GetControlFactory());
System.Windows.Forms.Form frm = new System.Windows.Forms.Form();
frm.Controls.Add(multiSelectorWin);
return multiSelectorWin;
}
示例14: CreateSelector
protected override IBOColSelectorControl CreateSelector()
{
GridBaseWinStub gridBase = new GridBaseWinStub();
System.Windows.Forms.Form frm = new System.Windows.Forms.Form();
frm.Controls.Add(gridBase);
SetupGridColumnsForMyBo(gridBase);
return GetControlledLifetimeFor(gridBase);
}
示例15: Input
public Input(System.Windows.Forms.Form form1_reference, IntPtr window_handle)
{
_form1_reference = form1_reference;
critical_failure = false;
populate_key_list();
Initialize_Keyboard(window_handle);
}