- - PR -
Paintイベントに特定の数字を渡す
1
投稿者 | 投稿内容 |
---|---|
|
投稿日時: 2006-09-29 18:05
private: System::Windows::Forms::PictureBox * pict __gc[];
pict = new PictureBox* __gc[times]; for(int i=0;i<times;i++){ this->pict[i] = new System::Windows::Forms::PictureBox(); this->pict[i]->Paint += new System::Windows::Forms::PaintEventHandler(this, pict_Paint); } private: System::Void pict_Paint(Object * sender, PaintEventArgs * e) {System::Drawing::Rectangle rect(i,i,24,16); e->Graphics->DrawImage(bmp,0,0,rect,GraphicsUnit::Pixel); } こんな感じで、複数のPictureBoxを作って、それぞれ同じ画像の別の場所を表示したいのですが、 それぞれのPaintイベントで、変数iを取得するにはどうすればいいのでしょうか? [ メッセージ編集済み 編集者: h-k 編集日時 2006-09-29 18:06 ] |
|
投稿日時: 2006-09-29 18:33
これは C++マネージド拡張 ですか?
C++マネージド拡張 のプログラムは書いたことがありませんが、pict_Paint()の中でpictの中のどこにsenderがあるか探せばいいんじゃないですか。 |
|
投稿日時: 2006-09-30 19:15
あ、なんかすごく勘違いしてました。。。
すみませんでした。。。 |
1