zy_abc Posted June 3, 2003 Posted June 3, 2003 How to create DataGridTextBoxColumn With Multiple Lines? Is it possible? Quote Thanks & Regards, zy_abc
donnacha Posted June 27, 2003 Posted June 27, 2003 did you find out how to do this yet. I have been searching for a solution to this for a while. It is possible to do as I have found a 3rd party component that does it, but I can not use this as I need to have all the code in my application. If you have solved this please let me know. Quote Hamlet
grivero Posted August 4, 2003 Posted August 4, 2003 First, create a class with this code... Public Class CNGridMultiLineTextBox Inherits System.Windows.Forms.DataGridTextBoxColumn Protected Overloads Overrides Sub Edit(ByVal source As CurrencyManager, ByVal rowNum As Integer, ByVal bounds As Rectangle, ByVal readOnly1 As Boolean, ByVal instantText As String, ByVal cellIsVisible As Boolean) DataGridTableStyle.DataGrid.Select(rowNum) End Sub Protected Overloads Overrides Sub Paint(ByVal g As System.Drawing.Graphics, ByVal bounds As System.Drawing.Rectangle, ByVal source As System.Windows.Forms.CurrencyManager, ByVal rowNum As Integer, ByVal backBrush As System.Drawing.Brush, ByVal foreBrush As System.Drawing.Brush, ByVal alignToRight As Boolean) MyBase.Paint(g, bounds, source, rowNum, backBrush, foreBrush, alignToRight) g.FillRectangle(backBrush, bounds) Dim vText As String If IsDBNull(MyBase.GetColumnValueAtRow(source, rowNum)) Then vText = "" Else vText = CType(MyBase.GetColumnValueAtRow(source, rowNum), String) End If g.DrawString(vText, Me.TextBox.Font, foreBrush, New RectangleF(bounds.X, bounds.Y, bounds.Width, bounds.Height)) End Sub Protected Overrides Sub ColumnStartedEditing(ByVal editingControl As System.Windows.Forms.Control) End Sub End Class Then update the rowheight of your grid. It did work for me. Quote
donnacha Posted August 12, 2003 Posted August 12, 2003 Hi grivero, I presume you mean updating the PrefferedRowHeight of the grid. If this is the case it canges all the rows of the grid, not just the ones that need to be changed. Quote Hamlet
andyHolland1000 Posted September 30, 2003 Posted September 30, 2003 Row heights I have the same problem. I can't set the individual row heights. This way relativly easy in VB6. Any suggestions? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.