Debian Codegraph @

examples/prism-csharp.html

raw symbols SCIP
1 <h2>Comments</h2>
2 <pre><code>// Single line comment
3 /* Multi-line
4 comment */</code></pre>
5
6 <h2>Strings</h2>
7 <pre><code>"foo \"bar\" baz"
8 @"Verbatim strings"
9 @"Luis: ""Patrick, where did you get that overnight bag?""
10 Patrick: ""Jean Paul Gaultier.""";
11 </code></pre>
12
13 <h2>Full example</h2>
14 <pre><code>using System.Windows.Forms;
15 using System.Drawing;
16
17 public static DialogResult InputBox(string title, string promptText, ref string value)
18 {
19 Form form = new Form();
20 Label label = new Label();
21 TextBox textBox = new TextBox();
22 Button buttonOk = new Button();
23 Button buttonCancel = new Button();
24
25 form.Text = title;
26 label.Text = promptText;
27 textBox.Text = value;
28
29 buttonOk.Text = "OK";
30 buttonCancel.Text = "Cancel";
31 buttonOk.DialogResult = DialogResult.OK;
32 buttonCancel.DialogResult = DialogResult.Cancel;
33
34 label.SetBounds(9, 20, 372, 13);
35 textBox.SetBounds(12, 36, 372, 20);
36 buttonOk.SetBounds(228, 72, 75, 23);
37 buttonCancel.SetBounds(309, 72, 75, 23);
38
39 label.AutoSize = true;
40 textBox.Anchor = textBox.Anchor | AnchorStyles.Right;
41 buttonOk.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
42 buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
43
44 form.ClientSize = new Size(396, 107);
45 form.Controls.AddRange(new Control[] { label, textBox, buttonOk, buttonCancel });
46 form.ClientSize = new Size(Math.Max(300, label.Right + 10), form.ClientSize.Height);
47 form.FormBorderStyle = FormBorderStyle.FixedDialog;
48 form.StartPosition = FormStartPosition.CenterScreen;
49 form.MinimizeBox = false;
50 form.MaximizeBox = false;
51 form.AcceptButton = buttonOk;
52 form.CancelButton = buttonCancel;
53
54 DialogResult dialogResult = form.ShowDialog();
55 value = textBox.Text;
56 return dialogResult;
57 }</code></pre>