Advertisement
kijato

c#_winforms_DEGREE_SIGN_FAIL.cs

Feb 19th, 2020 (edited)
487
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.67 KB | None | 0 0
  1. /*
  2. #!/usr/bin/mcs -r:System.Windows.Forms.dll -r:System.Drawing.dll
  3.  
  4. /usr/bin/mcs -debug+ -target:winexe -r:System.Windows.Forms.dll -r:System.Drawing.dll c#_winforms_base.cs
  5. /usr/bin/mcs -debug+ -target:winexe -r:System.Windows.Forms.dll -r:System.Drawing.dll -codepage:65001 -langversion:Experimental -out:c#_winforms_base_1.exe  c#_winforms_base.cs
  6.     Char    Dec     Hex     Entity  Name            URL
  7.     °      176     00B0    °   DEGREE SIGN     https://www.w3schools.com/charsets/ref_utf_latin1_supplement.asp   
  8.     ℃     8451    2103    -       DEGREE CELSIUS  https://www.w3schools.com/charsets/ref_utf_letterlike.asp
  9.  
  10. */
  11.  
  12. using System;
  13. using System.Windows.Forms;
  14. using System.Drawing;
  15.  
  16. public class Program
  17. {
  18.     static TextBox myTextBox;
  19.     static Label myLabel;
  20.    
  21.     [STAThread]
  22.     public static void Main()
  23.     {
  24.         try {
  25.  
  26.             var f = new Form();
  27.             f.Text = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
  28.             f.Size = new Size(400, 300);
  29.            
  30.             myTextBox = new TextBox { Location = new Point(10, 20), Text = "-", Width = 365, Height = 200, Multiline = true, WordWrap = true, ScrollBars = ScrollBars.Both, Anchor = ( AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right ) };
  31.            
  32.             f.Controls.Add(myTextBox);
  33.             myTextBox.TextChanged += new EventHandler (OnChange);
  34.  
  35.             myLabel = new Label { Location = new Point(10, 230), Text = "..." , Anchor = ( AnchorStyles.Bottom | AnchorStyles.Left ) };
  36.             f.Controls.Add(myLabel);
  37.            
  38.             Application.Run(f);
  39.  
  40.         } catch (Exception e) {
  41.             myLabel.Text = e.ToString();
  42.         }
  43.     }
  44.    
  45.     static private void OnChange (object sender, EventArgs e)
  46.     {
  47.         myLabel.Text = myTextBox.Text.Length.ToString();
  48.     }
  49.  
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement