Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27215

dgv cell image with events looks flickery and freezes program

$
0
0
hi i have a dgv "its databound" i have 2 cols that re image box's now when a row is selected i want the image boxes to show a certain image and when a row is not selected i want the image cells to show a different image.

I have tried
Code:


    Private Sub ProfilestableDataGridView_RowPostPaint(sender As Object, e As DataGridViewRowPostPaintEventArgs) Handles ProfilestableDataGridView.RowPostPaint

        If ProfilestableDataGridView.Rows(e.RowIndex).Selected Then


            Me.ProfilestableDataGridView.Rows(e.RowIndex).Cells("imagecol").Value = My.Resources.icon_profiles_selected_fw
            Me.ProfilestableDataGridView.Rows(e.RowIndex).Cells("viewingcol").Value = My.Resources.icon_arrow_fw

        Else

            Me.ProfilestableDataGridView.Rows(e.RowIndex).Cells("imagecol").Value = My.Resources.icon_profiles_fw
            Me.ProfilestableDataGridView.Rows(e.RowIndex).Cells("viewingcol").Value = My.Resources.icon_profiles_fw



        End If

    End Sub

now this works however the images look to be re-painting themselves constantly cousing a flicker to be seen also this freezes the program when i attempt to click another control.

i have also tried the code in the

*row prepaint
*cell formating

but i always get the same issue.

Does any 1 know i am doing wrong

cheers,
Nathan

Viewing all articles
Browse latest Browse all 27215

Trending Articles



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