/// <summary>Displays Any String</summary> /// <param name="StringToDisplay">Object with Properties to edit</param> /// <param name="pDaddy">Parent Form Or Nothing (null)</param> /// <param name="strTitle">Window Title</param> public static void DisplayABigString(string StringToDisplay, System.Windows.Forms.Control pDaddy, string strTitle = "") { System.Windows.Forms.Form frmEO = new System.Windows.Forms.Form(); TextBox T = new TextBox() { Multiline = true, ScrollBars = ScrollBars.Both, Dock = DockStyle.Fill, WordWrap = false }; frmEO.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; frmEO.Text = strTitle; frmEO.Controls.Add(T); T.Text = StringToDisplay; T.Font = CourierNew(); T.SelectionStart = 0; T.SelectionLength = 0; T.KeyDown += TextBox_KeyDown; frmEO.Hide(); frmEO.Height = 640; frmEO.Width = 640; System.Windows.Forms.Application.DoEvents(); if (pDaddy == null) { frmEO.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; frmEO.ShowDialog(); } else { frmEO.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; frmEO.ShowDialog(pDaddy); } frmEO.Dispose(); }
static public InputBoxResult Show(string Prompt) { InitializeComponent(); FormPrompt = Prompt; // Display the form as a modal dialog box. LoadForm(); frmInputDialog.ShowDialog(); return(OutputResponse); }
public void ShowForm(Form form) { var activeForm = FormHelper.GetActiveForm(); if (activeForm != null) { activeForm.BeginInvoke(new Action(() => form.ShowDialog(activeForm))); } else { form.ShowDialog(); } }
public static void Visualisasi() { //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(); //create a graph object Microsoft.Msagl.Drawing.Graph graph = new Microsoft.Msagl.Drawing.Graph("graph"); //create the graph content //for (int i = 0; i < ReadFromFile.nEdge; i++) { // graph.AddEdge(Char.ToString(ReadFromFile.EdgeData[i].Item1), Char.ToString(ReadFromFile.EdgeData[i].Item2)); //} //for (int i = 0; i < ReadFromFile.nNode; i++) { // if (BFS.Map.vertices[vertices.Keys.ElementAt(i)].neighbors.Keys.ElementAt(i)) { // graph.FindNode(BFS.Map.vertices.Keys.ElementAt(i)).Attr.FillColor = Microsoft.Msagl.Drawing.Color.Red; // } //} //bind the graph to the viewer viewer.Graph = graph; //associate the viewer with the form form.SuspendLayout(); viewer.Dock = System.Windows.Forms.DockStyle.Fill; form.Controls.Add(viewer); form.ResumeLayout(); //show the form form.ShowDialog(); }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { var bitmap = (Bitmap)objectProvider.GetObject(); if (bitmap == null) throw new NullReferenceException("Make sure your Bitmap is not null."); var form = new Form { Text = String.Format("ImageView - W: {0}px H: {1}px", bitmap.Width, bitmap.Height), ClientSize = new Size(480, 320), FormBorderStyle = FormBorderStyle.Sizable, ShowInTaskbar = false, ShowIcon = false }; var pictureBox = new PictureBox { SizeMode = PictureBoxSizeMode.Zoom, Image = bitmap, Parent = form, Dock = DockStyle.Fill }; form.ShowDialog(); }
public static DialogResult ShowDialog(this DefultForm form, UserControl Childe, Size sizeForm) { using (var Temp = new System.Windows.Forms.Form()) { //Temp.Dock = System.Windows.Forms.DockStyle.Fill; Temp.WindowState = System.Windows.Forms.FormWindowState.Maximized; Temp.BackColor = System.Drawing.Color.SlateGray; Temp.Opacity = 0.7D; Temp.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; Temp.ShowInTaskbar = false; Temp.StartPosition = FormStartPosition.CenterParent; Temp.KeyDown += (sender, e) => { if (e.KeyCode == System.Windows.Forms.Keys.Escape) { form.Close(); } }; Temp.Load += (sender, e) => { Childe.Dock = DockStyle.Fill; form.panel1.Controls.Add(Childe); form.Size = sizeForm; form.StartPosition = FormStartPosition.CenterParent; form.ShowDialog(); Temp.Close(); }; Temp.ShowDialog(); } return(form.DialogResult); }
void IDisplayHandler.OnFullscreenModeChange(IWebBrowser browserControl, IBrowser browser, bool fullscreen) { var chromiumWebBrowser = (ChromiumWebBrowser)browserControl; chromiumWebBrowser.InvokeOnUiThreadIfRequired(() => { if (fullscreen) { parent = chromiumWebBrowser.Parent; parent.Controls.Remove(chromiumWebBrowser); fullScreenForm = new Form(); fullScreenForm.FormBorderStyle = FormBorderStyle.None; fullScreenForm.WindowState = FormWindowState.Maximized; fullScreenForm.Controls.Add(chromiumWebBrowser); fullScreenForm.ShowDialog(parent.FindForm()); } else { fullScreenForm.Controls.Remove(chromiumWebBrowser); parent.Controls.Add(chromiumWebBrowser); fullScreenForm.Close(); fullScreenForm.Dispose(); fullScreenForm = null; } }); }
public static System.Windows.Forms.DialogResult DimAndShowDialog(this System.Windows.Forms.Form parentForm, System.Windows.Forms.Form dlg) { System.Windows.Forms.DialogResult result = System.Windows.Forms.DialogResult.None; var dimForm = new System.Windows.Forms.Form() { Text = "", ControlBox = false, FormBorderStyle = System.Windows.Forms.FormBorderStyle.None, Size = parentForm.Size, Location = parentForm.Location, BackColor = System.Drawing.Color.Black, ShowInTaskbar = false, Opacity = .5 }; dlg.FormClosing += (oSender, oE) => { dimForm.Close(); dimForm = null; }; dimForm.Shown += (oSender, oE) => { dimForm.Location = parentForm.Location; result = dlg.ShowDialog(); parentForm.Focus(); }; dimForm.ShowDialog(); return result; }
public void EnhancedListViewTest() { // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items. // For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463 using (var frm = new Form()) { using (var lv = new EnhancedListView { Dock = DockStyle.Fill, View = View.Details }) { for (int j = 0; j < 4; j++) { lv.Columns.Add(j.ToString()); } for (int i = 0; i < 1000; i++) { var item = new ListViewItem(i.ToString()); for (int j = 0; j < 4; j++) { item.SubItems.Add(j.ToString()); } lv.Items.Add(item); } frm.Controls.Add(lv); frm.ShowDialog(); } } }
public void TestShowWithEvents() { //---------------Set up test pack------------------- System.Windows.Forms.DateTimePicker dateTimePicker = new System.Windows.Forms.DateTimePicker(); dateTimePicker.ShowCheckBox = true; System.Windows.Forms.Form form = new System.Windows.Forms.Form(); System.Windows.Forms.TextBox textBox = new System.Windows.Forms.TextBox(); form.Controls.Add(textBox); textBox.Dock = System.Windows.Forms.DockStyle.Fill; textBox.Multiline = true; form.Controls.Add(dateTimePicker); dateTimePicker.Dock = System.Windows.Forms.DockStyle.Top; dateTimePicker.ValueChanged += delegate { textBox.Text += "EventFired"; }; System.Windows.Forms.Button button = new System.Windows.Forms.Button(); form.Controls.Add(button); button.Dock = System.Windows.Forms.DockStyle.Bottom; button.Click += delegate { dateTimePicker.Checked = !dateTimePicker.Checked; }; //-------------Assert Preconditions ------------- //---------------Execute Test ---------------------- form.ShowDialog(); //---------------Test Result ----------------------- }
public void ToBitmapGrayScale() { Mat img = new Mat(FilePath.Lenna511, LoadMode.GrayScale); // width % 4 != 0 Bitmap bitmap = BitmapConverter2.ToBitmap(img); // Bitmap bitmap = img.ToBitmap(); using (var form = new Form()) using (var pb = new PictureBox()) { pb.Image = bitmap; var size = new System.Drawing.Size(bitmap.Width, bitmap.Height); pb.ClientSize = size; form.ClientSize = size; form.Controls.Add(pb); form.KeyPreview = true; form.KeyDown += (sender, args) => { if (args.KeyCode.HasFlag(Keys.Enter)) ((Form)sender).Close(); }; form.Text = "Grayscale Mat to Bitmap Test"; form.ShowDialog(); } }
public static void CreateForm(string msg) { Form frm = new Form(); frm.MaximizeBox = false; frm.MinimizeBox = false; frm.Width = 800; frm.Text = "Exception"; frm.ShowIcon = false; frm.StartPosition = FormStartPosition.CenterScreen; frm.FormBorderStyle = FormBorderStyle.Sizable; TextBox edt = new TextBox(); edt.Multiline = true; edt.Dock = DockStyle.Fill; edt.ReadOnly = true; edt.Cursor = Cursors.Default; //edt.ScrollBars = ScrollBars.Horizontal; //edt.WordWrap = false; edt.Text = msg; edt.SelectionStart =0; //edt.SelectionStart = edt.Lines[0].Length + 5; //edt.SelectionLength = edt.Lines[1].Length - 4; frm.Controls.Add(edt); frm.ShowDialog(); }
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(); }
public static string ShowDialog(string text, string caption, List <string> list) { System.Windows.Forms.Form prompt = new System.Windows.Forms.Form() { Width = 500, Height = 550, FormBorderStyle = FormBorderStyle.FixedDialog, Text = caption, StartPosition = FormStartPosition.CenterScreen }; Label textLabel = new Label() { Left = 50, Top = 20, Text = text, Width = 1000 }; ListBox listBox = new ListBox() { Left = 50, Top = 50, Width = 400 }; list.Insert(0, "none"); listBox.DataSource = list; Button confirmation = new Button() { Text = "Ok", Left = 350, Width = 100, Top = 400, DialogResult = DialogResult.OK }; confirmation.Click += (sender, e) => { prompt.Close(); }; prompt.Controls.Add(listBox); prompt.Controls.Add(confirmation); prompt.Controls.Add(textLabel); prompt.AcceptButton = confirmation; return(prompt.ShowDialog() == DialogResult.OK ? listBox.Text : "none"); }
static void CreateForm() { Form form = new Form(); DataGridView grid = new DataGridView(); form.Controls.Add(grid); grid.Dock = DockStyle.Fill; // Create an instance of the PowerShell class. // This takes care of all building all of the other // data structures needed... PowerShell powershell = PowerShell.Create().AddCommand("get-process").AddCommand("sort-object").AddArgument("ID"); if (Runspace.DefaultRunspace == null) { Runspace.DefaultRunspace = powershell.Runspace; } Collection<PSObject> results = powershell.Invoke(); // The generic collection needs to be re-wrapped in an ArrayList // for data-binding to work... ArrayList objects = new ArrayList(); objects.AddRange(results); // The DataGridView will use the PSObjectTypeDescriptor type // to retrieve the properties. grid.DataSource = objects; form.ShowDialog(); }
public static DialogResult ShowDialog(Form parent, Form dialog) { //Enabled = false; Form shadow = new Form(); shadow.MinimizeBox = false; shadow.MaximizeBox = false; shadow.ControlBox = false; shadow.Text = ""; shadow.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; //shadow.Size = Size; shadow.BackColor = Color.Black; shadow.Opacity = 0.3; shadow.ShowInTaskbar = false; shadow.WindowState = FormWindowState.Maximized; shadow.Show(); //shadow.Location = Location; shadow.Enabled = false; var mask = new frmOpacity(parent, dialog); dialog.StartPosition = FormStartPosition.CenterParent; //mask.Show(); var result = dialog.ShowDialog(mask); mask.Close(); shadow.Close(); return result; }
public static string ShowDialog(string text, string caption, string value, bool isPassword) { Form prompt = new Form(); prompt.Width = 264; prompt.Height = 140; prompt.Text = caption; Label textLabel = new Label() { Left = 12, Top = 22, Text = text, Width = 210 }; TextBox textBox = new TextBox() { Text = value, Left = 12, Top = 52, Width = 230 }; if (isPassword) { textBox = new TextBox() { Text = value, Left = 12, Top = 52, Width = 230, PasswordChar = '*' }; } else { textBox = new TextBox() { Text = value, Left = 12, Top = 52, Width = 230 }; } textBox.Focus(); textBox.KeyDown += (sender, e) => { if (e.KeyValue != 13) return; prompt.Close(); }; Button confirmation = new Button() { Text = "Ok", Left = 142, Width = 100, Top = 78 }; confirmation.Click += (sender, e) => { prompt.Close(); }; prompt.Controls.Add(confirmation); prompt.Controls.Add(textLabel); prompt.Controls.Add(textBox); prompt.StartPosition = FormStartPosition.CenterParent; prompt.ShowDialog(); return textBox.Text; }
public static string Show(string question) { Form form = new Form(); Label label = new Label(); TextBox textBox = new TextBox(); int lengthNeeded = (int)(question.Length*label.Font.SizeInPoints); form.TopMost = true; form.ClientSize = new Size(lengthNeeded+10, 50); form.FormBorderStyle = FormBorderStyle.FixedDialog; label.Text = question; label.Location = new Point(5, 0); label.TextAlign = ContentAlignment.MiddleCenter; label.Size = new Size(lengthNeeded, 23); textBox.Location = new Point(5, 25); textBox.Size = new Size(lengthNeeded, 23); textBox.KeyDown += new KeyEventHandler(KeyDown); form.Controls.Add(label); form.Controls.Add(textBox); if (form.ShowDialog() == DialogResult.OK) return textBox.Text; else return null; }
static public void dfagraph(List <DFAState> list) { System.Windows.Forms.Form form = new System.Windows.Forms.Form(); Microsoft.Msagl.GraphViewerGdi.GViewer viewer = new Microsoft.Msagl.GraphViewerGdi.GViewer(); Microsoft.Msagl.Drawing.Graph graph = new Microsoft.Msagl.Drawing.Graph("graph"); for (int i = 0; i < list.Count; i++) { for (int j = 0; j < list[i].transitions.Count; j += 2) { if (list[i].transitions[j].input != "") { graph.AddEdge(list[i].name, list[i].transitions[j].input, list[i].transitions[j].nextState.name); } if (list[i].isFinalState == true) { Microsoft.Msagl.Drawing.Node c = graph.FindNode(list[i].name); c.Attr.FillColor = Microsoft.Msagl.Drawing.Color.Red; } } } viewer.Graph = graph; form.SuspendLayout(); viewer.Dock = System.Windows.Forms.DockStyle.Fill; form.Controls.Add(viewer); form.ResumeLayout(); form.ShowDialog(); }
public static string ShowDialog(string text, string caption) { System.Windows.Forms.Form prompt = new System.Windows.Forms.Form(); prompt.Width = 500; prompt.Height = 150; prompt.Text = caption; Label textLabel = new Label() { Left = 50, Top = 20, Text = text }; System.Windows.Forms.TextBox textBox = new System.Windows.Forms.TextBox() { Left = 50, Top = 50, Width = 400 }; Button confirmation = new Button() { Text = "Ok", Left = 350, Width = 100, Top = 70 }; confirmation.Click += (sender, e) => { prompt.Close(); }; prompt.Controls.Add(confirmation); prompt.Controls.Add(textLabel); prompt.Controls.Add(textBox); prompt.ShowDialog(); return(textBox.Text); }
/// <summary> /// Визуализация графа /// </summary> private void CreateGraph() { if (vertex > 0) { System.Windows.Forms.Form form = new System.Windows.Forms.Form(); Microsoft.Msagl.GraphViewerGdi.GViewer viewer = new Microsoft.Msagl.GraphViewerGdi.GViewer(); Microsoft.Msagl.Drawing.Graph graph = new Microsoft.Msagl.Drawing.Graph("graph"); for (int i = 0; i < vertex; i++) //циклы для прохода по массиву { for (int j = 0; j < vertex; j++) { if (matrix[i, j] > 0) { graph.AddEdge(Convert.ToString(i), Convert.ToString(j)).Attr.Color = //добавление ребра и смена цвета Microsoft.Msagl.Drawing.Color.ForestGreen; graph.FindNode(Convert.ToString(i)).Attr.FillColor = Microsoft.Msagl.Drawing.Color.Teal; //смена цвета вершины } } } viewer.Graph = graph; //отображение выбранного графа form.SuspendLayout(); //приостанавливаем логику макета для добавления панели управления viewer.Dock = System.Windows.Forms.DockStyle.Fill; //возвращает границы элемента управления form.Controls.Add(viewer); //добавляем панель управления form.ResumeLayout(); //возобновляем логику макета form.ShowDialog(); //показать форму } else { MessageBox.Show("Задайте количество вершин"); } }
public void TestControl() { using (var frm = new System.Windows.Forms.Form()) { frm.SuspendLayout(); var splitter = new System.Windows.Forms.SplitContainer(); splitter.Dock = DockStyle.Fill; var sp1 = splitter.Panel1; // = new SplitterPanel(splitter); var pg = new PropertyGrid(); sp1.Controls.Add(pg); pg.Dock = DockStyle.Fill; var sp2 = splitter.Panel2; // SplitterPanel(splitter); var lc1 = new LegendControl(); lc1.Dock = DockStyle.Fill; sp2.Controls.Add(lc1); pg.SelectedObject = lc1; lc1.LegendFactory = new LegendFactory(new LegendSettings()); lc1.Map = CreateMap(); frm.Controls.Add(splitter); frm.ResumeLayout(); frm.ShowDialog(); } }
/// <summary> /// Generate a Windows modeless form on the fly /// and display the revision data in it in a /// DataGridView. /// </summary> void DisplayRevisionData( List <RevisionData> revision_data, IWin32Window owner) { System.Windows.Forms.Form form = new System.Windows.Forms.Form(); form.Size = new Size(680, 180); form.Text = "Revision Data"; DataGridView dg = new DataGridView(); dg.DataSource = revision_data; dg.AllowUserToAddRows = false; dg.AllowUserToDeleteRows = false; dg.AllowUserToOrderColumns = true; dg.Dock = System.Windows.Forms.DockStyle.Fill; dg.Location = new System.Drawing.Point(0, 0); dg.ReadOnly = true; dg.TabIndex = 0; dg.Parent = form; dg.AutoSize = true; dg.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; dg.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); dg.AutoResizeColumns(); //dg.Columns[2].AutoSizeMode // = DataGridViewAutoSizeColumnMode.DisplayedCells; //dg.Columns[3].AutoSizeMode // = DataGridViewAutoSizeColumnMode.Fill; form.ShowDialog(owner); }
public static void DisplayChanges() { string changes = string.Empty; using (Stream s = Assembly.GetExecutingAssembly().GetManifestResourceStream(Assembly.GetExecutingAssembly().GetManifestResourceNames().First(e => e.ToLower().Contains("changes.txt")))) { using (StreamReader sr = new StreamReader(s)) { changes = sr.ReadToEnd(); } } Button b = new Button(); b.Text = "Close"; b.Dock = DockStyle.Bottom; b.Click += (src, evt) => { ((Form)b.Parent).Close(); }; TextBox tb = new TextBox(); tb.Text = changes; tb.Dock = DockStyle.Fill; tb.ReadOnly = true; tb.Multiline = true; tb.Select(0, 0); tb.ScrollBars = ScrollBars.Both; tb.WordWrap = true; Form f = new Form(); f.Size = new Size(400, 400); f.Text = "Changelog"; f.Controls.Add(tb); f.Controls.Add(b); f.ShowDialog(); }
public Task StartAsync() { //System.Diagnostics.Debugger.Break(); //create a form form = new System.Windows.Forms.Form(); form.Size = new System.Drawing.Size(500, 500); //create a viewer object viewer = new GViewer(); viewer.Dock = System.Windows.Forms.DockStyle.Fill; viewer.AutoScroll = false; //viewer.CurrentLayoutMethod = LayoutMethod.MDS; // control var b = CreateCommandButton(); form.Controls.Add(b); b.BringToFront(); viewer.ObjectUnderMouseCursorChanged += new EventHandler <Microsoft.Msagl.Drawing.ObjectUnderMouseCursorChangedEventArgs>(viewer_ObjectUnderMouseCursorChanged); viewer.MouseDown += new MouseEventHandler(viewer_MouseDown); viewer.SuspendLayout(); form.SuspendLayout(); form.Controls.Add(viewer as Control); viewer.ResumeLayout(false); form.ResumeLayout(false); viewer.Graph = graph; return(Task.Run(() => form.ShowDialog())); }
public void Activated_Dialog () { if (TestHelper.RunningOnUnix) Assert.Ignore ("#4 fails"); _form = new DelayedCloseForm (); EventLogger logger = new EventLogger (_form); _form.ShowInTaskbar = false; Assert.AreEqual (0, logger.CountEvents ("Activated"), "#1"); _form.Activate (); Assert.AreEqual (0, logger.CountEvents ("Activated"), "#2"); _form.ShowDialog (); Assert.AreEqual (1, logger.CountEvents ("Activated"), "#3"); _form.ShowDialog (); Assert.AreEqual (2, logger.CountEvents ("Activated"), "#4"); }
public MainForm() { InitializeComponent(); frmObj = new login(); frmObj.ShowDialog(); LoadMenu(); }
public static DialogResult Show(string text, string head) { form1.Dispose(); form1 = new Form(); InitializeComponent(); if (form1.ParentForm == null) form1.StartPosition = FormStartPosition.CenterScreen; label1.Location = new Point(12, label1.Location.Y); btnNames = AsignButtons(buttons); form1.Text = head; label1.Text = text; FormAutoHeigh(); CenterButtons(btnNames.Length); MakeButtons(btnNames, selNoBtn); AddSound(icon); DialogResult rez = form1.ShowDialog(); form1.Dispose(); return rez; }
public static void Main() { //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(); //create a graph object Microsoft.Msagl.Drawing.Graph graph = new Microsoft.Msagl.Drawing.Graph("graph"); //create the graph content graph.AddEdge("A", "B"); graph.AddEdge("B", "C"); graph.AddEdge("A", "C").Attr.Color = Microsoft.Msagl.Drawing.Color.Green; graph.FindNode("A").Attr.FillColor = Microsoft.Msagl.Drawing.Color.Magenta; graph.FindNode("B").Attr.FillColor = Microsoft.Msagl.Drawing.Color.MistyRose; Microsoft.Msagl.Drawing.Node c = graph.FindNode("C"); c.Attr.FillColor = Microsoft.Msagl.Drawing.Color.PaleGreen; c.Attr.Shape = Microsoft.Msagl.Drawing.Shape.Diamond; //bind the graph to the viewer viewer.Graph = graph; //associate the viewer with the form form.SuspendLayout(); viewer.Dock = System.Windows.Forms.DockStyle.Fill; form.Controls.Add(viewer); form.ResumeLayout(); viewer.MouseUp += Viewer_MouseUp; //show the form form.ShowDialog(); }
public void DrawResult(Graph _graph) { timestamps.Reverse(); List <string> distinct = timestamps.Distinct().ToList(); System.Windows.Forms.Form form = new System.Windows.Forms.Form(); Microsoft.Msagl.GraphViewerGdi.GViewer viewer = new Microsoft.Msagl.GraphViewerGdi.GViewer(); Microsoft.Msagl.Drawing.Graph graph = new Microsoft.Msagl.Drawing.Graph("graph"); for (int i = 0; i < distinct.Count; i++) { Console.WriteLine("\nSemester {0} :\n{1}", i + 1, distinct[i]); } for (int idx = 0; idx < distinct.Count - 1; idx++) { graph.AddEdge(distinct[idx], distinct[idx + 1]).Attr.Color = Microsoft.Msagl.Drawing.Color.Green;; int index = _graph.GetNodesIdx(distinct[idx]); for (int j = 0; j < _graph.GetNodes(index).GetPostreqCount(); j++) { if (!(distinct[idx + 1].Equals(_graph.GetNodes(index).GetPostreq(j), StringComparison.Ordinal))) { graph.AddEdge(_graph.GetNodes(index).GetVal(), _graph.GetNodes(index).GetPostreq(j)); } } } viewer.Graph = graph; form.SuspendLayout(); viewer.Dock = System.Windows.Forms.DockStyle.Fill; form.WindowState = FormWindowState.Maximized; form.Controls.Add(viewer); form.ResumeLayout(); form.ShowDialog(); }
static void Main(string[] args) { Form myForm = new Form(); myForm.Text = "Hello World!"; myForm.Load += myForm_Load; myForm.ShowDialog(); }
public static string ShowDialog(string text, string caption) { System.Windows.Forms.Form prompt = new System.Windows.Forms.Form() { Width = 500, Height = 150, FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog, Text = caption, StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen, RightToLeft = RightToLeft.Yes, }; Label textLabel = new Label() { Left = 50, Top = 20 }; TextBox textBox = new TextBox() { Left = 50, Top = 50, Width = 400 }; Button confirmation = new Button() { Text = "Ok", Left = 350, Width = 100, Top = 70, DialogResult = DialogResult.OK }; textBox.Text = text; confirmation.Click += (sender, e) => { prompt.Close(); }; prompt.Controls.Add(textBox); prompt.Controls.Add(confirmation); prompt.Controls.Add(textLabel); prompt.AcceptButton = confirmation; return(prompt.ShowDialog() == DialogResult.OK ? textBox.Text : ""); }
public static void ShowDialog( string Header, string Message ) { Form Dialog = new Form(); Dialog.Width = 400; Dialog.Height = 120; Dialog.Text = Header; Dialog.FormBorderStyle = FormBorderStyle.FixedDialog; Label LabelMessage = new Label() { //Left = 0, //Top = 0, Width = Dialog.Width, Height = Dialog.Height / 2, Text = Message, TextAlign = ContentAlignment.MiddleCenter, Font = new Font( SystemFonts.MessageBoxFont.FontFamily.Name, 12.0f, FontStyle.Bold, GraphicsUnit.Point ) }; LabelMessage.TextAlign = ContentAlignment.MiddleCenter; Button ButtonOK = new Button() { Text = "OK", Left = Dialog.Width - 100, Width = 80, Top = Dialog.Height - 70 }; ButtonOK.Click += ( sender, e ) => { Dialog.Close(); }; Dialog.Controls.Add( ButtonOK ); Dialog.Controls.Add( LabelMessage ); Dialog.ShowDialog(); }
static public void CreateGraph(ref CourseNode[] nodes) { System.Windows.Forms.Form form = new System.Windows.Forms.Form(); Microsoft.Msagl.GraphViewerGdi.GViewer viewer = new Microsoft.Msagl.GraphViewerGdi.GViewer(); Microsoft.Msagl.Drawing.Graph graph = new Microsoft.Msagl.Drawing.Graph("graph"); List <string> node_name = new List <string>(); foreach (CourseNode Course in nodes) { node_name.Add(Course.name); } foreach (string course in node_name) { graph.AddNode(course).Attr.Color = Microsoft.Msagl.Drawing.Color.Aqua; } foreach (CourseNode Course in nodes) { foreach (string child in Course.children) { graph.AddEdge(Course.name, child); } } viewer.Graph = graph; form.SuspendLayout(); viewer.Dock = System.Windows.Forms.DockStyle.Fill; form.Controls.Add(viewer); form.ResumeLayout(); form.ShowDialog(); }
public override void Run() { var form = new Form(); var stackPanel = new StackPanel{ Dock = DockStyle.Fill }; form.Controls.Add(stackPanel) ; for(var i = 0; i < 50; i++) { var button = new ExButton(){ Text = Random.Name(), Image = Random.Image16x16() }; stackPanel.Controls.Add(button) ; var hyperlink = new ExHyperlink() { Text = Random.Name(), Image = Random.Image16x16() }; stackPanel.Controls.Add(hyperlink) ; } form.ShowDialog(); }
/// <summary> /// Returns a SharePoint on-premises / SharePoint Online ClientContext object. Requires claims based authentication with FedAuth cookie. /// </summary> /// <param name="siteUrl">Site for which the ClientContext object will be instantiated</param> /// <param name="icon">Optional icon to use for the popup form</param> /// <returns>ClientContext to be used by CSOM code</returns> public ClientContext GetWebLoginClientContext(string siteUrl, System.Drawing.Icon icon = null) { var cookies = new CookieContainer(); var siteUri = new Uri(siteUrl); var thread = new Thread(() => { var form = new System.Windows.Forms.Form(); if (icon != null) { form.Icon = icon; } var browser = new System.Windows.Forms.WebBrowser { ScriptErrorsSuppressed = true, Dock = DockStyle.Fill }; form.SuspendLayout(); form.Width = 900; form.Height = 500; form.Text = string.Format("Log in to {0}", siteUrl); form.Controls.Add(browser); form.ResumeLayout(false); browser.Navigate(siteUri); browser.Navigated += (sender, args) => { if (siteUri.Host.Equals(args.Url.Host)) { var cookieString = CookieReader.GetCookie(siteUrl).Replace("; ", ",").Replace(";", ","); if (Regex.IsMatch(cookieString, "FedAuth", RegexOptions.IgnoreCase)) { var _cookies = cookieString.Split(',').Where(c => c.StartsWith("FedAuth", StringComparison.InvariantCultureIgnoreCase) || c.StartsWith("rtFa", StringComparison.InvariantCultureIgnoreCase)); cookies.SetCookies(siteUri, string.Join(",", _cookies)); form.Close(); } } }; form.Focus(); form.ShowDialog(); browser.Dispose(); }); thread.SetApartmentState(ApartmentState.STA); thread.Start(); thread.Join(); if (cookies.Count > 0) { var ctx = new ClientContext(siteUrl); ctx.ExecutingWebRequest += (sender, e) => e.WebRequestExecutor.WebRequest.CookieContainer = cookies; return(ctx); } return(null); }
/// <summary> /// Shows a dialog box with an input field. /// </summary> /// <param name="title"></param> /// <param name="prompt"></param> /// <param name="value"></param> /// <returns></returns> public static DialogResult Show(string title, string prompt, ref string value) { Form mForm = new Form(); Label mLabel = new Label(); TextBox mTextBox = new TextBox(); Button mOKButton = new Button(); mForm.Text = title; mLabel.Text = prompt; mTextBox.Text = value; mOKButton.Text = "OK"; mOKButton.DialogResult = DialogResult.OK; mForm.ClientSize = new Size(240, 80); mLabel.SetBounds(4, 4, mForm.ClientSize.Width-8, 22); mTextBox.SetBounds(32, 26, mForm.ClientSize.Width - 64, 24); mOKButton.SetBounds(mForm.ClientSize.Width / 2 - 32, 54, 64, 22); mLabel.AutoSize = true; mTextBox.Anchor = AnchorStyles.Bottom; mOKButton.Anchor = AnchorStyles.Bottom; mForm.Controls.AddRange(new Control[] { mLabel, mTextBox, mOKButton }); mForm.FormBorderStyle = FormBorderStyle.FixedDialog; mForm.StartPosition = FormStartPosition.CenterScreen; mForm.MinimizeBox = false; mForm.MaximizeBox = false; mForm.AcceptButton = mOKButton; DialogResult dialogResult = mForm.ShowDialog(); value = mTextBox.Text; return dialogResult; }
public static string ShowDialog(string text, string caption, string defaultValue = "") { Form prompt = new Form(); prompt.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; prompt.Width = 250; prompt.Height = 150; prompt.Text = caption; Label textLabel = new Label() { Left = 10, Top = 10, Text = text, AutoSize = true }; TextBox textBox = new TextBox() { Left = 10, Top = 35, Width = 210 }; textBox.Text = defaultValue; Button confirmation = new Button() { Text = "OK", Left = 10, Width = 60, Top = 70 }; Button cancel = new Button() { Text = "Cancel", Left = 90, Width = 60, Top = 70 }; confirmation.Click += (sender, e) => { prompt.DialogResult = DialogResult.OK; prompt.Close(); }; cancel.Click += (sender, e) => { prompt.DialogResult = DialogResult.Cancel; prompt.Close(); }; prompt.Controls.Add(confirmation); prompt.Controls.Add(cancel); prompt.Controls.Add(textLabel); prompt.Controls.Add(textBox); prompt.AcceptButton = confirmation; prompt.CancelButton = cancel; DialogResult Result = prompt.ShowDialog(); if (Result == DialogResult.Cancel) return null; if (Result == DialogResult.OK) return textBox.Text; else return null; }
public static Point[] Draw(Pen pen, Form parent) { sPen = pen; // Record the start point mPos = parent.PointToClient(Control.MousePosition); // Create a transparent form on top of the parent form mMask = new Form(); mMask.FormBorderStyle = FormBorderStyle.None; mMask.BackColor = Color.Magenta; mMask.TransparencyKey = mMask.BackColor; mMask.ShowInTaskbar = false; mMask.StartPosition = FormStartPosition.Manual; mMask.Size = parent.ClientSize; mMask.Location = parent.PointToScreen(Point.Empty); mMask.MouseMove += MouseMove; mMask.MouseUp += MouseUp; mMask.Paint += PaintRectangle; mMask.Load += DoCapture; // Display the overlay mMask.ShowDialog(parent); // Clean-up and calculate return value mMask.Dispose(); mMask = null; var pos = parent.PointToClient(Control.MousePosition); return new[] {mPos, pos}; }
public void TampilkanGraph(bool autoClose) { form = new System.Windows.Forms.Form(); graph.GraphAttr.EdgeAttr.ArrowHeadAtTarget = Microsoft.Glee.Drawing.ArrowStyle.None; graph.GraphAttr.Orientation = Microsoft.Glee.Drawing.Orientation.Landscape; //contoh input //bind the graph to the viewer viewer.Graph = graph; //associate the viewer with the form form.SuspendLayout(); viewer.Dock = System.Windows.Forms.DockStyle.Fill; form.Controls.Add(viewer); form.ResumeLayout(); //show the form form.StartPosition = FormStartPosition.CenterParent; if (autoClose) { Task.Delay(TimeSpan.FromSeconds(0.75)) .ContinueWith((t) => form.Close(), TaskScheduler.FromCurrentSynchronizationContext()); } form.ShowDialog(); //System.Threading.Thread.Sleep(5000); //form.DialogResult = DialogResult.Abort; //form.Close(); //form = new System.Windows.Forms.Form(); //viewer = new Microsoft.Glee.GraphViewerGdi.GViewer(); }
// PVZ kitom skiltim private void apieToolStripMenuItem_Click(object sender, EventArgs e) { using (Form form = new Form()) { form.Text = apieToolStripMenuItem.Text; form.ClientSize = new System.Drawing.Size(1000, 500); form.MinimumSize = new System.Drawing.Size(1000, 500); RichTextBox about = new RichTextBox(); about.Dock = DockStyle.Fill; about.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F); about.Location = new System.Drawing.Point(4, 4); about.ReadOnly = true; about.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical; if (apieToolStripMenuItem.Text == "Apie") { about.Text = Alfredas.Properties.Resources.AboutLT; } else if (apieToolStripMenuItem.Text == "About") { about.Text = Alfredas.Properties.Resources.AboutEN; } else if (apieToolStripMenuItem.Text == "Описание") { about.Text = Alfredas.Properties.Resources.AboutRU; } form.Controls.Add(about); form.ShowDialog(); } }
/// <summary> /// 更新数据 /// </summary> /// <param name="form"></param> public void UpdateData(Form form) { if (form.ShowDialog() == DialogResult.OK) { this.DialogResult = DialogResult.OK; } }
private static DialogResult DisplayForm(object[] parms) { MenuItem mnu = (MenuItem)parms[0]; System.Windows.Forms.Form frm = CTechCore.Tools.Forms.IsFormInstantiated(mnu.RuntimeFormType).FirstOrDefault(); if (frm != null) { frm.Close(); frm.Dispose(); frm = null; } if (mnu.RequiresParametersOnConstructer) { frm = (System.Windows.Forms.Form)Activator.CreateInstance(mnu.RuntimeFormType, parms); } else { frm = (System.Windows.Forms.Form)Activator.CreateInstance(mnu.RuntimeFormType, new object[] { }); } frm.WindowState = FormWindowState.Normal; frm.StartPosition = FormStartPosition.CenterScreen; if (!mnu.DisplayAllFormBeforeLoad) { frm.MdiParent = CTechCore.Tools.Forms.IsFormInstantiated("frmMain").FirstOrDefault(); frm.Show(); } else { frm.ShowDialog(); } return(DialogResult.OK); }
public static string ShowDialog(string text, string caption) { Form prompt = new Form(); prompt.SizeGripStyle = SizeGripStyle.Hide; prompt.MaximizeBox = false; prompt.FormBorderStyle = FormBorderStyle.FixedSingle; prompt.Width = 500; prompt.Height = 150; prompt.Text = caption; Label textLabel = new Label() { Left = 50, Top=20, Text=text, Width=400 }; TextBox textBox = new TextBox() { Left = 50, Top=50, Width=400 }; Button confirmation = new Button() { Text = "Doorgaan", Left=350, Width=100, Top=80 }; confirmation.Click += (sender, e) => { if(textBox.Text.Length > 0) { prompt.Close(); } else { MessageBox.Show("Geen data ingevoerd. Voer de gevraagde gegevens in om door te gaan.", "Geen data ingevoerd.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }; prompt.Controls.Add(confirmation); prompt.Controls.Add(textLabel); prompt.Controls.Add(textBox); prompt.FormClosing += (sender, e) => { if(textBox.Text.Length == 0) { var result = MessageBox.Show("Geen data ingevoerd. Voer de gevraagde gegevens in om door te gaan. Druk op Annuleren om service te stoppen", "Geen data ingevoerd.", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation); if(result == DialogResult.Cancel){ Application.ExitThread(); } else { e.Cancel = true; } } }; prompt.ShowDialog(); return textBox.Text; }
private static DialogResult ChangeAdvisabilityFormula(ref string input) { System.Drawing.Size windowSize = new System.Drawing.Size(200, 60); Form inputBox = new Form(); inputBox.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; inputBox.ClientSize = windowSize; inputBox.Text = "Введите формулу в формате excel c букво-цифровой нотацией, заменяя цифровую составляющую знаком \"|\""; inputBox.StartPosition = FormStartPosition.CenterParent; System.Windows.Forms.TextBox keyField = new TextBox(); keyField.Text = input; keyField.Size = new System.Drawing.Size(windowSize.Width - 10, 23); keyField.Location = new System.Drawing.Point(5, 2); inputBox.Controls.Add(keyField); Button okButton = new 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(windowSize.Width / 2 - 37, 30); inputBox.Controls.Add(okButton); inputBox.AcceptButton = okButton; DialogResult result = inputBox.ShowDialog(); input = keyField.Text; return result; }
private void FileNew_menuitem_Click(object sender, EventArgs e) { string newFileName = ""; Form form = new Form(); form.Width = 500; form.Height = 150; form.FormBorderStyle = FormBorderStyle.FixedDialog; form.Text = "New Wizard Project File"; form.StartPosition = FormStartPosition.WindowsDefaultLocation; Label textLabel = new Label() { Left = 50, Top = 20, Text = "Name:" }; TextBox textBox = new TextBox() { Left = 50, Top = 50, Width = 400 }; Button confirmation = new Button() { Text = "Ok", Left = 350, Width = 100, Top = 70, DialogResult = DialogResult.OK }; confirmation.Click += (formsender, forme) => { newFileName = textBox.Text; form.Close(); }; form.Controls.Add(textBox); form.Controls.Add(confirmation); form.Controls.Add(textLabel); form.AcceptButton = confirmation; DialogResult result = form.ShowDialog(); if(DialogResult.OK == result) // Create new file { _CreateNewMasterFile(newFileName); } form.Close(); }
/// <summary> /// Shows a dialog box with a property grid. /// </summary> /// <param name="title"></param> /// <param name="value"></param> /// <returns></returns> public static DialogResult Show(string title, ref Entity_cl value) { Form mForm = new Form(); PropertyGrid mPropertyGrid = new PropertyGrid(); Button mOKButton = new Button(); mForm.Text = title + " Properties"; mPropertyGrid.SelectedObject = value; mOKButton.Text = "OK"; mOKButton.DialogResult = DialogResult.OK; mForm.ClientSize = new Size(320, 320); mPropertyGrid.SetBounds(4, 4, mForm.ClientSize.Width - 4, mForm.ClientSize.Height - 40); mOKButton.SetBounds(mForm.ClientSize.Width / 2 - 32, mForm.ClientSize.Height - 36, 64, 22); mPropertyGrid.Anchor = AnchorStyles.Top; mOKButton.Anchor = AnchorStyles.Bottom; mForm.Controls.AddRange(new Control[] { mPropertyGrid, mOKButton }); mForm.FormBorderStyle = FormBorderStyle.FixedSingle; mForm.StartPosition = FormStartPosition.CenterScreen; mForm.MinimizeBox = false; mForm.MaximizeBox = false; mForm.AcceptButton = mOKButton; DialogResult dialogResult = mForm.ShowDialog(); return dialogResult; }
private void viewLoadingScreenB_Click(object sender, EventArgs e) { Form loadinScreenForm = new Form(); loadinScreenForm.AutoScroll = true; loadinScreenForm.StartPosition = FormStartPosition.CenterScreen; loadinScreenForm.ShowIcon = false; loadinScreenForm.ShowInTaskbar = false; loadinScreenForm.MinimizeBox = false; loadinScreenForm.MaximizeBox = false; loadinScreenForm.FormBorderStyle = FormBorderStyle.FixedDialog; Bitmap topLeft = DHRC.GetTgaImage("LoadingScreenTL.tga"); Bitmap topRight = DHRC.GetTgaImage("LoadingScreenTR.tga"); Bitmap bottomLeft = DHRC.GetTgaImage("LoadingScreenBL.tga"); Bitmap bottomRight = DHRC.GetTgaImage("LoadingScreenBR.tga"); Bitmap bmp = new Bitmap(topLeft.Width + topRight.Width, topLeft.Height + bottomLeft.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb); Graphics g = Graphics.FromImage(bmp); g.DrawImageUnscaled(topLeft, 0, 0); g.DrawImageUnscaled(topRight, topLeft.Width, 0); g.DrawImageUnscaled(bottomLeft, 0, topLeft.Height); g.DrawImageUnscaled(bottomRight, topLeft.Width, topLeft.Height); loadinScreenForm.BackgroundImage = bmp; loadinScreenForm.BackgroundImageLayout = ImageLayout.None; loadinScreenForm.ClientSize = bmp.Size; loadinScreenForm.ShowDialog(); }
public override void Splash() { byte[] imageBytes = null; using (var imageStream = new System.IO.MemoryStream()) { imageStream.Write(imageBytes, 0, imageBytes.Length); using (var image = Image.FromStream(imageStream)) using (var displayForm = new Form { Width = 500, Height = 340, TopMost = true, BackColor = Color.Black, StartPosition = FormStartPosition.CenterParent, FormBorderStyle = FormBorderStyle.FixedToolWindow, BackgroundImage = image, BackgroundImageLayout = ImageLayout.None, Text = @"ReplaceMe1" }) { displayForm.ShowDialog(); } } }
private void RightClickMenuHandler(CommandBarButton Ctrl, ref bool CancelDefault) { //Point currentPos = GetPositionForShowing(this.Application.Selection); System.Windows.Forms.Form form = new System.Windows.Forms.Form(); //form.Location = currentPos; form.ShowDialog(); }
private void lnkLabel_Click(object sender, EventArgs e) { lnkFrm.ShowDialog(); if (lnkFrm.DialogResult == DialogResult.OK) { this.lvItem.SubItems[2].Text = lnkFrm.Tag.ToString(); } }
public void ShowWinForm(System.Windows.Forms.Form form) { QueueAction(() => { form.ShowDialog(); return; }); }
/// <summary> /// Shows the form as a modal dialog box with the application main window as the owner. /// </summary> public static DialogResult ShowDialog(this SolidEdgeFramework.Application application, System.Windows.Forms.Form form) { if (form == null) { throw new ArgumentNullException("form"); } return(form.ShowDialog(application.GetNativeWindow())); }
private static string ShowNameInputDialog(ref string input) { // Create form Font font = new Font("Courier New", 20); Size size = new Size(420, 150); System.Windows.Forms.Form inputBox = new System.Windows.Forms.Form(); inputBox.FormBorderStyle = FormBorderStyle.FixedDialog; inputBox.ClientSize = size; inputBox.StartPosition = FormStartPosition.CenterParent; inputBox.Text = "Name"; inputBox.MaximizeBox = false; inputBox.MinimizeBox = false; // Add a description Label label = new Label(); label.Size = new Size(size.Width - 10, 23); label.Location = new Point(5, 5); label.Text = "Enter a 3 character name"; label.Font = font; inputBox.Controls.Add(label); // Add textbox for a name TextBox textBox = new TextBox(); textBox.Size = new Size(size.Width - 10, 23); textBox.Location = new Point(5, 50); textBox.Text = input; textBox.Font = font; inputBox.Controls.Add(textBox); // Add an okay button Button okButton = new Button(); okButton.DialogResult = DialogResult.OK; okButton.Name = "okButton"; okButton.Size = new Size(75, 40); okButton.Text = "&OK"; okButton.Font = font; okButton.Location = new Point((int)(size.Width * 0.5 - 75 * 0.5), 100); inputBox.Controls.Add(okButton); inputBox.AcceptButton = okButton; // Only continue if the user has entered a 3 character letter name while (true) { inputBox.ShowDialog(); input = textBox.Text; if (input.Length == 3 && Regex.IsMatch(input, @"^[a-zA-Z]+$")) { return(input.ToUpper()); } } }
public System.Windows.Forms.DialogResult ShowDialog(System.Windows.Forms.Form dialog) { DialogResult result = dialog.ShowDialog(owner); if (result == DialogResult.OK) { } return(result); }
public void Draw() { UndirectedGraph <Vertex, QuickGraph.Edge <Vertex> > mG = new UndirectedGraph <Vertex, QuickGraph.Edge <Vertex> >(); List <Vertex> .Enumerator etV = mGraph.mVertices.GetEnumerator(); while (etV.MoveNext()) { mG.AddVertex(etV.Current); } List <Edge> .Enumerator etE = mGraph.mEdges.GetEnumerator(); while (etE.MoveNext()) { QuickGraph.Edge <Vertex> e = new Edge <Vertex>(etE.Current.mVertexA, etE.Current.mVertexB); mG.AddEdge(e); } Console.WriteLine("QUICK GRAPH FORMAT:"); Console.WriteLine(mG.VertexCount); Console.WriteLine(mG.EdgeCount); /* * var graphviz = new GraphvizAlgorithm<Vertex, Edge<Vertex>>(mG); * string output = graphviz.Generate(new FileDotEngine(), "graph"); * * Console.WriteLine("OUTPUT"); * Console.WriteLine(output); * * // Process drawProcess = new Process(); * Process.Start("dot","-Tpng graph.dot > graph.png"); */ var populator = GleeGraphUtility.Create <Vertex, Edge <Vertex> >(mG); populator.Compute(); Microsoft.Glee.Drawing.Graph gleeG = populator.GleeGraph; //create a viewer object Microsoft.Glee.GraphViewerGdi.GViewer viewer = new Microsoft.Glee.GraphViewerGdi.GViewer(); //create a form System.Windows.Forms.Form form = new System.Windows.Forms.Form(); //bind the graph to the viewer viewer.Graph = gleeG; //associate the viewer with the form form.SuspendLayout(); viewer.Dock = System.Windows.Forms.DockStyle.Fill; form.Controls.Add(viewer); form.ResumeLayout(); //show the form form.ShowDialog(); }
public void OpenDrugInfo() { var dr = this.dataGridView1.CurrentRow; if (dr == null) { return; } var druginfo = dr.DataBoundItem as Business.Models.PurchaseOrderImpt; Guid DrugId = druginfo.DrugInfoId; using (BaseFunctionForm bf = new Pharmacy.AppClient.UI.BaseFunctionForm()) { var di = bf.PharmacyDatabaseService.GetDrugInfo(out msg, DrugId); if (di == null) { return; } if (di.BusinessScopeCode.Contains("医疗器械")) { Forms.BaseDataManage.FormInstrument frm = new BaseDataManage.FormInstrument(); frm.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; frm.entity = di; Common.SetControls.SetControlReadonly(frm, true); frm.ShowDialog(); return; } if (di.BusinessScopeCode.Contains("保健食品")) { Forms.BaseDataManage.FormFood frm = new BaseDataManage.FormFood(); frm.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; frm.entity = di; Common.SetControls.SetControlReadonly(frm, true); frm.ShowDialog(); return; } UI.UserControls.ucGoodsInfo ucControl = new UserControls.ucGoodsInfo(di); System.Windows.Forms.Form f = new System.Windows.Forms.Form(); f.WindowState = System.Windows.Forms.FormWindowState.Normal; f.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; f.Text = di.ProductGeneralName; f.AutoSize = true; f.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; System.Windows.Forms.Panel p = new System.Windows.Forms.Panel(); p.AutoSize = true; p.Controls.Add(ucControl); f.Controls.Add(p); Forms.Common.SetControls.SetControlReadonly(f, true); f.ShowDialog(); f.Dispose(); } }
System.Windows.Forms.DialogResult System.Windows.Forms.Design.IUIService.ShowDialog(System.Windows.Forms.Form form) { if (ShowDialogDialog != null) { return(ShowDialogDialog(form)); } else { return(form.ShowDialog()); } }
private void f_print() { try { string sql = "select * from cd_phieucd order by reportname"; DataSet ds = m_m.get_data(sql); //ds.WriteXml("D:\\DMSo.xml",XmlWriteMode.WriteSchema); if (ds.Tables[0].Rows.Count > 0) { CrystalDecisions.Windows.Forms.CrystalReportViewer crystalReportViewer1 = new CrystalDecisions.Windows.Forms.CrystalReportViewer(); crystalReportViewer1.ActiveViewIndex = -1; crystalReportViewer1.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(239)), ((System.Byte)(239)), ((System.Byte)(239))); crystalReportViewer1.DisplayGroupTree = false; crystalReportViewer1.Dock = System.Windows.Forms.DockStyle.Fill; crystalReportViewer1.Name = "crystalReportViewer1"; crystalReportViewer1.ReportSource = null; crystalReportViewer1.Size = new System.Drawing.Size(792, 573); crystalReportViewer1.TabIndex = 85; System.Windows.Forms.Form af = new System.Windows.Forms.Form(); af.WindowState = FormWindowState.Maximized; af.Controls.Add(crystalReportViewer1); crystalReportViewer1.BringToFront(); crystalReportViewer1.Dock = System.Windows.Forms.DockStyle.Fill; string areport = "", asyt = "", abv = "", angayin = "", anguoiin = "", aghichu = ""; areport = "cd_phieucd.rpt"; asyt = m_m.Syte; abv = m_m.Tenbv; angayin = "Ngày " + DateTime.Now.Day.ToString().PadLeft(2, '0') + " tháng " + DateTime.Now.Month.ToString().PadLeft(2, '0') + " năm " + DateTime.Now.Year.ToString(); anguoiin = ""; aghichu = ""; ReportDocument cMain = new ReportDocument(); cMain.Load(@"..\..\..\Report\" + areport, OpenReportMethod.OpenReportByTempCopy); cMain.SetDataSource(ds); cMain.DataDefinition.FormulaFields["v_syt"].Text = "'" + asyt.ToUpper() + "'"; cMain.DataDefinition.FormulaFields["v_bv"].Text = "'" + abv.ToUpper() + "'"; cMain.DataDefinition.FormulaFields["v_ngayin"].Text = "'" + angayin + "'"; cMain.DataDefinition.FormulaFields["v_nguoiin"].Text = "'" + anguoiin + "'"; cMain.DataDefinition.FormulaFields["v_ghichu"].Text = "'" + aghichu + "'"; cMain.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperA4; cMain.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Portrait; crystalReportViewer1.ReportSource = cMain; af.Text = "Danh mục Máy xét nghiệm"; af.ShowDialog(); } else { MessageBox.Show("Trong Máy xét nghiệm không danh mục", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private string GetCaption() { if (PluginSettings.Caption) { // prompt for the caption here var f = new System.Windows.Forms.Form(); var btnOK = new System.Windows.Forms.Button(); var btnCancel = new System.Windows.Forms.Button(); var label = new System.Windows.Forms.Label(); var txt = new System.Windows.Forms.TextBox(); label.Text = "Caption?"; label.AutoSize = true; label.Location = new System.Drawing.Point(4, 12); txt.Text = ""; txt.TabIndex = 11; txt.Multiline = true; txt.Location = new System.Drawing.Point(54, 8); txt.Size = new System.Drawing.Size(268, 54); btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; btnCancel.Location = new System.Drawing.Point(250, 66); btnCancel.Name = "btnCancel"; btnCancel.Size = new System.Drawing.Size(68, 23); btnCancel.TabIndex = 71; btnCancel.Text = "&Cancel"; btnCancel.UseVisualStyleBackColor = true; btnOK.DialogResult = System.Windows.Forms.DialogResult.OK; btnOK.Location = new System.Drawing.Point(174, 66); btnOK.Name = "btnOK"; btnOK.Size = new System.Drawing.Size(68, 23); btnOK.TabIndex = 61; btnOK.Text = "&OK"; btnOK.UseVisualStyleBackColor = true; f.Controls.Add(label); f.Controls.Add(txt); f.Controls.Add(btnOK); f.Controls.Add(btnCancel); f.Name = "Caption"; f.Text = "Provide a caption..."; //f.ClientSize = new System.Drawing.Size(324, 118); f.MinimumSize = new System.Drawing.Size(342, 130); f.MaximumSize = new System.Drawing.Size(342, 130); var result = f.ShowDialog(); if (result == DialogResult.OK) { if (!String.IsNullOrEmpty(txt.Text)) { return(txt.Text); } } } return("uploaded from Cropper."); }