protected override int ExecInternal() { if (ArgNum < 3) { throw new EventErrorException(this, "PSetコマンドの引数の数が違います"); } // 座標 var xx = (GetArgAsLong(2) + Event.BaseX); var yy = (GetArgAsLong(3) + Event.BaseY); // 描画色 var clr = Event.ObjColor; if (ArgNum == 4) { var opt = GetArgAsString(4); if (!ColorExtension.TryFromHexString(opt, out clr)) { throw new EventErrorException(this, "色指定が不正です"); } } // 座標は画面上にある? if (xx < 0 || GUI.MapPWidth <= xx || yy < 0 || GUI.MapPHeight <= yy) { return(EventData.NextID); } GUI.SaveScreen(); // 点を描画 SRC.GUIScrean.PSetCmd(new ScreanDrawOption(Event, clr), xx, yy); return(EventData.NextID); }
protected override int ExecInternal() { if (ArgNum < 5) { throw new EventErrorException(this, "Ovalコマンドの引数の数が違います"); } var x1 = (GetArgAsLong(2) + Event.BaseX); var y1 = (GetArgAsLong(3) + Event.BaseY); var rad = GetArgAsLong(4); var oval_ratio = GetArgAsDouble(5); var clr = Event.ObjColor; for (var i = 6; i <= ArgNum; i++) { var opt = GetArgAsString(i); if (Strings.Asc(opt) == 35) // # { if (!ColorExtension.TryFromHexString(opt, out clr)) { throw new EventErrorException(this, "色指定が不正です"); } } else { throw new EventErrorException(this, "Ovalコマンドに不正なオプション「" + opt + "」が使われています"); } } GUI.SaveScreen(); SRC.GUIScrean.OvalCmd(new ScreanDrawOption(Event, clr), x1, y1, rad, (float)oval_ratio); return EventData.NextID; }
protected override int ExecInternal() { if (ArgNum < 6) { throw new EventErrorException(this, "Arcコマンドの引数の数が違います"); } var x1 = (GetArgAsLong(2) + Event.BaseX); var y1 = (GetArgAsLong(3) + Event.BaseY); var rad = GetArgAsLong(4); // 円弧の開始・終了角度はstart,end で指定します。角度の指定は右向きが0度で、そこから時計と逆周りに増加していきます(例 上向きが90)。0から360までの値で指定して下さい。 var start_angle = GetArgAsDouble(5) % 360; var end_angle = GetArgAsDouble(6) % 360; // TODO 振る舞い確認していない // 塗りつぶしの際は角度を負の値にする必要がある if (Event.ObjFillStyle != FillStyle.VbFSTransparent) { start_angle = -start_angle; if (start_angle == 0d) { start_angle = -0.000001d; } end_angle = -end_angle; if (end_angle == 0d) { end_angle = -0.000001d; } } GUI.SaveScreen(); var clr = Event.ObjColor; for (var i = 7; i <= ArgNum; i++) { var opt = GetArgAsString(i); if (Strings.Asc(opt) == 35) // # { if (!ColorExtension.TryFromHexString(opt, out clr)) { throw new EventErrorException(this, "ColorFilterコマンドのカラー指定が不正です"); } } else { throw new EventErrorException(this, "Arcコマンドに不正なオプション「" + opt + "」が使われています"); } } SRC.GUIScrean.ArcCmd(new ScreanDrawOption(Event, clr), x1, y1, rad, (float)start_angle, (float)end_angle); return(EventData.NextID); }
protected override int ExecInternal() { if (ArgNum != 2) { throw new EventErrorException(this, "FillColorコマンドの引数の数が違います"); } var opt = GetArgAsString(2); Color color; if (!ColorExtension.TryFromHexString(opt, out color)) { throw new EventErrorException(this, "色指定が不正です"); } Event.ObjFillColor = color; return(EventData.NextID); }
protected override int ExecInternal() { Color clsColor = Color.Black; switch (ArgNum) { case 2: { var buf = GetArgAsString(2); if (!ColorExtension.TryFromHexString(buf, out clsColor)) { throw new EventErrorException(this, "色指定が不正です"); } break; } case 1: break; default: throw new EventErrorException(this, "Clsコマンドの引数の数が違います"); } SRC.GUIScrean.BoxCmd(new ScreanDrawOption { ForeColor = clsColor, FillColor = clsColor, FillStyle = VB.FillStyle.VbFSSolid, }, 0, 0, GUI.MainPWidth - 1, GUI.MainPHeight - 1); GUI.ScreenIsSaved = true; GUI.IsPictureVisible = true; GUI.IsCursorVisible = false; GUI.PaintedAreaX1 = GUI.MainPWidth; GUI.PaintedAreaY1 = GUI.MainPHeight; GUI.PaintedAreaX2 = -1; GUI.PaintedAreaY2 = -1; return(EventData.NextID); }
protected override int ExecInternal() { var fontOption = new DrawFontOption { FontFamily = GUI.CurrentPaintFont.Name, Bold = GUI.CurrentPaintFont.Bold, Italic = GUI.CurrentPaintFont.Italic, Size = GUI.CurrentPaintFont.Size, Color = GUI.CurrentPaintColor, }; // デフォルトの設定 if (ArgNum == 1) { GUI.ResetDrawString(); GUI.PermanentStringMode = false; GUI.KeepStringMode = false; } else { for (var i = 2; i <= ArgNum; i++) { var opt = GetArgAsString(i); switch (opt ?? "") { case "P明朝": { fontOption.FontFamily = "MS P明朝"; break; } case "Pゴシック": { fontOption.FontFamily = "MS Pゴシック"; break; } case "明朝": { fontOption.FontFamily = "MS 明朝"; break; } case "ゴシック": { fontOption.FontFamily = "MS ゴシック"; break; } case "Bold": fontOption.Bold = true; break; case "Italic": fontOption.Italic = true; break; case "Regular": fontOption.Bold = true; fontOption.Italic = true; break; case "通常": { GUI.PermanentStringMode = false; GUI.KeepStringMode = false; break; } case "背景": { GUI.PermanentStringMode = true; break; } case "保持": { GUI.KeepStringMode = true; break; } // 無視 case " ": case var @case when @case == "": { break; } default: { if (Strings.Right(opt, 2) == "pt") { // 文字サイズ opt = Strings.Left(opt, Strings.Len(opt) - 2); fontOption.Size = (float)Conversions.ToDouble(opt); } else if (Strings.Asc(opt) == 35 && Strings.Len(opt) == 7) { // 文字色 Color color; if (ColorExtension.TryFromHexString(opt, out color)) { fontOption.Color = color; } } else { // その他のフォント fontOption.FontFamily = opt; } break; } } } } GUI.SetDrawFont(fontOption); return(EventData.NextID); }
protected override int ExecInternal() { if (ArgNum < 5) { throw new EventErrorException(this, "Lineコマンドの引数の数が違います"); } var x1 = (GetArgAsLong(2) + Event.BaseX); var y1 = (GetArgAsLong(3) + Event.BaseY); var x2 = (GetArgAsLong(4) + Event.BaseX); var y2 = (GetArgAsLong(5) + Event.BaseY); GUI.SaveScreen(); var dtype = ""; var clr = Event.ObjColor; for (var i = 6; i <= ArgNum; i++) { var opt = GetArgAsString(i); if (Strings.Asc(opt) == 35) // # { if (!ColorExtension.TryFromHexString(opt, out clr)) { throw new EventErrorException(this, "色指定が不正です"); } } else { if (opt != "B" && opt != "BF") { throw new EventErrorException(this, "Lineコマンドに不正なオプション「" + opt + "」が使われています"); } dtype = opt; } } var drawOpt = new ScreanDrawOption(Event, clr); switch (dtype ?? "") { case "B": // Box SRC.GUIScrean.BoxCmd(drawOpt, x1, y1, x2, y2); break; case "BF": // Box Fill drawOpt.FillStyle = FillStyle.VbFSSolid; drawOpt.FillColor = drawOpt.ForeColor; SRC.GUIScrean.BoxCmd(drawOpt, x1, y1, x2, y2); break; default: // Line SRC.GUIScrean.LineCmd(drawOpt, x1, y1, x2, y2); break; } return(EventData.NextID); }
protected override int ExecInternal() { if (ArgNum < 2) { throw new EventErrorException(this, "ColorFilterコマンドの引数の数が違います"); } var late_refresh = false; Map.MapDrawIsMapOnly = false; var trans_par = 0.5d; for (var i = 3; i <= ArgNum; i++) { var buf = GetArgAsString(i); switch (buf ?? "") { case "非同期": { late_refresh = true; break; } case "マップ限定": { Map.MapDrawIsMapOnly = true; break; } default: { if (Strings.Right(buf, 1) == "%" && Information.IsNumeric(Strings.Left(buf, Strings.Len(buf) - 1))) { trans_par = GeneralLib.MaxDbl( 0d, GeneralLib.MinDbl(1d, Conversions.ToDouble(Strings.Left(buf, Strings.Len(buf) - 1)) / 100d)); } else { throw new EventErrorException(this, "ColorFilterコマンドに不正なオプション「" + buf + "」が使われています"); } break; } } } Color filter_color; { var buf = GetArgAsString(2); if (!ColorExtension.TryFromHexString(buf, out filter_color)) { throw new EventErrorException(this, "ColorFilterコマンドのカラー指定が不正です"); } } // マウスカーソルを砂時計に GUI.ChangeStatus(GuiStatus.WaitCursor); GUI.SetupBackground("フィルタ", "非同期", filter_color, trans_par); GUI.RedrawScreen(late_refresh); // マウスカーソルを元に戻す GUI.ChangeStatus(GuiStatus.Default); return(EventData.NextID); }