c# - Custom DataGridView Selection Mode -


so have searched everywhere try , find answer question seems ok way selects cells default (in box).

i working on hex editor , have selectionmode set default rowheaderselect , multiselect set true. issue when click on cell , drag select, selects cells in box shape (like excel). not how need select cells.

i got around handling following events, cellmousedown, cellmouseenter, cellmouseup, & mouseup. gives me selection looking default box selection style still there during drag selection.

this code sample happening on cellmouseup , providing selection style looking for. first photo selection looks after code below ran (cellmouseup). second picture happens dragging (code below ran on cellmouseenter custom select while dragging) producing visual bug of unselecting entire column because out of default selection box style (excel style).

edit: clarify selection works after mouse , mouse down occur ( dgvmainbinary.clearselection() code below ) visual bug happening during dragging. thing can think of default box selection mode running after cellmouseenter event.

any appreciated, thanks.

        (int row = starty; row <= endy; row++)         {             int startcolumn = 0;             int endcolumn = 15;             if (row == starty)             {                 startcolumn = startx;                 if (starty == endy)                     endcolumn = endx;             }             else if (row == endy)             {                 endcolumn = (endx < 16)?endx:15;             }             (int column = startcolumn; column <= endcolumn; column++)             {                 dgvmainbinary.rows[row].cells[column].selected = true;             }         } 

image1

image2

one way clear selected cells in mouseup event handler , selection logic after clearing selection done datagridview default logic.

void datagridview1_mouseup(object sender, mouseeventargs e) {                 datagridview1.clearselection();                // selection logic here } 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -