1
我有一些验证码,它应该显示输入错误值时控件的最大/最小值。为什么我的C++/CLI工具提示不会显示?
在我的构造函数中我这样做:
m_wndToolTip = gcnew ToolTip(this->components);
m_wndToolTip->AutoPopDelay = 5000;
m_wndToolTip->InitialDelay = 10;
m_wndToolTip->ReshowDelay = 250;
m_wndToolTip->ShowAlways = true;// Force the ToolTip text to be displayed whether or not the form is active.
这是我的验证反射代码:
void MyGUI::IndicateValidationResult(Windows::Forms::Control^ control, bool isValid, String^ invalidReason)
{
// If the validation failed, make the background red. If not, turn it white.
if(isValid)
{
control->BackColor = Drawing::Color::White;
m_wndToolTip->Hide(control);
}
else
{
control->BackColor = Drawing::Color::LightCoral;
m_wndToolTip->Show(invalidReason, control);
}
}
...这是从我的文本框varous ValueChanged
方法调用。我试过使用显示,并且还有SetToolTip
和active = true
的组合,但似乎没有任何效果。
我见过another question asking about tooltips,并试图在调用中设置附近的标签来显示,但并没有解决它。工具提示是我的System::Windows::Forms::Form
派生形式中的成员变量,用于阻止它超出范围。
我错过了一些明显的东西吗?