我想将richtextbox的背景色设置为透明在c#中可以帮我吗这是一个winform应用程序
public class TransparentLabel : RichTextBox
{
public TransparentLabel()
{
this.SetStyle(ControlStyles.Opaque, true);
this.SetStyle(ControlStyles.OptimizedDoubleBuffer, false);
this.TextChanged += TransparentLabel_TextChanged;
this.VScroll += TransparentLabel_TextChanged;
this.HScroll += TransparentLabel_TextChanged;
}
void TransparentLabel_TextChanged(object sender, System.EventArgs e)
{
this.ForceRefresh();
}
protected override CreateParams CreateParams
{
get
{
CreateParams parms = base.CreateParams;
parms.ExStyle |= 0x20; // Turn on WS_EX_TRANSPARENT
return parms;
}
}
public void ForceRefresh()
{
this.UpdateStyles();
}
}
答案是这样的:
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句