-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: PuneetT
Message 2 in Discussion
Dear Shrinivasin, Please find enclosed as the solution to your problem: Derive a
class from Microsoft.Net DataGrid and override its MouseDown method. Provide following
custom implementation for this method: protected override void
OnMouseDown(MouseEventArgs e)
{
System.Windows.Forms.DataGrid.HitTestInfo hti = this.HitTest(e.X, e.Y);
if (hti.Type == System.Windows.Forms.DataGrid.HitTestType.Cell)
{
if
(this.TableStyles[0].GridColumnStyles[hti.Column].GetType().Equals(typeof(DataGridBoolColumn)))
{
System.Drawing.Rectangle rect = this.GetCellBounds(hti.Row, hti.Column);
System.Drawing.Rectangle rectForCheckbox = System.Drawing.Rectangle.Empty;
if (this.RightToLeft == System.Windows.Forms.RightToLeft.Yes)
{
rectForCheckbox = new Rectangle((rect.X + ((rect.Width - 14) / 2)), (rect.Y +
((rect.Height - 14) / 2)), ((rect.Width < 14) ? rect.Width : 14), 14);
}
rectForCheckbox = new Rectangle(Math.Max(0, (rect.X + ((rect.Width - 14) / 2))),
Math.Max(0, (rect.Y + ((rect.Height - 14) / 2))), ((rect.Width < 14) ? rect.Width :
14), 14); if (e.X > rectForCheckbox.X && e.X < (rectForCheckbox.X +
rectForCheckbox.Width) && e.Y > rectForCheckbox.Y && e.Y < (rectForCheckbox.Y +
rectForCheckbox.Height))
{
bool CurrentValue =
((bool)((System.Data.DataTable)this.DataSource).Rows[hti.Row][this.TableStyles[0].GridColumnStyles[hti.Column].MappingName]);
((System.Data.DataTable)this.DataSource).Rows[hti.Row][this.TableStyles[0].GridColumnStyles[hti.Column].MappingName]
= ((object)!CurrentValue);
}
}
}
} Please let me know if this resolves your problem. Regards,
Puneet Taneja
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/BDotNet/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]