private void Control_Note_DragDrop(object sender, DragEventArgs e) { Point locationMouse = this.PointToClient(new Point(e.X, e.Y)); string droppedText = null; string fileSave = ""; if (e.Data.GetDataPresent(DataFormats.FileDrop)) { // ファイルドロップ string[] fileNames = (string[])e.Data.GetData(DataFormats.FileDrop, false); if (this.Bounds.Contains(locationMouse.X, locationMouse.Y)) { foreach (string fileName in fileNames) { //System.Console.WriteLine(fileName); droppedText = File.ReadAllText(fileName); fileSave = fileName; //最初のファイルだけ対応 break; } } } else if (e.Data.GetDataPresent(DataFormats.StringFormat)) { // 文字列として読み取れる形式のデータがドロップされた場合、 // テキストボックスに、その文字列データを表示します。 if (this.Bounds.Contains(locationMouse.X, locationMouse.Y)) { droppedText = (string)e.Data.GetData(typeof(string)); //System.Console.WriteLine(droppedText); } } else { //log_Method.WriteDebug_ToConsole("ファイル以外のものをドロップした。"); } if (null != droppedText) { System.Console.WriteLine("ドロップがあったとき。"); if (this.Parent is Control_Perspective) { Control_Perspective perspective = (Control_Perspective)this.Parent; if (perspective.Parent is Form1) { Form1 form1 = (Form1)perspective.Parent; form1.Document = DocumentImpl.Import(droppedText, fileSave, form1.Document); } } this.Refresh(); } }
private void Form1_KeyDown(object sender, KeyEventArgs e) { Keys keys = e.KeyCode; int rowViewed = this.control_Perspective1.GetControl_Note1().GetRow_Viewed(); switch (keys) { case Keys.F5: //ドキュメントの再読込み。 if (File.Exists(this.Document.FileSave)) { string text = File.ReadAllText(this.Document.FileSave); int oldRowBeginview = this.Document.RowBeginview; this.Document = DocumentImpl.Import(text, this.Document.FileSave, this.Document); this.Document.RowBeginview = oldRowBeginview; this.Refresh(); } break; case Keys.PageDown: this.Document.RowBeginview += rowViewed / 2; this.Refresh(); break; case Keys.PageUp: this.Document.RowBeginview -= rowViewed / 2; if (this.Document.RowBeginview < 0) { this.Document.RowBeginview = 0; } this.Refresh(); break; } //System.Console.WriteLine("keyDown=["+keys.ToString()+"] "+Keys.PageDown+" "+Keys.PageUp); }
//──────────────────────────────────────── public Form1() { InitializeComponent(); //this.Document = new DocumentImpl(); //初期ドキュメント { StringBuilder sb = new StringBuilder(); sb.Append(""); sb.Append(Environment.NewLine); sb.Append("{AIMSサンプル『suica32』調査中}"); sb.Append(Environment.NewLine); sb.Append(""); sb.Append(Environment.NewLine); sb.Append(" <boot>{boot.lua}"); sb.Append(Environment.NewLine); sb.Append(" ┃"); sb.Append(Environment.NewLine); sb.Append(" ┗追加><frame>{s/frame.lua}"); sb.Append(Environment.NewLine); sb.Append(" :│"); sb.Append(Environment.NewLine); sb.Append(" :├作成→[黒画面左]"); sb.Append(Environment.NewLine); sb.Append(" :│"); sb.Append(Environment.NewLine); sb.Append(" :└作成→[黒画面右]"); sb.Append(Environment.NewLine); sb.Append(" :"); sb.Append(Environment.NewLine); sb.Append(" <logo>{s/logo.lua}"); sb.Append(Environment.NewLine); sb.Append(" :│"); sb.Append(Environment.NewLine); sb.Append(" :├作成→[「Loading...」]"); sb.Append(Environment.NewLine); sb.Append(" :│"); sb.Append(Environment.NewLine); sb.Append(" :└作成→[ロゴ]"); sb.Append(Environment.NewLine); sb.Append(" :"); sb.Append(Environment.NewLine); sb.Append(" <title>{s/title.lua}"); sb.Append(Environment.NewLine); sb.Append(" :│"); sb.Append(Environment.NewLine); sb.Append(" :└作成→[タイトル]"); sb.Append(Environment.NewLine); sb.Append(" :"); sb.Append(Environment.NewLine); sb.Append(" <game>{s/game.lua}"); sb.Append(Environment.NewLine); sb.Append(" :│"); sb.Append(Environment.NewLine); sb.Append(" :├作成→[\"padlistener\"/ゲームパッド制御]"); sb.Append(Environment.NewLine); sb.Append(" :│"); sb.Append(Environment.NewLine); sb.Append(" :├作成→[A.bg/背景]"); sb.Append(Environment.NewLine); sb.Append(" :│"); sb.Append(Environment.NewLine); sb.Append(" :├作成→[A.player \"player\"/プレイヤー]"); sb.Append(Environment.NewLine); sb.Append(" :│"); sb.Append(Environment.NewLine); sb.Append(" :├作成→[A.score \"pxf\"/スコアボード「SCORE 0000000000 HI 0000000000」]"); sb.Append(Environment.NewLine); sb.Append(" :│"); sb.Append(Environment.NewLine); sb.Append(" :├作成→[A.extend \"pxf\"/エクステンド「EXTEND0000000000」]"); sb.Append(Environment.NewLine); sb.Append(" :│"); sb.Append(Environment.NewLine); sb.Append(" :├作成→[A.level \"pxf\"/レベル「LEVEL 00」]"); sb.Append(Environment.NewLine); sb.Append(" :│"); sb.Append(Environment.NewLine); sb.Append(" :├作成→[A.lives \"lifecounter\"/ライフカウンター」]"); sb.Append(Environment.NewLine); sb.Append(" :│"); sb.Append(Environment.NewLine); sb.Append(" :├作成→[enemy]"); sb.Append(Environment.NewLine); sb.Append(" :│"); sb.Append(Environment.NewLine); sb.Append(" :├作成→[bullets]"); sb.Append(Environment.NewLine); sb.Append(" :│"); sb.Append(Environment.NewLine); sb.Append(" :├作成→[font]"); sb.Append(Environment.NewLine); sb.Append(" :│"); sb.Append(Environment.NewLine); sb.Append(" :├作成→[common.black]"); sb.Append(Environment.NewLine); sb.Append(" :│"); sb.Append(Environment.NewLine); sb.Append(" :├作成→[common.white]"); sb.Append(Environment.NewLine); sb.Append(" :│"); sb.Append(Environment.NewLine); sb.Append(" :├作成→[common.clear]"); sb.Append(Environment.NewLine); sb.Append(" :I"); sb.Append(Environment.NewLine); sb.Append(" :L開始V(thread_gameover){game.lua。<gameover>へチェンジ・シーンします。}"); sb.Append(Environment.NewLine); sb.Append(" :"); sb.Append(Environment.NewLine); sb.Append(" <gameover>{s/game.lua}"); sb.Append(Environment.NewLine); sb.Append(""); sb.Append(Environment.NewLine); sb.Append("{以上}"); sb.Append(Environment.NewLine); this.Document = DocumentImpl.Import(sb.ToString(), "", null); } }