protected override void OnSelectText() { try { this.Cursor = Cursors.WaitCursor; var items = this.textListView.SelectedItems; if (items.Count == 0) { return; } var comment = items[0].Tag as Comment; this.Hide(); TextDrawer.DrawTexts(comment); this.Show(); } catch (Exception ex) { MessageDialog.ShowError(ex); } finally { this.Cursor = Cursors.Default; } }
public static void DrawTexts(Comment comment) { WindowController2.BringAutoCadToTop(); AutoCad.Command.Prepare(); AutoCad.Command.SetCurrentLayoutToModel(); //レイヤーを変える AutoCad.Db.LayerTableRecord.Make(Const.Layer.電気_コメント, CadColor.BlackWhite, Const.LineWeight.Default); AutoCad.Command.SetCurrentLayer(Const.Layer.電気_コメント); //テキストスタイルを作る AutoCad.Db.TextStyleTableRecord.Make(Const.Font.MSGothic, Const.Font.MSGothic); var textId = 0; do { textId = TextDrawer.DrawText(comment.Text, CadColor.Red); }while (!AutoCad.Status.IsCanceled()); if (textId != 0) { AutoCad.Db.Object.Erase(textId); } }