本文整理汇总了C#中System.Windows.Forms.Form.ShowDialog方法的典型用法代码示例。如果您正苦于以下问题:C# System.Windows.Forms.Form.ShowDialog方法的具体用法?C# System.Windows.Forms.Form.ShowDialog怎么用?C# System.Windows.Forms.Form.ShowDialog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Form
的用法示例。
在下文中一共展示了System.Windows.Forms.Form.ShowDialog方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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
}
示例2: test
public void test(Image t)
{
MWNumericArray d = (MWNumericArray)t.image;
double[,] i_d = (double[,])d.ToArray(MWArrayComponent.Real);
Bitmap bmp = new Bitmap(t.Height, t.Width);
for (int i = 0; i < t.Height; i++)
{
for (int j = 0; j < t.Width; j++)
{
byte pixel = (byte)(i_d[j, i] * 255);
Color color = Color.FromArgb(255, pixel, pixel, pixel);
bmp.SetPixel(i, j, color);
}
}
System.Windows.Forms.Form TestForm = new System.Windows.Forms.Form();
TestForm.Size = new System.Drawing.Size(t.Width + 20, t.Height + 40);
Graphics g = TestForm.CreateGraphics();
g.DrawImage(bmp, 0, 0);
TestForm.ShowDialog();
}
示例3: OnClick
public override void OnClick()
{
m_Form = this.CreateForm();
m_Form.ShowDialog(base.m_Hook.UIHook.MainForm);
}
示例4: Show
private static void Show(Form form, Application App)
{
form.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
App.EndUndoScope(
App.BeginUndoScope("Show Dialog"),
form.ShowDialog() == DialogResult.OK
);
}
示例5: loginmenu
/// <summary>
/// Wywoluje powitalne okno, gdzie uzytkownik moze podac swoje imie.
/// </summary>
private void loginmenu()
{
System.Windows.Forms.Form prompt = new System.Windows.Forms.Form();
prompt.Width = 300;
prompt.Height = 150;
prompt.Text = "Welcome!!!";
prompt.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
System.Windows.Forms.Label textLabel = new System.Windows.Forms.Label() { Left = 50, Top = 20, Text = "Enter your name" };
System.Windows.Forms.TextBox textBox = new System.Windows.Forms.TextBox() { Left = 50, Top = 50, Width = 200, Text = "Player" };
System.Windows.Forms.Button confirmation = new System.Windows.Forms.Button() { Text = "Ok", Left = 150, Width = 100, Top = 70 };
confirmation.Click += (sender, e) => { prompt.Close(); };
prompt.Controls.Add(confirmation);
prompt.Controls.Add(textLabel);
prompt.Controls.Add(textBox);
prompt.ShowDialog();
PlayerName = textBox.Text;
}
示例6: ShowInputDialog
public static System.Windows.Forms.DialogResult ShowInputDialog(string title, ref string input)
{
var size = new System.Drawing.Size(280, 90);
var inputBox = new System.Windows.Forms.Form();
int top = 5;
inputBox.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
inputBox.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
inputBox.ClientSize = size;
inputBox.Text = title;
var textLabel = new System.Windows.Forms.Label();
textLabel.Size = new System.Drawing.Size(size.Width - 10, 23);
textLabel.Location = new System.Drawing.Point(5, top);
textLabel.Text = title;
inputBox.Controls.Add(textLabel);
top += textLabel.Height + 5;
var textBox = new System.Windows.Forms.TextBox();
textBox.Size = new System.Drawing.Size(size.Width - 10, 23);
textBox.Location = new System.Drawing.Point(5, top);
textBox.Text = input;
inputBox.Controls.Add(textBox);
top += textBox.Height + 5;
var okButton = new System.Windows.Forms.Button();
okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
okButton.Name = "okButton";
okButton.Size = new System.Drawing.Size(75, 23);
okButton.Text = "&OK";
okButton.Location = new System.Drawing.Point(size.Width - 80 - 80, top);
inputBox.Controls.Add(okButton);
var cancelButton = new System.Windows.Forms.Button();
cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
cancelButton.Name = "cancelButton";
cancelButton.Size = new System.Drawing.Size(75, 23);
cancelButton.Text = "&Cancel";
cancelButton.Location = new System.Drawing.Point(size.Width - 80, top);
inputBox.Controls.Add(cancelButton);
inputBox.AcceptButton = okButton;
inputBox.CancelButton = cancelButton;
var result = inputBox.ShowDialog();
input = textBox.Text;
return result;
}
示例7: ShowEvents
public bool ShowEvents(List<Tuple<Income, DateTime>> events)
{
string s = "";
foreach (var t in events)
{
s += String.Format("{2} {0} {1} {3}\r\n", t.Item1.Name, t.Item1.Amount, t.Item2, t.Item1.Period2.Format);
}
var f = new System.Windows.Forms.Form();
var tb = new System.Windows.Forms.TextBox();
tb.Multiline = true;
tb.Dock = System.Windows.Forms.DockStyle.Fill;
tb.Text = s;
tb.ScrollBars = System.Windows.Forms.ScrollBars.Both;
f.Controls.Add(tb);
var b = new System.Windows.Forms.Button();
b.Dock = System.Windows.Forms.DockStyle.Top;
b.Text = "OK";
f.Controls.Add(b);
b.Click += delegate(object o, EventArgs e) { f.DialogResult = System.Windows.Forms.DialogResult.OK; f.Close(); };
return f.ShowDialog() == System.Windows.Forms.DialogResult.OK;
}
示例8: ShowHtmlDialog
public static void ShowHtmlDialog(System.IO.Stream htmlStream, BrowserController controller)
{
System.Windows.Forms.Form f = new System.Windows.Forms.Form();
System.Windows.Forms.WebBrowser browser = new System.Windows.Forms.WebBrowser();
f.Controls.Add(browser);
browser.Dock = System.Windows.Forms.DockStyle.Fill;
BrowserGlue glue = new BrowserGlue(browser, controller);
browser.ObjectForScripting = glue;
browser.DocumentStream = htmlStream;
f.ShowDialog();
}