Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 84751

Hit Test for CellClick event on GridView

$
0
0

Hello,

  I have created a GridViewTextBoxColumn(), on _CellPaint() I am painting three images starting from the left to right.  I would like to detect a mouse click on the rectangle that corresponds to the image but I can't get the Cell.Size information on the CellClick() event.

I have tried creating a custom control that holds three buttons but the UI doesn't fit my needs.

In order to determine what was clicked on the cell, I need to know the click x/y and the current cell rectangle.

Thanks!

 

void grid_CellPaint(object sender, GridViewCellPaintEventArgs e)
        {
            GridDataCellElement dataCell = e.Cell as GridDataCellElement;
            if (dataCell != null && dataCell.ColumnInfo.FieldName == "ID")
            {
                Size cellSize = e.Cell.Size;
                Rectangle rct = new Rectangle(0, 0, cellSize.Height, cellSize.Height);
                //using (Pen p = new Pen(Color.Black))
               // {
                 
  //Flag
                    rct.Inflate(-2, -2);
                    e.Graphics.DrawImage(global::DIRC.UITools.Properties.Resources.Flag_red_icon16x16, rct);
           

                    //Information Icon
                    rct = new Rectangle(cellSize.Height, 0, cellSize.Height, cellSize.Height);
            
                    rct.Inflate(-2, -2);
                    e.Graphics.DrawImage(global::DIRC.UITools.Properties.Resources.information_icon_16x16, rct);

                    //Comment Icon
                    rct = new Rectangle(cellSize.Height * 2, 0, cellSize.Height, cellSize.Height);
                     
                    rct.Inflate(-2, -2);
                    e.Graphics.DrawImage(global::DIRC.UITools.Properties.Resources.comment_icon16x16, rct);
               // }
            }
        }


Viewing all articles
Browse latest Browse all 84751

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>