Visual studio 2010 VC++;2010年-如果单击按钮1
我的剧本有点问题。我想检查按钮1是否在另一个事件中被单击(pictureBox_Click)。我怎么做呢 它应该是这样工作的:Visual studio 2010 VC++;2010年-如果单击按钮1,visual-studio-2010,visual-c++,c++-cli,Visual Studio 2010,Visual C++,C++ Cli,我的剧本有点问题。我想检查按钮1是否在另一个事件中被单击(pictureBox_Click)。我怎么做呢 它应该是这样工作的: private: System::Void pictureBox_Click(System::Object^ sender, System::EventArgs^ e) { if (button1 is clicked=true) { code; code; code; } if (button2 is clicked=true) { code;
private: System::Void pictureBox_Click(System::Object^ sender, System::EventArgs^ e) {
if (button1 is clicked=true)
{
code;
code;
code;
}
if (button2 is clicked=true)
{
code;
code;
code;
}
}
我将非常感谢您的帮助。您需要在变量中单击按钮时进行存储。为按钮单击事件添加事件处理程序,并存储值
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
{
buttonClicked = true;
}
private: System::Void pictureBox_Click(System::Object^ sender, System::EventArgs^ e)
{
if (buttonClicked)
{
// ...
听起来很糟糕。当然,这应该是一个复选框。