Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Winforms 鼠标滚轮事件滚动条c++;Visual Studio_Winforms_Visual Studio_Events_C++ Cli_Mousewheel - Fatal编程技术网

Winforms 鼠标滚轮事件滚动条c++;Visual Studio

Winforms 鼠标滚轮事件滚动条c++;Visual Studio,winforms,visual-studio,events,c++-cli,mousewheel,Winforms,Visual Studio,Events,C++ Cli,Mousewheel,我正在用windowForms制作一个程序,我想用鼠标滚轮做一些事情,比如用鼠标滚轮改变图像。我一直在微软网站上寻找答案,但我不明白。谁能给我一个关于鼠标滚轮事件的例子,以及我需要使用哪些库 这就是我需要使用的库 “#”使用” “#”使用” “#”使用” 公共引用类主窗口:公共系统::窗口::窗体::窗体 { 公众: mainWindow(void) { InitializeComponent(); // //TODO: A

我正在用windowForms制作一个程序,我想用鼠标滚轮做一些事情,比如用鼠标滚轮改变图像。我一直在微软网站上寻找答案,但我不明白。谁能给我一个关于鼠标滚轮事件的例子,以及我需要使用哪些库

这就是我需要使用的库

“#”使用”

“#”使用”

“#”使用”

公共引用类主窗口:公共系统::窗口::窗体::窗体

{

公众:

    mainWindow(void)

    {

         InitializeComponent();

       //

        //TODO: Add the constructor code here

       //
    }  
//在InitializeComponent()中,我写道:

每个函数的代码

 private: System::Void panel_album_info_Mouse_Wheel(System::Object^  sender, System::Windows::Forms::MouseEventArgs^  e) {
//if (tenho_o_rato_no_panel_do_album_info == true)
//{
    int movimento = e->Delta;
    label1->Text = "teste";

    if (movimento == 120)

        numero_de_deslocações_do_album += 1;
    else if (movimento == -120)
        numero_de_deslocações_do_album -= 1;
    label1->Text = numero_de_deslocações_do_album.ToString();
//}
//else
    //return;

 }


private: System::Void panel_album_info_MouseEnter(System::Object^  sender, System::EventArgs^  e) {


this->panel_album_info->Select(); //este tambem da mas nao sei qual é a diferença
//this->panel_album_info->Focus();

}

代码允许在不单击的情况下滚动某些内容。我要查看的组件位于面板对象内,因此我需要首先聚焦/选择面板对象。

如果要使用
winforms
,我想您需要
c++-cli
,而不是
c++
 private: System::Void panel_album_info_Mouse_Wheel(System::Object^  sender, System::Windows::Forms::MouseEventArgs^  e) {
//if (tenho_o_rato_no_panel_do_album_info == true)
//{
    int movimento = e->Delta;
    label1->Text = "teste";

    if (movimento == 120)

        numero_de_deslocações_do_album += 1;
    else if (movimento == -120)
        numero_de_deslocações_do_album -= 1;
    label1->Text = numero_de_deslocações_do_album.ToString();
//}
//else
    //return;

 }


private: System::Void panel_album_info_MouseEnter(System::Object^  sender, System::EventArgs^  e) {


this->panel_album_info->Select(); //este tambem da mas nao sei qual é a diferença
//this->panel_album_info->Focus();

}