⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gtextbox.cs

📁 语音视频功能 里面实现了基本的QQ与语音对话
💻 CS
字号:
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Drawing.Imaging;
namespace gowk.controls
{
	/// <summary>
	/// GTextBox 的摘要说明。
	/// </summary>
	public class GTextBox :GEditBase
	{
		private TextBox textbox;
		public GTextBox():base(new TextBox())
		{
			this.textbox=(TextBox)this.EditControl;
			this.textbox.BorderStyle = System.Windows.Forms.BorderStyle.None;
			this.Size=new Size(60,25);
			this.SetStyle(ControlStyles.SupportsTransparentBackColor,true);
		}	
		private 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 gowk.common.API.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 gowk.common.API.WM_HSCROLL:

					case gowk.common.API.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 )( gowk.common.API.PRF_CLIENT | gowk.common.API.PRF_ERASEBKGND );
				IntPtr iPtr = new IntPtr( 14 );
				IntPtr hdc = g.GetHdc();
				gowk.common.API.SendMessage( control.Handle, gowk.common.API.WM_PRINT, hdc, iPtr ); 
				g.ReleaseHdc( hdc );
				g.Dispose();
			}
		}
		public Char PasswordChar
		{
			get{return this.textbox.PasswordChar;}
			set{this.textbox.PasswordChar=value;}
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -