BoldSign®Effortlessly integrate e-signatures into your app with the BoldSign® API. Create a sandbox account!
private void gridControl1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e) { if(e.ColIndex > 0 && e.RowIndex > 0) { if( this.gridControl1.ColWidths[e.ColIndex] - e.Style.TextMargins.Left - e.Style.TextMargins.Right < CreateGraphics().MeasureString(e.Style.Text, e.Style.GdipFont).Width ) e.Style.CellTipText = e.Style.Text; } }
private ToolTip toolTip1; private int hooverRow = -1; private int hooverCol = -1; private void Form1_Load(object sender, System.EventArgs e) { this.toolTip1 = new System.Windows.Forms.ToolTip(); toolTip1.InitialDelay = 500; //half a second delay toolTip1.ReshowDelay = 0; } private void gridControl1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { int row, col; if(this.gridControl1.PointToRowCol(new Point(e.X, e.Y), out row, out col) && (col != hooverCol || row != hooverRow)) { hooverCol = col; hooverRow = row; if(this.toolTip1 != null && this.toolTip1.Active) this.toolTip1.Active = false; //turn it off Graphics g = CreateGraphics(); GridStyleInfo style = this.gridControl1[row, col]; if( this.gridControl1.ColWidths[col] - style.TextMargins.Left - style.TextMargins.Right < g.MeasureString(style.Text, style.GdipFont).Width ) { this.toolTip1.SetToolTip(this.gridControl1, style.Text); this.toolTip1.Active = true; //make it active so it can show } g.Dispose(); } }