protected override void OnPaint(PaintEventArgs e)
{
using (BufferedGraphicsContext bufferContext = new BufferedGraphicsContext())
{
using (BufferedGraphics grafx = bufferContext.Allocate(e.Graphics, base.ClientRectangle))
{
grafx.Graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
grafx.Graphics.SmoothingMode = SmoothingMode.AntiAlias; // 画线操作。 grafx.Render(e.Graphics);
}
}
}
用到双缓冲,会将背景刷成黑色,如果能做到双缓冲并且透明?
{
using (BufferedGraphicsContext bufferContext = new BufferedGraphicsContext())
{
using (BufferedGraphics grafx = bufferContext.Allocate(e.Graphics, base.ClientRectangle))
{
grafx.Graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
grafx.Graphics.SmoothingMode = SmoothingMode.AntiAlias; // 画线操作。 grafx.Render(e.Graphics);
}
}
}
用到双缓冲,会将背景刷成黑色,如果能做到双缓冲并且透明?
this.SetStyle(ControlStyles.DoubleBuffer, true); //双缓冲
this.SetStyle(ControlStyles.UserPaint, true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
protected override void OnPaint(PaintEventArgs e)
{
e.Graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; // 画线操作。 e.Render(e.Graphics);
}
背景设置成白色的
透明的?应该没有这种
ControlStyles.OptimizedDoubleBuffer |
ControlStyles.ResizeRedraw, true); this.SetStyle(ControlStyles.DoubleBuffer, true);
this.SetStyle(ControlStyles.UserPaint, true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
加载在构造函数中。。试试,