鼠标移动到dataGrid单元格,类容全部显示
2008-02-28 13:00
316 查看
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
}
}
相关文章推荐
- jquery 实现超出部分隐藏,鼠标移动上显示全部文字
- jquery 实现超出部分隐藏,鼠标移动上显示全部文字
- 选中表格中相应行的复选框,点击下面的“删除”按钮可以删除相应的行,选中下面的"全选"复选框,则所有行的复选框全部选中,取消则全部取消。 鼠标移动到封面上在旁边显示大图,鼠标移开,大图消失
- 文字显示不完全鼠标移动上去文字全部显示
- 窗口根据鼠标移动 tip显示全部信息
- 项目经历——截取超出长度的字符串,鼠标移动到上面显示全部内容
- Windows 7/8 中 ,QQ靠边自动隐藏后,鼠标移动到QQ上显示下拉后又自动缩上去,或者只显示一半,必须要拖动鼠标才能全部显示出来。
- 标题超过60个字符,显示省略号,鼠标移动到标题上面,显示全部标题的实现方式
- jquery 实现超出部分隐藏,鼠标移动上显示全部文字
- jquery 实现超出部分隐藏,鼠标移动上显示全部文字 .
- 基于css3的鼠标移动动画显示效果
- 通过鼠标的移动来实现层的隐藏与显示
- 挺漂亮的文字太长自动截断,鼠标移上显示全部信息例子
- 自己写的基于JavaScript DOM 仿一些页面的鼠标移动显示相应区块内容
- 自己写的基于JavaScript DOM 仿一些页面的鼠标移动显示相应区块内容
- 鼠标移动到图片显示大图的javascript代码
- 鼠标移动显示漂亮ALT窗口
- 鼠标移动到某处弹出一个显示信息框 代码
- 开机黑屏 仅仅显示鼠标 电脑黑屏 仅仅有鼠标 移动 [已成功解决]
- delphi treeview 鼠标移动显示hint信息