[Mono-bugs] [Bug 614848] The DataGridViewComboBoxColumn column in DataGridView Control does not work as expected
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Wed Jun 16 16:40:58 EDT 2010
http://bugzilla.novell.com/show_bug.cgi?id=614848
http://bugzilla.novell.com/show_bug.cgi?id=614848#c1
--- Comment #1 from Hajime KObayashi <hajimek at yummy.net> 2010-06-16 20:40:57 UTC ---
the following code copied from Microsoft site might be a workaround to this
problem
private void datagridview1_CellPainting(object sender,
DataGridViewCellPaintingEventArgs e)
{
//MONO : refer to Bug 614848 on
https://bugzilla.novell.com/show_bug.cgi?id=614848
// reported by me
if (e.ColumnIndex < 0 || e.RowIndex < 0) return;
if (e.ColumnIndex != 1) return;
if (!LicenseEditor.CPlatformInfo.RunningOnMono) return;
Rectangle newRect = new Rectangle(e.CellBounds.X + 1,
e.CellBounds.Y + 1, e.CellBounds.Width - 4,
e.CellBounds.Height - 4);
using (
Brush gridBrush = new
SolidBrush(((DataGridView)sender).GridColor),
backColorBrush = new SolidBrush(e.CellStyle.BackColor))
{
using (Pen gridLinePen = new Pen(gridBrush))
{
// Erase the cell.
e.Graphics.FillRectangle(backColorBrush, e.CellBounds);
// Draw the grid lines (only the right and bottom lines;
// DataGridView takes care of the others).
e.Graphics.DrawLine(gridLinePen, e.CellBounds.Left,
e.CellBounds.Bottom - 1, e.CellBounds.Right - 1,
e.CellBounds.Bottom - 1);
e.Graphics.DrawLine(gridLinePen, e.CellBounds.Right - 1,
e.CellBounds.Top, e.CellBounds.Right - 1,
e.CellBounds.Bottom);
// Draw the inset highlight box.
//e.Graphics.DrawRectangle(Pens.Blue, newRect);
// Draw the text content of the cell, ignoring alignment.
if (e.Value != null)
{
e.Graphics.DrawString((String)e.Value,
e.CellStyle.Font,
Brushes.Black, e.CellBounds.X + 2,
e.CellBounds.Y + 2, StringFormat.GenericDefault);
}
e.Handled = true;
}
}
}
}
--
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list