Determine if the Combo Box button has been clicked in a DataGridViewCell

  • Thread starter Thread starter JB
  • Start date Start date
J

JB

Hi Everyone,

I have a DataGridView with Combo Boxes in its cells.
I'd like to know if the user has clicked on the right side arrow
button that triggers the opening of the drop down list.
After experimenting with the various events, I can find out which cell
the user has clicked and whether or not he/she's clicked in the
content (i.e. on the content text), but not on the right side arrow
button.
Can somebody help me out with this?

Thanks
JB
 
You MIGHT be able to do some mathematical operations to determine
this.

When you click you do a hittest to find out where the mouse is on the
control. After knowing where the mouse is on the form you just have
to determine where the mouse is within the cell which can be used by
calculating the rowheight of every row to that point and the column
width of every column to that point. Once you have that information
you'll know that the button is [buttonwidth]px out of a total
[columnwidth]. If the hittest returns a value > columnwidth -
buttonwidth they're clicking the button.
 
Back
Top