我正在编写一个继承自PictureBox的PlotBox控件。每次控件改变其大小时,我都想重绘一下。如果我做那样的事情:
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
Replot();
}
private void Replot()
{
//logic goes here, for example:
int width = Size.Width;
int height = Size.Height;
}
width
和height
变量是否会保留新的控件大小?我还应该考虑其他问题吗?
答案 0 :(得分:2)
在调用Replot()
方法时,大小已经更新。