Richtextbox控件透明加入背景
来源:互联网 发布:mac电脑iphoto打不开 编辑:程序博客网 时间:2024/05/21 10:53
http://www.codeproject.com/cs/miscctrl/TransparentTextBox.asp
如何让Richtextbox控件透明:透明后你自己在后边设定背景图片吧,不过一般都很晃动
也有另外的方法来设置透明,用定时器刷新,如下地址:
http://www.codeproject.com/cs/miscctrl/AlphaBlendedTextControls.asp
RichTextBox
class TransparentControl : Control{ public TransparentControl() { base.SetStyle( ControlStyles.UserPaint, true ); base.SetStyle( ControlStyles.DoubleBuffer, true ); base.SetStyle( ControlStyles.SupportsTransparentBackColor, true ); }}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 ) { }}
TextBox
Collapse
public class TransparentTextBox : TextBox{ PictureBox pictureBox = new PictureBox(); public TransparentTextBox() { pictureBox.Dock = DockStyle.Fill; this.Controls.Add( pictureBox ); } protected override void WndProc( ref Message m ) { base.WndProc( ref m ); switch( m.Msg ) { case Win32.WM_PAINT: Bitmap bmpCaptured = new Bitmap( this.ClientRectangle.Width, this.ClientRectangle.Height ); Bitmap bmpResult = new Bitmap( this.ClientRectangle.Width,this.ClientRectangle.Height ); Rectangle r = new Rectangle( 0, 0, this.ClientRectangle.Width, this.ClientRectangle.Height ); CaptureWindow( this, ref bmpCaptured ); this.SetStyle( ControlStyles.SupportsTransparentBackColor, true ); this.BackColor = Color.Transparent; ImageAttributes imgAttrib = new ImageAttributes(); ColorMap[] colorMap = new ColorMap[ 1 ]; colorMap[ 0 ] = new ColorMap(); colorMap[ 0 ].OldColor = Color.White; colorMap[ 0 ].NewColor = Color.Transparent; imgAttrib.SetRemapTable( colorMap ); Graphics g = Graphics.FromImage( bmpResult ); g.DrawImage( bmpCaptured, r, 0 , 0, this.ClientRectangle.Width, this.ClientRectangle.Height, GraphicsUnit.Pixel, imgAttrib ); g.Dispose(); pictureBox.Image = ( Image )bmpResult.Clone(); break; case Win32.WM_HSCROLL: case Win32.WM_VSCROLL: this.Invalidate(); // repaint // if you use scrolling then add these two case statements break; }}private static void CaptureWindow( Control control, ref Bitmap bitmap ){ Graphics g = Graphics.FromImage( bitmap ); int i = ( int )( Win32.PRF_CLIENT | Win32.PRF_ERASEBKGND ); IntPtr iPtr = new IntPtr( 14 ); IntPtr hdc = g.GetHdc(); Win32.SendMessage( control.Handle, Win32.WM_PRINT, hdc, iPtr ); g.ReleaseHdc( hdc ); g.Dispose();}
- Richtextbox控件透明加入背景
- 在RichTextBox控件加入图片
- RichTextBox控件中加入图片
- RichTextBox控件中加入图片
- 控件透明背景
- VC控件背景透明
- QT 控件背景透明
- 控件背景透明代码
- 设置控件背景透明
- 静态控件背景透明
- VC 控件背景透明、文字背景透明
- 【c#】关于设置RichTextBox背景透明+无光标只读状态
- 博客技巧----如何加入透明Flash背景
- html控件透明与背景透明
- html 控件/元素 透明与背景透明
- 使控件拥有透明背景
- 设置Cstatic控件背景透明
- C#自定义控件背景透明
- javascript操作cookie
- http://www.w3cpro.cn/xhtml/index.html 的css
- JavaScript常用检测脚本
- 关于svchost.exe进程占用100%CPU使用率
- c#类模拟键盘和鼠标以及内存读取
- Richtextbox控件透明加入背景
- Javascript代码混淆综合解决方案-Javascript在线混淆器
- 成员数据库的建立.
- c++常用函数所在头文件一览
- Javascript的IE和Firefox兼容性汇编
- CSV文件格式介绍
- script 时间 格式
- 文兴宇因肺癌去世 名气大住的仅为普通病房
- 周杰伦深圳宣传新电影 演唱时险失足堕台(图)