G
Guest
I'm trying to write a form resize event to have a datagrid resize itself as
the form size changes. Here's the code I wrote:
DataGrid1.Width = Me.Width - (20)
DataGrid1.Left = 10
DataGrid1.Top = 10
DataGrid1.Height = Me.Height - (20)
This should leave a 10 pixel buffer around the grid. When I run this, the
right edge space is visually smaller than the left side, and the grid is
running off the bottom.
When I did stuff like this in VB6, I had to use scaleheight and scalewidth
for the form so the resizes did what it was supposed to, to account for form
edging. I dont see a VB equivalent. So how do I dynamically have the grid
center itself. I do not want to use the anchor property, because that's based
on the form, and sometimes I leave a gap for things like a menubar or command
buttons at the top of a form.
Thanks
the form size changes. Here's the code I wrote:
DataGrid1.Width = Me.Width - (20)
DataGrid1.Left = 10
DataGrid1.Top = 10
DataGrid1.Height = Me.Height - (20)
This should leave a 10 pixel buffer around the grid. When I run this, the
right edge space is visually smaller than the left side, and the grid is
running off the bottom.
When I did stuff like this in VB6, I had to use scaleheight and scalewidth
for the form so the resizes did what it was supposed to, to account for form
edging. I dont see a VB equivalent. So how do I dynamically have the grid
center itself. I do not want to use the anchor property, because that's based
on the form, and sometimes I leave a gap for things like a menubar or command
buttons at the top of a form.
Thanks