Reputation: 29445
I have a notebook with 5 pages, grid objects on each page. Each grid has 3000 rows and 4000 columns. I add employee name and surnames in first 2 columns in each page. I want to make sure all columns are set to best size so that each name is completely visible, therefore I use self.AutoSize()
. But it takes too long time. When I comment out self.AutoSize()
, execution time is reduced significantly. Thus I want to use self.SetColSize(int col, int width)
method instead. Since I know each employee names and surnames, I can set the column size to longest name/surname.
But how do I convert the name/surname length to pixels? For example, if longest surname in column is "Rooney"
, then what should be the column size in pixels?
Upvotes: 4
Views: 2354
Reputation: 9451
The GetTextExtent should be the way to go. However I have never used it together with grid.
Upvotes: 1