0
面板出現問題。 我添加指向一個面板與此代碼:當值超出邊界時,面板自動滾動
void panelDraw_Paint(object sender, PaintEventArgs e)
{
if (this.MeasuredValue == null)
return;
var g = e.Graphics;
int x = 0;
foreach (value m in this.MeasuredValue)
{
double percentage = m.MeasuredValue [(int)this.MeetType].GetValueOrDefault()/this.MaxValue * (double)100;
double y = this.Height/(double)100;
double pixels = y * percentage;
g.DrawRectangle(Pens.Green, x++, this.Height - (int)pixels, 1, 1);
g.DrawLine(Pens.GhostWhite, 0, this.Height/4, panelDraw.Width, this.Height/4);
g.DrawLine(Pens.GhostWhite, 0, this.Height/2, panelDraw.Width, this.Height/2);
g.DrawLine(Pens.GhostWhite, 0, (this.Height/4) * 3, panelDraw.Width, (this.Height/4) * 3);
if (x > panelDraw.Width)
{
panelDraw.AutoScroll = true;
}
}
}
我的面板的尺寸爲230; 218 I'ld喜歡看我的點當x熄滅的邊界(更大然後230)但不知何故自動滾屏不起作用.. 我也從一開始就在面板屬性上設置了AutoScroll爲true,但這也行不通。
這是我所得到的,當x比我的面板寬度較大:
http://i60.tinypic.com/5fp7ur.jpg
我怎麼能看到我點的時候,他們都出了面板的邊界?