110,536
社区成员
发帖
与我相关
我的任务
分享
//定义一个支持透明背景色的透明控件
class TransparentControl : Control
{
public TransparentControl()
{
base.SetStyle( ControlStyles.UserPaint, true );
base.SetStyle( ControlStyles.DoubleBuffer, true );
base.SetStyle( ControlStyles.SupportsTransparentBackColor, true );
}
}
//扩展RichTextBox
class TransparentRichTextBox : RichTextBox
{
public TransparentRichTextBox()
{
base.ScrollBars = RichTextBoxScrollBars.None;
}
override protected CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x20;
return cp;
}
}
override protected void OnPaintBackground( PaintEventArgs e )
{
}
}