tx.cs

来自「语音视频功能 里面实现了基本的QQ与语音对话」· CS 代码 · 共 56 行

CS
56
字号
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using System.Drawing.Imaging;
namespace gowk
{
	/// <summary>
	/// TX 的摘要说明。
	/// </summary>
	public class TX : gowk.controls.GRichTextBox
	{
		public TX()
		{
			this.ScrollBars=System.Windows.Forms.RichTextBoxScrollBars.None;
			this.BorderStyle=BorderStyle.None;
			this.SetStyle(ControlStyles.UserPaint,false);
			this.SetStyle(ControlStyles.AllPaintingInWmPaint,true);
		}


		protected override void WndProc(ref Message m)
		{
			if(m.Msg==gowk.common.API.WM_ERASEBKGND)
			{
			}
			if(m.Msg==gowk.common.API.WM_PAINT)
			{
				base.WndProc (ref m);

				Bitmap bm=new Bitmap(this.Width,this.Height);
				Graphics gbm=Graphics.FromImage(bm);
			//	if(this.img!=null)gbm.DrawImage(this.img,this.ClientRectangle);
				System.IntPtr hbm=gbm.GetHdc();
				IntPtr hdc=gowk.common.API.GetWindowDC(this.Handle);
				gowk.common.API.BitBlt(hbm,0,0,this.Width,this.Height,hdc,0,0,gowk.common.API.SRCCOPY);
				gbm.ReleaseHdc(hbm);
				gbm.Dispose();
				bm.MakeTransparent(this.BackColor);
				Graphics gdst=Graphics.FromHdc(hdc);
			//	gdst.Clear(Color.White);
				gdst.DrawImage(bm,this.ClientRectangle);
				gdst.Dispose();
				gowk.common.API.ReleaseDC(this.Handle,hdc);

			}
			else
			{
				base.WndProc (ref m);
			}
		}
	}
}

⌨️ 快捷键说明

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