We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Checkbox on mousedown only

Thread ID:





14792 Jun 4,2004 06:08 AM Jun 4,2004 06:45 AM Windows Forms 1
Tags: GridControl
Administrator [Syncfusion]
Asked On June 4, 2004 06:08 AM

I was comparing the checkbox functionality on a standard listview and it checks the box on the mouse down and not the combination of the mouse down and mouse up. Is there anyway to make the grid controls checkbox behave the same way.

Administrator [Syncfusion]
Replied On June 4, 2004 06:45 AM

The standard windows forms checkbox changes the check on mouseup. If you want change it on MouseDown, then you can try the event handler below. But there maybe undesired consequences of doing so. For example, if you mousedown on a checkbox and drag to select a range of cells, the checkbox changes. (ListView does not support this I assume.)
private void gridControl1_GridControlMouseDown(object sender, CancelMouseEventArgs e)
	Point pt = new Point(e.MouseEventArgs.X, e.MouseEventArgs.Y);
	int row, col;
	if(this.gridControl1.PointToRowCol(pt, out row, out col, -1))
		if(this.gridControl1[row, col].CellType == "CheckBox")
			if(this.gridControl1[row, col].Text == this.gridControl1[row, col].CheckBoxOptions.CheckedValue)
				this.gridControl1[row, col].Text = this.gridControl1[row, col].CheckBoxOptions.UncheckedValue;
				this.gridControl1[row, col].Text = this.gridControl1[row, col].CheckBoxOptions.CheckedValue;
	        this.gridControl1.CurrentCell.MoveTo(row, col);
			e.Cancel = true;


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.