请教,AutoScaleMode属性的使用

梦想很遥远 2011-05-25 09:36:32
有个程序里面用的是已过时的AutoScale属性
由于这个是bool型的,可以进行if判定
代码
if (!page.Shown)
{
// Special testing needed for Forms
Form f = c as Form;

// AutoScaling can cause the Control/Form to be
if ((f != null) && (f.AutoScale))
{
// Workaround the problem where a form has a defined 'AutoScaleBaseSize' value. The
// first time it is shown it calculates the size of each contained control and scales
// as needed. But if the contained control is Dock=DockStyle.Fill it scales up/down so
// its not actually filling the space! Get around by hiding and showing to force correct
// calculation.
c.Show();
c.Hide();
}

// Only need extra logic first time around
page.Shown = true;
}


现在应该替换成AutoScaleMode,但是这个属性的语法是public AutoScaleMode AutoScaleMode { get; set; }
改成if ((f != null) && (f.AutoScaleMode))肯定是不行的
请教下,这个该怎么改啊?
...全文
864 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
yardloun 2011-09-11
  • 打赏
  • 举报
回复
请问这个是不是和自动调整分辨率有关系呢?
梦想很遥远 2011-05-26
  • 打赏
  • 举报
回复
琢磨出来了
一时犯傻。。。
其实这个地方用f.AutoScaleMode!=AutoScaleMode.None就过得去了

110,530

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧