using System;using System.Drawing;using System.Windows.Forms;namespace Common...{ public class ShowAllColumnText ...{ private System.Windows.Forms.DataGrid dg=null; public ShowAllColumnText(System.Windows.Forms.DataGrid dataGrid) ...{ dg=dataGrid; } ...#region bool showAll=true; public void MyMouseMove(object sender, System.Windows.Forms.MouseEventArgs e) ...{ if(showAll) ...{ Graphics gg=this.dg.CreateGraphics(); TextBox t=(TextBox)sender; int w=t.Size.Width; Point p=new Point(t.Location.X,e.Y+t.Location.Y+t.Height); DrawAllText(((TextBox)sender).Text,w,gg,dg.Font,p); showAll=false; } } public void MyMouseLeave(object sender, System.EventArgs e) ...{ showAll=true; dg.Refresh(); } private void DrawAllText(string text,int w,Graphics g,Font f,Point p) ...{ float h=f.GetHeight(); SizeF sf=g.MeasureString(text,f,w); int height=(int)sf.Height+5+(int)h; Size rsf=new Size(w,height); Rectangle rect= new Rectangle(p,rsf); RectangleF rectf= new RectangleF(new PointF(p.X,p.Y),new SizeF(rsf.Width,rsf.Height)); g.FillRectangle(Brushes.Gray,rect); g.DrawRectangle(new Pen(Color.Blue),rect); rectf= new RectangleF(new PointF(p.X+3,p.Y+3),new SizeF(sf.Width,sf.Height+(int)h)); g.DrawString(" "+text,f,Brushes.Blue,rectf); } #endregion }}