Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi.
Got an issue with ScrollBar on my Custom DataGridView.
I've inserted the custom DGV on a tabcontrol-tabpage and filled it with rows and performed my custom formatting on it.
But when I switch between tabs and return back to the original tab, the scroll bars go "dirty"

http://picturepush.com/public/8478298
The above picture shows my Custom DGV with the scrollbars working properly

http://picturepush.com/public/8478309[^]
This second picture shows the state of the scrollbar after I switched between the tabpages.

Why does this happen? Can someone help me out with a solution to this?
Posted

1 solution

OK...I found out the cause for this.
Since I was implementing multiple row clicks (i.e. 3 rows being selected on one row click), I was using the clearselection() method to clear the previous selections.

The problem now lies with the clearselection() method that causes the scroll bars to get dirty. If I remove that clearselection() statement, there is no issue with the scrollbars getting corrupted in display.

Now, the question arises as to why is this happening? What is the workaround for it?

Note:
1. My clearselection() statement is in the rowpostpaint() event along with my code for selecting the rows.
2. Somehow the clearselection() event doesn't call any of the paint events (correct me if I'm wrong)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900