現在C#を用いて、
マウスのドラッグで矩形を描くプログラムを作成しています。
描く矩形の形は、comboboxによって変えようと思います。
ObjSelectFrm.cs namespace ObjectSelectTool { public partial class ObjSelectFrm : Form { #region インターナルクラス /// <summary> /// 効果オブジェクトをコードのセットクラス /// </summary> internal class BaseImage { /// <summary> /// Image ファイル名称 /// </summary> public string Fname { set; get; } } #endregion #region プロパティ /// <summary> /// ユーザイベント /// </summary> public Event.ObjsEventCalled EventCalled { set { this.eventcalled = value; } get { return this.eventcalled; } } #endregion #region コンストラクター /// <summary> /// コンストラクター /// </summary> public ObjSelectFrm() { InitializeComponent(); this.cntlmouse = new SelectObjs.ControlMouse(); this.attrigrp = new SelectObjs.AttributeGroup(); this.eventcalled = new Event.ObjsEventCalled(); } #endregion #region プライベート変数 //ベース画像 private const string BASE_IMAGE = "\\fruit.jpg"; //マウス制御オブジェクト private SelectObjs.ControlMouse cntlmouse = null; //オブジェクトリスト管理 private SelectObjs.AttributeGroup attrigrp =null; //グラフィックス管理 private ToolGraphics.ContorlGraphics cntlgra = null; //ユーザイベント private Event.ObjsEventCalled eventcalled = null; #endregion #region フォームロード /// <summary> /// フォームロードイベント /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ObjSelectFrm_Load(object sender, EventArgs e) { //コンボボックスに要素を追加 comboBox1.Items.Add("四角形"); comboBox1.Items.Add("楕円形"); //コンボボックスの初期値設定 comboBox1.SelectedIndex = 0; } private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { } } }
このようなコンボボックスがあって、
外部のクラスでDrewしたいのですが、
その時に
if(){
DrawRectangle
}else{
DrawEllipse
}
としたいとき、ifのかっこの中の条件はどのようにしてあげればいいか
お教えいただきたいです。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2017/04/21 02:34
2017/04/21 07:53
2017/04/24 01:38