绘制到tabPage [英] Painting to a tabPage
本文介绍了绘制到tabPage的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,
我正在尝试编写一个程序,只要用户选择特定的tabPage,就需要将fillRectangles绘制到tabPage。我无法弄清楚如何做到这一点,因为我似乎需要以某种方式手动调用tabPage_Paint
事件,但我甚至不确定这是否是我必须要做的。
I am attempting to write a program that will need to paint fillRectangles to a tabPage anytime the user selects a specific tabPage. I am having trouble figuring out how to do this, as it seems like I would need to somehow manually call the tabPage_Paint event, but I'm not even sure if that's what I'd have to do.
本质上,代码应如下所示:
In essence, the code should look like this:
private: System::Void TabControl1_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e)
{
if(TabControl1->SelectedTab==tabPage1)
{
//Draw a fillRectangle on tabPage1
}
}
推荐答案
哇。 ..字面上刚刚意识到该怎么做。
Wow... literally just realized how to do it.
private: System::Void TabControl1_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e)
{
if(TabControl1->SelectedTab==MapTab)
{
System::Void MapTab_Paint(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e);
}
}
private: System::Void MapTab_Paint(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e)
{
e->Graphics->FillRectangle(Brushes::Red,x,y,30,30);
}
这篇关于绘制到tabPage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文