如何消除自绘控件时的锯齿?在formload事件中加入以下代码:
System.Windows.Forms.Button myButton = new System.Windows.Forms.Button();
myButton.BackColor = Color.Blue; //Lets change the color
myButton.Size = new Size(100, 100);
System.Drawing.Drawing2D.GraphicsPath myGraphicsPath = new System.Drawing.Drawing2D.GraphicsPath(); //The GraphicsPath class allows us to define custom paths
myGraphicsPath.AddEllipse(5, 5, 90, 90); //A big circle
myButton.Region = new Region(myGraphicsPath); //Associating the path made by us to the button's region
this.Controls.Add(myButton);效果是画了一个圆形的按钮,但是边缘有锯齿,怎么消除?本来画图用smoothmode是可以的,但加了region就无效了。
System.Windows.Forms.Button myButton = new System.Windows.Forms.Button();
myButton.BackColor = Color.Blue; //Lets change the color
myButton.Size = new Size(100, 100);
System.Drawing.Drawing2D.GraphicsPath myGraphicsPath = new System.Drawing.Drawing2D.GraphicsPath(); //The GraphicsPath class allows us to define custom paths
myGraphicsPath.AddEllipse(5, 5, 90, 90); //A big circle
myButton.Region = new Region(myGraphicsPath); //Associating the path made by us to the button's region
this.Controls.Add(myButton);效果是画了一个圆形的按钮,但是边缘有锯齿,怎么消除?本来画图用smoothmode是可以的,但加了region就无效了。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货