日期:2014-05-18  浏览次数:20936 次

c#重绘控件
c#重绘控件时怎样消除矩齿?
我的代码如下,哪位高手能帮忙指点一下
  private void button9_Paint(object sender, PaintEventArgs e)
  {

  Control c = sender as Control;
  GraphicsPath gp = new GraphicsPath();
  gp.AddEllipse(new Rectangle(0, 0, 50, c.Height - 2));
  c.Region = new Region(gp);
   
  }

------解决方案--------------------
提高下绘图质量试下,另:有些锯齿是消不掉的。
------解决方案--------------------
提高下绘图质量试下,另:有些锯齿是消不掉的。
------解决方案--------------------
CP上有篇custom anti-alias的文章写得不错,你可以搜索下。
------解决方案--------------------
把椭圆面积弄小点,把控件缩放大一些!
------解决方案--------------------
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;

设置graphics对象的属性
------解决方案--------------------
g.SmoothingMode = SmoothingMode.AntiAlias; 
指定抗锯齿
------解决方案--------------------

Graphics eg = e.Graphics;
eg.SmoothingMode = SmoothingMode.AntiAlias;
------解决方案--------------------

Graphics eg = e.Graphics;
eg.SmoothingMode = SmoothingMode.AntiAlias;