using System; using System.Drawing; using System.Windows.Forms; public class FormByteSpy : Form { static public string strstr = ""; [System.STAThread] // Main の直前にこれがないとなぜか日本語入力とかできない! static void Main(string[] args) { // Main: プログラムが始まる特別なメソッド名 if (args != null && args.Length>0) { strstr += args[0]; } Application.Run(new FormByteSpy()); } // ======================================================================== private MyLPanel myL; public RichTextBox richU, rich; private string filename=""; private const string titlesuffix=" - ByteSpy"; private System.Drawing.Size fixedsize; string strlineend=(((char)13).ToString()+((char)10).ToString()); Timer timer; int YBASE = 20; // new ToolStripMenuItem // new menu_File, menuItem_File_SaveOver; public FormByteSpy() { this.Text = filename+titlesuffix; int wchars = 50, hchars = 50; int w=wchars*18+80+2, h = hchars*15+20+24; fixedsize = new System.Drawing.Size(w+16, h+38); // +16, +38 this.Size = new System.Drawing.Size(w+16, h+38); // +16, +38 // #################### file building #######################   MenuStrip mainmenu = new MenuStrip(); this.Controls.Add(mainmenu); // new menu_File=mainmenu.addItem("ファイル(&F)"); menu_File.addItem("新規(&N)", null, (o, e) => { // === by FormExtention if (OkSaving("現在の文書は、保存しますか ?")) { // Ok は下に定義 saveAsDialog("現在の文書に名前を付けて保存"); } rich.Text=""; this.filename=""; this.Text = this.filename+" - ByteSpy"; } ); menu_File.addItem("開く(コード; &O)", null, (o, e) => { if (menuItem_File_SaveOver.Enabled && rich.Text != "") { if (OkSaving("現在の文書は、保存しますか ?")) { saveAsDialog("現在の文書に名前を付けて保存"); } } this.loadAsDialog(); menuItem_File_SaveOver.Enabled = false; }); menuItem_File_SaveOver=menu_File.addItem("上書き保存(コード; &A)", null, (o, e) => { if (this.filename == "") { this.saveAsDialog("名前を付けて保存"); } else { this.save(this.filename); } } ); menu_File.addItem("名前をつけて保存(コード; &S)", null, (o, e) => { this.saveAsDialog("名前を付けて保存"); } ); menu_File.addItem("終了(&E)", null, (o, e) => { this.Dispose(true); } ); // ########################################################## { Label labelhere=Generate