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

📄 gimagecombox.cs

📁 语音视频功能 里面实现了基本的QQ与语音对话
💻 CS
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using System.Diagnostics;
using System.ComponentModel.Design;
using System.Drawing.Design;
namespace gowk.controls
{
	/// <summary>
	/// GImageCombox 的摘要说明。
	/// </summary>
	public class GImageCombox:GComboxBase
	{
		public GImageCombox():base()
		{
			this.EditControl=new Control();
			this.EditControl.Visible=false;
			this.SelectedIndexChanged+=new EventHandler(GImageCombox_SelectedIndexChanged);
			this.BackColor=Color.White;
		}
		protected override void OnDrawItem(System.Windows.Forms.DrawItemEventArgs e)
		{
			if(e.Index==-1)return;

			bool focus=(e.State & DrawItemState.Focus)==DrawItemState.Focus;
			GComboxItem item=(GComboxItem)this.Items[e.Index];
			Rectangle imgRect=e.Bounds;
			imgRect.Inflate(-2,-2);
			if(focus)
			{
				imgRect.Offset(-1,-1);
			//	e.Graphics.FillRectangle(new SolidBrush(System.Drawing.SystemColors.Control),e.Bounds);
			}
			e.Graphics.FillRectangle(new SolidBrush(this.BackColor),e.Bounds);
			//draw image
			if(item.Image!=null)
			{
				e.Graphics.DrawImage(item.Image,imgRect);
			}
			if(focus)
				e.DrawFocusRectangle();
		}
		protected override void OnPaint(PaintEventArgs e)
		{
			base.OnPaint(e);
			this.OnDrawItem(new DrawItemEventArgs(e.Graphics,this.Font,this.ClientRectangle,this.SelectedIndex,DrawItemState.Default));
		}

		private void GImageCombox_SelectedIndexChanged(object sender, EventArgs e)
		{
			this.Invalidate();
		}
	}
}

⌨️ 快捷键说明

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