EDN Admin
Well-known member
Hello,
i have a small problem with MouseWheel Event. This Code does not work. WHY ?
I have MS VS CLI/C++ 2008SP1, a classic PictureBox on Form1.
<div style="font-family:Courier New; font-size:10pt; color:black; background:white
<p style="margin:0px <span style="color:#2b91af 89 <span style="color:blue private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
<p style="margin:0px <span style="color:#2b91af 90
<p style="margin:0px <span style="color:#2b91af 91 Bitmap^ b =
<span style="color:blue gcnew Bitmap( <span style="color:#a31515 "C:\1\p.bmp" );
<p style="margin:0px <span style="color:#2b91af 92
<p style="margin:0px <span style="color:#2b91af 93
<span style="color:blue this->pictureBox1->Image = <span style="color:blue
dynamic_cast<Image^>(b);
<p style="margin:0px <span style="color:#2b91af 94
<p style="margin:0px <span style="color:#2b91af 95
<span style="color:blue this->pictureBox1->MouseWheel += <span style="color:blue
gcnew System::Windows::Forms::MouseEventHandler(<span style="color:blue this, &Form1:ictureBox1_MouseWheel );
<p style="margin:0px <span style="color:#2b91af 96
<p style="margin:0px <span style="color:#2b91af 97
<span style="color:blue this->pictureBox1->Focus();
<p style="margin:0px <span style="color:#2b91af 98
<p style="margin:0px <span style="color:#2b91af 99 Console::WriteLine(<span style="color:#a31515 "Init ok ");
<p style="margin:0px <span style="color:#2b91af 100
<p style="margin:0px <span style="color:#2b91af 101 }<span style="color:green //
<p style="margin:0px <span style="color:green
<p style="margin:0px <span style="color:#2b91af 102
<p style="margin:0px <span style="color:#2b91af 103 <span style="color:blue private: System::Void pictureBox1_MouseWheel(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e) {
<p style="margin:0px <span style="color:#2b91af 104
<p style="margin:0px <span style="color:#2b91af 105 Console::WriteLine(<span style="color:#a31515 "MouseWheel: {0}", e->Delta );
<p style="margin:0px <span style="color:#2b91af 106
<p style="margin:0px <span style="color:#2b91af 107 }<span style="color:green //
<p style="margin:0px <span style="color:green
<p style="margin:0px <span style="color:green
<p style="margin:0px <span style="color:green Can anyone help ?
<p style="margin:0px <span style="color:green
<p style="margin:0px <span style="color:green Thanks.
<p style="margin:0px <span style="color:green
<p style="margin:0px <span style="color:green Jerry
<br/>
<br/>
<br/>
View the full article
i have a small problem with MouseWheel Event. This Code does not work. WHY ?
I have MS VS CLI/C++ 2008SP1, a classic PictureBox on Form1.
<div style="font-family:Courier New; font-size:10pt; color:black; background:white
<p style="margin:0px <span style="color:#2b91af 89 <span style="color:blue private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
<p style="margin:0px <span style="color:#2b91af 90
<p style="margin:0px <span style="color:#2b91af 91 Bitmap^ b =
<span style="color:blue gcnew Bitmap( <span style="color:#a31515 "C:\1\p.bmp" );
<p style="margin:0px <span style="color:#2b91af 92
<p style="margin:0px <span style="color:#2b91af 93
<span style="color:blue this->pictureBox1->Image = <span style="color:blue
dynamic_cast<Image^>(b);
<p style="margin:0px <span style="color:#2b91af 94
<p style="margin:0px <span style="color:#2b91af 95
<span style="color:blue this->pictureBox1->MouseWheel += <span style="color:blue
gcnew System::Windows::Forms::MouseEventHandler(<span style="color:blue this, &Form1:ictureBox1_MouseWheel );
<p style="margin:0px <span style="color:#2b91af 96
<p style="margin:0px <span style="color:#2b91af 97
<span style="color:blue this->pictureBox1->Focus();
<p style="margin:0px <span style="color:#2b91af 98
<p style="margin:0px <span style="color:#2b91af 99 Console::WriteLine(<span style="color:#a31515 "Init ok ");
<p style="margin:0px <span style="color:#2b91af 100
<p style="margin:0px <span style="color:#2b91af 101 }<span style="color:green //
<p style="margin:0px <span style="color:green
<p style="margin:0px <span style="color:#2b91af 102
<p style="margin:0px <span style="color:#2b91af 103 <span style="color:blue private: System::Void pictureBox1_MouseWheel(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e) {
<p style="margin:0px <span style="color:#2b91af 104
<p style="margin:0px <span style="color:#2b91af 105 Console::WriteLine(<span style="color:#a31515 "MouseWheel: {0}", e->Delta );
<p style="margin:0px <span style="color:#2b91af 106
<p style="margin:0px <span style="color:#2b91af 107 }<span style="color:green //
<p style="margin:0px <span style="color:green
<p style="margin:0px <span style="color:green
<p style="margin:0px <span style="color:green Can anyone help ?
<p style="margin:0px <span style="color:green
<p style="margin:0px <span style="color:green Thanks.
<p style="margin:0px <span style="color:green
<p style="margin:0px <span style="color:green Jerry
<br/>
<br/>
<br/>
View the full article