Source/BarTextBox.cs

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Windows.Forms;

namespace DevComponents.DotNetBar
{
	/// <summary>
	/// Summary description for BarTextBox.
	/// </summary>
	internal class BarTextBox:TextBox
	{
		private int m_LastFocusWindow;
		private string m_OriginalText;
		public BarTextBox()
		{
			this.BorderStyle=System.Windows.Forms.BorderStyle.None;
			this.AutoSize=false;
			this.TabStop=false;
			m_LastFocusWindow=0;
		}

		protected override void WndProc(ref Message m)
		{
			if(m.Msg==NativeFunctions.WM_SETFOCUS)
			{
				m_LastFocusWindow=m.WParam.ToInt32();
				m_OriginalText=this.Text;
			}
			base.WndProc(ref m);
		}

		public void ReleaseFocus()
		{
			if(this.Focused && m_LastFocusWindow!=0)
			{
				int focus=m_LastFocusWindow;
				m_LastFocusWindow=0;
				Control ctrl=Control.FromChildHandle(new System.IntPtr(focus));
				if(ctrl!=this)
				{
					Control p=this.Parent;
					while(p!=null)
					{
						if(p==ctrl)
							return;
						p=p.Parent;
					}

					if(ctrl!=null)
						ctrl.Focus();
					else
					{
						NativeFunctions.SetFocus(focus);
					}
				}
                
				//this.OnLostFocus(new System.EventArgs());
				//this.InvokeLostFocus(this,new System.EventArgs());
			}
		}

后面还有 20 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。