Any other workarounds for the totally screwball right-alignment on datagrid?

  • Thread starter Thread starter Earl
  • Start date Start date
E

Earl

Any known fixes for the wacky right-alignment bug in the WinForms datagrid
(VS2003)?

I've tried Ken's workaround
(http://www.windowsformsdatagridhelp.com/default.aspx?ID=4bfab32d-9cff-4f5c-ba95-49bb9074a8bc),
but I get no alignment at all when calling the class.

George Shephard's site, while imminently useful, does not have an anwer for
this issue.

I posted on this topic about a year ago, and went in circles with Microsoft
who wanted to pretend that there was some bug in my code instead of in their
control. Enough time has passed and enough developers have posted on this
issue, that I must say, no, I am not interested in wanting to "learn more"
about 1 million MSDN webpages that are non-specific to this issue.
 
Hi,

If the mappingname is wrong for the tablestyle the tablestyle
will not work. Post some code

Ken
---------------
Any known fixes for the wacky right-alignment bug in the WinForms datagrid
(VS2003)?

I've tried Ken's workaround
(http://www.windowsformsdatagridhelp.com/default.aspx?ID=4bfab32d-9cff-4f5c-ba95-49bb9074a8bc),
but I get no alignment at all when calling the class.

George Shephard's site, while imminently useful, does not have an anwer for
this issue.

I posted on this topic about a year ago, and went in circles with Microsoft
who wanted to pretend that there was some bug in my code instead of in their
control. Enough time has passed and enough developers have posted on this
issue, that I must say, no, I am not interested in wanting to "learn more"
about 1 million MSDN webpages that are non-specific to this issue.
 
'using a read-only datagrid to show a summary
'code not commented out gives the Microsoft-standard smashed-in right
alignment
'code that IS commented out are lines used to call your class
'the connection, fill, stored procedure, etc. have worked fine for 2+ years,
display is only issue
'your class is shown at the bottom

Private Sub ShowSummaryHistory()

DataGrid1.DataSource = Nothing

dtHistory.Clear()
ds.Clear()
Dim strSQLServer As New SqlConnection(strConnString)
Dim cmd As New SqlCommand("GetJobSummaryHistory", strSQLServer)
cmd.CommandType = CommandType.StoredProcedure
cmd.Connection = strSQLServer
strSQLServer.Open()
Dim da As New SqlDataAdapter(cmd)
da.Fill(ds, "dtHistory")
dtHistory = ds.Tables("dtHistory")
DataGrid1.DataSource = dtHistory
AdjustTableStyle()

End Sub

Private Sub AdjustTableStyle()

Dim tblStyle As New DataGridTableStyle
tblStyle.MappingName = "dtHistory"
DataGrid1.TableStyles.Clear()
DataGrid1.TableStyles.Add(tblStyle)

'Dim tbcSaleDate As New HeaderAndDataAlignColumn

Dim tbcSaleDate As DataGridTextBoxColumn =
CType(tblStyle.GridColumnStyles("SaleDate"), DataGridTextBoxColumn)
tbcSaleDate.MappingName = "SaleDate"

'this was not used with your class
tbcSaleDate.Alignment = HorizontalAlignment.Right

'this however, was
'tbcSaleDate.DataAlignment = HorizontalAlignment.Right

tbcSaleDate.HeaderText = "Sold"
tbcSaleDate.Width = 65
tbcSaleDate.NullText = ""

..... adding more columns

DataGrid1.CaptionText = "Job Summaries"
DataGrid1.ReadOnly = True

End Sub


Public Class HeaderAndDataAlignColumn
Inherits DataGridTextBoxColumn
Private mTxtAlign As HorizontalAlignment = HorizontalAlignment.Left
Private mDrawTxt As New StringFormat
Protected Overloads Overrides Sub Edit(ByVal source As
System.Windows.Forms.CurrencyManager, _
ByVal rowNum As Integer, ByVal bounds As System.Drawing.Rectangle, ByVal
[readOnly] As Boolean, _
ByVal instantText As String, ByVal cellIsVisible As Boolean)
MyBase.Edit(source, rowNum, bounds, [readOnly], instantText, cellIsVisible)
MyBase.TextBox.TextAlign = mTxtAlign
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)
'clear the cell
g.FillRectangle(backBrush, bounds)
'draw the value
Dim s As String = Me.GetColumnValueAtRow([source], rowNum).ToString()
Dim r As Rectangle = bounds
r.Inflate(0, -1)
g.DrawString(s, MyBase.TextBox.Font, foreBrush, RectangleF.op_Implicit(r),
mDrawTxt)
End Sub

Public Property DataAlignment() As HorizontalAlignment
Get
Return mTxtAlign
End Get
Set(ByVal Value As HorizontalAlignment)
mTxtAlign = Value
If mTxtAlign = HorizontalAlignment.Center Then
mDrawTxt.Alignment = StringAlignment.Center
ElseIf mTxtAlign = HorizontalAlignment.Right Then
mDrawTxt.Alignment = StringAlignment.Far
Else
mDrawTxt.Alignment = StringAlignment.Near
End If
End Set
End Property

End Class
 
Just a note to keep this thread alive -- do you see anything wrong with the
code I wrote to implement your class Ken?
 
Hi,

I do not see where you add the columns to the tablestyle. Add
all the columns to the tablestyle before you add it to the datagrid. When
you add a tablestyle to a grid set the tablestyle's readonly property
instead of the datagrids.

Ken
-------------
'using a read-only datagrid to show a summary
'code not commented out gives the Microsoft-standard smashed-in right
alignment
'code that IS commented out are lines used to call your class
'the connection, fill, stored procedure, etc. have worked fine for 2+ years,
display is only issue
'your class is shown at the bottom

Private Sub ShowSummaryHistory()

DataGrid1.DataSource = Nothing

dtHistory.Clear()
ds.Clear()
Dim strSQLServer As New SqlConnection(strConnString)
Dim cmd As New SqlCommand("GetJobSummaryHistory", strSQLServer)
cmd.CommandType = CommandType.StoredProcedure
cmd.Connection = strSQLServer
strSQLServer.Open()
Dim da As New SqlDataAdapter(cmd)
da.Fill(ds, "dtHistory")
dtHistory = ds.Tables("dtHistory")
DataGrid1.DataSource = dtHistory
AdjustTableStyle()

End Sub

Private Sub AdjustTableStyle()

Dim tblStyle As New DataGridTableStyle
tblStyle.MappingName = "dtHistory"
DataGrid1.TableStyles.Clear()
DataGrid1.TableStyles.Add(tblStyle)

'Dim tbcSaleDate As New HeaderAndDataAlignColumn

Dim tbcSaleDate As DataGridTextBoxColumn =
CType(tblStyle.GridColumnStyles("SaleDate"), DataGridTextBoxColumn)
tbcSaleDate.MappingName = "SaleDate"

'this was not used with your class
tbcSaleDate.Alignment = HorizontalAlignment.Right

'this however, was
'tbcSaleDate.DataAlignment = HorizontalAlignment.Right

tbcSaleDate.HeaderText = "Sold"
tbcSaleDate.Width = 65
tbcSaleDate.NullText = ""

..... adding more columns

DataGrid1.CaptionText = "Job Summaries"
DataGrid1.ReadOnly = True

End Sub


Public Class HeaderAndDataAlignColumn
Inherits DataGridTextBoxColumn
Private mTxtAlign As HorizontalAlignment = HorizontalAlignment.Left
Private mDrawTxt As New StringFormat
Protected Overloads Overrides Sub Edit(ByVal source As
System.Windows.Forms.CurrencyManager, _
ByVal rowNum As Integer, ByVal bounds As System.Drawing.Rectangle, ByVal
[readOnly] As Boolean, _
ByVal instantText As String, ByVal cellIsVisible As Boolean)
MyBase.Edit(source, rowNum, bounds, [readOnly], instantText, cellIsVisible)
MyBase.TextBox.TextAlign = mTxtAlign
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)
'clear the cell
g.FillRectangle(backBrush, bounds)
'draw the value
Dim s As String = Me.GetColumnValueAtRow([source], rowNum).ToString()
Dim r As Rectangle = bounds
r.Inflate(0, -1)
g.DrawString(s, MyBase.TextBox.Font, foreBrush, RectangleF.op_Implicit(r),
mDrawTxt)
End Sub

Public Property DataAlignment() As HorizontalAlignment
Get
Return mTxtAlign
End Get
Set(ByVal Value As HorizontalAlignment)
mTxtAlign = Value
If mTxtAlign = HorizontalAlignment.Center Then
mDrawTxt.Alignment = StringAlignment.Center
ElseIf mTxtAlign = HorizontalAlignment.Right Then
mDrawTxt.Alignment = StringAlignment.Far
Else
mDrawTxt.Alignment = StringAlignment.Near
End If
End Set
End Property

End Class
 
Thanks for the reply Ken.

As shown in the code, the columns were added to the tablestyle after I
created the tablestyle (see tbcSaleDate).

However, the columns were added to the tablestyle AFTER I added it to the
datagrid (I'm not aware of a technique to prevent an exception trying that
your way).

Changing the tablestyle to readonly instead of the datagrid to readonly
didn't fix the right-alignment appearance.

In sum, here are the steps I used in the previous code to create a new
tablestyle. I'm still totally baffled by this crashed-in right-alignment
issue.

1. Set the datagrid datasource (DataGrid1.DataSource = dtHistory)
2. Create a new tablestyle (Dim tblStyle As New DataGridTableStyle)
3. Set the tablestyle mapping name (either tblStyle.MappingName =
"dtHistory" or tblStyle.MappingName = dtHistory.TableName.ToString)
4. Set the tablestyle to readonly
5. Clear the default datagrid tablestyle (DataGrid1.TableStyles.Clear()
6. Add the new tablestyle to the datagrid
(DataGrid1.TableStyles.Add(tblStyle))
7. Create the new datacolumns (Dim tbcSaleDate As DataGridTextBoxColumn =
CType(tblStyle.GridColumnStyles("SaleDate"), DataGridTextBoxColumn))



Ken Tucker said:
Hi,

I do not see where you add the columns to the tablestyle. Add
all the columns to the tablestyle before you add it to the datagrid. When
you add a tablestyle to a grid set the tablestyle's readonly property
instead of the datagrids.

Ken
-------------
'using a read-only datagrid to show a summary
'code not commented out gives the Microsoft-standard smashed-in right
alignment
'code that IS commented out are lines used to call your class
'the connection, fill, stored procedure, etc. have worked fine for 2+
years,
display is only issue
'your class is shown at the bottom

Private Sub ShowSummaryHistory()

DataGrid1.DataSource = Nothing

dtHistory.Clear()
ds.Clear()
Dim strSQLServer As New SqlConnection(strConnString)
Dim cmd As New SqlCommand("GetJobSummaryHistory", strSQLServer)
cmd.CommandType = CommandType.StoredProcedure
cmd.Connection = strSQLServer
strSQLServer.Open()
Dim da As New SqlDataAdapter(cmd)
da.Fill(ds, "dtHistory")
dtHistory = ds.Tables("dtHistory")
DataGrid1.DataSource = dtHistory
AdjustTableStyle()

End Sub

Private Sub AdjustTableStyle()

Dim tblStyle As New DataGridTableStyle
tblStyle.MappingName = "dtHistory"
DataGrid1.TableStyles.Clear()
DataGrid1.TableStyles.Add(tblStyle)

'Dim tbcSaleDate As New HeaderAndDataAlignColumn

Dim tbcSaleDate As DataGridTextBoxColumn =
CType(tblStyle.GridColumnStyles("SaleDate"), DataGridTextBoxColumn)
tbcSaleDate.MappingName = "SaleDate"

'this was not used with your class
tbcSaleDate.Alignment = HorizontalAlignment.Right

'this however, was
'tbcSaleDate.DataAlignment = HorizontalAlignment.Right

tbcSaleDate.HeaderText = "Sold"
tbcSaleDate.Width = 65
tbcSaleDate.NullText = ""

.... adding more columns

DataGrid1.CaptionText = "Job Summaries"
DataGrid1.ReadOnly = True

End Sub


Public Class HeaderAndDataAlignColumn
Inherits DataGridTextBoxColumn
Private mTxtAlign As HorizontalAlignment = HorizontalAlignment.Left
Private mDrawTxt As New StringFormat
Protected Overloads Overrides Sub Edit(ByVal source As
System.Windows.Forms.CurrencyManager, _
ByVal rowNum As Integer, ByVal bounds As System.Drawing.Rectangle, ByVal
[readOnly] As Boolean, _
ByVal instantText As String, ByVal cellIsVisible As Boolean)
MyBase.Edit(source, rowNum, bounds, [readOnly], instantText,
cellIsVisible)
MyBase.TextBox.TextAlign = mTxtAlign
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)
'clear the cell
g.FillRectangle(backBrush, bounds)
'draw the value
Dim s As String = Me.GetColumnValueAtRow([source], rowNum).ToString()
Dim r As Rectangle = bounds
r.Inflate(0, -1)
g.DrawString(s, MyBase.TextBox.Font, foreBrush, RectangleF.op_Implicit(r),
mDrawTxt)
End Sub

Public Property DataAlignment() As HorizontalAlignment
Get
Return mTxtAlign
End Get
Set(ByVal Value As HorizontalAlignment)
mTxtAlign = Value
If mTxtAlign = HorizontalAlignment.Center Then
mDrawTxt.Alignment = StringAlignment.Center
ElseIf mTxtAlign = HorizontalAlignment.Right Then
mDrawTxt.Alignment = StringAlignment.Far
Else
mDrawTxt.Alignment = StringAlignment.Near
End If
End Set
End Property

End Class



Ken Tucker said:
Hi,

If the mappingname is wrong for the tablestyle the tablestyle
will not work. Post some code

Ken
---------------
Any known fixes for the wacky right-alignment bug in the WinForms
datagrid
(VS2003)?

I've tried Ken's workaround
(http://www.windowsformsdatagridhelp.com/default.aspx?ID=4bfab32d-9cff-4f5c-ba95-49bb9074a8bc),
but I get no alignment at all when calling the class.

George Shephard's site, while imminently useful, does not have an anwer
for
this issue.

I posted on this topic about a year ago, and went in circles with
Microsoft
who wanted to pretend that there was some bug in my code instead of in
their
control. Enough time has passed and enough developers have posted on this
issue, that I must say, no, I am not interested in wanting to "learn
more"
about 1 million MSDN webpages that are non-specific to this issue.
 
Oooooook ... I think I've found something here. Instantiating the columns at
the same time as I'm attaching them to the table style may be creating this
issue. Hold your fire until I experiment a little more.

Ken Tucker said:
Hi,

I do not see where you add the columns to the tablestyle. Add
all the columns to the tablestyle before you add it to the datagrid. When
you add a tablestyle to a grid set the tablestyle's readonly property
instead of the datagrids.

Ken
-------------
'using a read-only datagrid to show a summary
'code not commented out gives the Microsoft-standard smashed-in right
alignment
'code that IS commented out are lines used to call your class
'the connection, fill, stored procedure, etc. have worked fine for 2+
years,
display is only issue
'your class is shown at the bottom

Private Sub ShowSummaryHistory()

DataGrid1.DataSource = Nothing

dtHistory.Clear()
ds.Clear()
Dim strSQLServer As New SqlConnection(strConnString)
Dim cmd As New SqlCommand("GetJobSummaryHistory", strSQLServer)
cmd.CommandType = CommandType.StoredProcedure
cmd.Connection = strSQLServer
strSQLServer.Open()
Dim da As New SqlDataAdapter(cmd)
da.Fill(ds, "dtHistory")
dtHistory = ds.Tables("dtHistory")
DataGrid1.DataSource = dtHistory
AdjustTableStyle()

End Sub

Private Sub AdjustTableStyle()

Dim tblStyle As New DataGridTableStyle
tblStyle.MappingName = "dtHistory"
DataGrid1.TableStyles.Clear()
DataGrid1.TableStyles.Add(tblStyle)

'Dim tbcSaleDate As New HeaderAndDataAlignColumn

Dim tbcSaleDate As DataGridTextBoxColumn =
CType(tblStyle.GridColumnStyles("SaleDate"), DataGridTextBoxColumn)
tbcSaleDate.MappingName = "SaleDate"

'this was not used with your class
tbcSaleDate.Alignment = HorizontalAlignment.Right

'this however, was
'tbcSaleDate.DataAlignment = HorizontalAlignment.Right

tbcSaleDate.HeaderText = "Sold"
tbcSaleDate.Width = 65
tbcSaleDate.NullText = ""

.... adding more columns

DataGrid1.CaptionText = "Job Summaries"
DataGrid1.ReadOnly = True

End Sub


Public Class HeaderAndDataAlignColumn
Inherits DataGridTextBoxColumn
Private mTxtAlign As HorizontalAlignment = HorizontalAlignment.Left
Private mDrawTxt As New StringFormat
Protected Overloads Overrides Sub Edit(ByVal source As
System.Windows.Forms.CurrencyManager, _
ByVal rowNum As Integer, ByVal bounds As System.Drawing.Rectangle, ByVal
[readOnly] As Boolean, _
ByVal instantText As String, ByVal cellIsVisible As Boolean)
MyBase.Edit(source, rowNum, bounds, [readOnly], instantText,
cellIsVisible)
MyBase.TextBox.TextAlign = mTxtAlign
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)
'clear the cell
g.FillRectangle(backBrush, bounds)
'draw the value
Dim s As String = Me.GetColumnValueAtRow([source], rowNum).ToString()
Dim r As Rectangle = bounds
r.Inflate(0, -1)
g.DrawString(s, MyBase.TextBox.Font, foreBrush, RectangleF.op_Implicit(r),
mDrawTxt)
End Sub

Public Property DataAlignment() As HorizontalAlignment
Get
Return mTxtAlign
End Get
Set(ByVal Value As HorizontalAlignment)
mTxtAlign = Value
If mTxtAlign = HorizontalAlignment.Center Then
mDrawTxt.Alignment = StringAlignment.Center
ElseIf mTxtAlign = HorizontalAlignment.Right Then
mDrawTxt.Alignment = StringAlignment.Far
Else
mDrawTxt.Alignment = StringAlignment.Near
End If
End Set
End Property

End Class



Ken Tucker said:
Hi,

If the mappingname is wrong for the tablestyle the tablestyle
will not work. Post some code

Ken
---------------
Any known fixes for the wacky right-alignment bug in the WinForms
datagrid
(VS2003)?

I've tried Ken's workaround
(http://www.windowsformsdatagridhelp.com/default.aspx?ID=4bfab32d-9cff-4f5c-ba95-49bb9074a8bc),
but I get no alignment at all when calling the class.

George Shephard's site, while imminently useful, does not have an anwer
for
this issue.

I posted on this topic about a year ago, and went in circles with
Microsoft
who wanted to pretend that there was some bug in my code instead of in
their
control. Enough time has passed and enough developers have posted on this
issue, that I must say, no, I am not interested in wanting to "learn
more"
about 1 million MSDN webpages that are non-specific to this issue.
 
Revised the code to not instantiate at same time as I map the datacolumn to
the textboxcolumn. This did not fix the right-alignment issue (clearly an
undocumented "feature"). However, it did allow me to now use your code fix,
which aligns the data to the right while the column name stays on the left
or center (either is adequate for my purposes). Much thanks for the fix!

Earl said:
Oooooook ... I think I've found something here. Instantiating the columns
at the same time as I'm attaching them to the table style may be creating
this issue. Hold your fire until I experiment a little more.

Ken Tucker said:
Hi,

I do not see where you add the columns to the tablestyle. Add
all the columns to the tablestyle before you add it to the datagrid.
When
you add a tablestyle to a grid set the tablestyle's readonly property
instead of the datagrids.

Ken
-------------
'using a read-only datagrid to show a summary
'code not commented out gives the Microsoft-standard smashed-in right
alignment
'code that IS commented out are lines used to call your class
'the connection, fill, stored procedure, etc. have worked fine for 2+
years,
display is only issue
'your class is shown at the bottom

Private Sub ShowSummaryHistory()

DataGrid1.DataSource = Nothing

dtHistory.Clear()
ds.Clear()
Dim strSQLServer As New SqlConnection(strConnString)
Dim cmd As New SqlCommand("GetJobSummaryHistory", strSQLServer)
cmd.CommandType = CommandType.StoredProcedure
cmd.Connection = strSQLServer
strSQLServer.Open()
Dim da As New SqlDataAdapter(cmd)
da.Fill(ds, "dtHistory")
dtHistory = ds.Tables("dtHistory")
DataGrid1.DataSource = dtHistory
AdjustTableStyle()

End Sub

Private Sub AdjustTableStyle()

Dim tblStyle As New DataGridTableStyle
tblStyle.MappingName = "dtHistory"
DataGrid1.TableStyles.Clear()
DataGrid1.TableStyles.Add(tblStyle)

'Dim tbcSaleDate As New HeaderAndDataAlignColumn

Dim tbcSaleDate As DataGridTextBoxColumn =
CType(tblStyle.GridColumnStyles("SaleDate"), DataGridTextBoxColumn)
tbcSaleDate.MappingName = "SaleDate"

'this was not used with your class
tbcSaleDate.Alignment = HorizontalAlignment.Right

'this however, was
'tbcSaleDate.DataAlignment = HorizontalAlignment.Right

tbcSaleDate.HeaderText = "Sold"
tbcSaleDate.Width = 65
tbcSaleDate.NullText = ""

.... adding more columns

DataGrid1.CaptionText = "Job Summaries"
DataGrid1.ReadOnly = True

End Sub


Public Class HeaderAndDataAlignColumn
Inherits DataGridTextBoxColumn
Private mTxtAlign As HorizontalAlignment = HorizontalAlignment.Left
Private mDrawTxt As New StringFormat
Protected Overloads Overrides Sub Edit(ByVal source As
System.Windows.Forms.CurrencyManager, _
ByVal rowNum As Integer, ByVal bounds As System.Drawing.Rectangle, ByVal
[readOnly] As Boolean, _
ByVal instantText As String, ByVal cellIsVisible As Boolean)
MyBase.Edit(source, rowNum, bounds, [readOnly], instantText,
cellIsVisible)
MyBase.TextBox.TextAlign = mTxtAlign
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)
'clear the cell
g.FillRectangle(backBrush, bounds)
'draw the value
Dim s As String = Me.GetColumnValueAtRow([source], rowNum).ToString()
Dim r As Rectangle = bounds
r.Inflate(0, -1)
g.DrawString(s, MyBase.TextBox.Font, foreBrush,
RectangleF.op_Implicit(r),
mDrawTxt)
End Sub

Public Property DataAlignment() As HorizontalAlignment
Get
Return mTxtAlign
End Get
Set(ByVal Value As HorizontalAlignment)
mTxtAlign = Value
If mTxtAlign = HorizontalAlignment.Center Then
mDrawTxt.Alignment = StringAlignment.Center
ElseIf mTxtAlign = HorizontalAlignment.Right Then
mDrawTxt.Alignment = StringAlignment.Far
Else
mDrawTxt.Alignment = StringAlignment.Near
End If
End Set
End Property

End Class



Ken Tucker said:
Hi,

If the mappingname is wrong for the tablestyle the tablestyle
will not work. Post some code

Ken
---------------
Any known fixes for the wacky right-alignment bug in the WinForms
datagrid
(VS2003)?

I've tried Ken's workaround
(http://www.windowsformsdatagridhelp.com/default.aspx?ID=4bfab32d-9cff-4f5c-ba95-49bb9074a8bc),
but I get no alignment at all when calling the class.

George Shephard's site, while imminently useful, does not have an anwer
for
this issue.

I posted on this topic about a year ago, and went in circles with
Microsoft
who wanted to pretend that there was some bug in my code instead of in
their
control. Enough time has passed and enough developers have posted on
this
issue, that I must say, no, I am not interested in wanting to "learn
more"
about 1 million MSDN webpages that are non-specific to this issue.
 
Back
Top