vb.net - WinForm not sizing its controls -


just on pcs, "strange" video sizes, winform app fails correctly set size of anchored controls. strange e.g. tv used vga device. resize working ok on win7 desktops, need app work same in conference rooms.

private sub frmsearch2_resizeend(sender object, e eventargs) handles me.resizeend     dim s string = ""     s &= "me.size " & me.size.tostring & vbnewline     s &= "me.clientsize " & me.clientsize.tostring & vbnewline     s &= "dgv size: " & dgv01.size.tostring & vbnewline ' incorrect     s &= "panel size: " & panel1.size.tostring ' incorrect     clipboard.settext(s)     dgv01.width = me.clientsize.width - (dgv01.left * 2) ' manually set width based on clientsize end sub 

executed on problem pc:

me.size {width=941, height=578} me.clientsize {width=925, height=540} dgv size: {width=939, height=361} panel size: {width=964, height=52} 

note dgv wider client area though anchored on sides. height resizing properly. added panel docked left , right edges see if resize - nope. changing autoscalemode doesn't seem - didn't try possibilities. remember: scaling works on pcs properly.

the last line of code sets dgv width manually visually ok. ok simple form have many controls, hosted in other controls, need same attention.

likely video driver problem code shows winform has proper clientsize, isn't using value resize controls.

is there can call force winform reprocess anchors using valid clientsize? or??

this strange problem... winforms experience problem , others don't. haven't been able determine relevant differences.

the code below works 90+% have common names , positioning significant controls on our forms need resized on problem pcs. panel - pnlresizer - added forms must work on problem pcs - contains of other significant controls.

    try         ' try deal bad video drivers         dim ctl() control = frm.controls.find("tabcontrol1", false)         if ctl.length = 1 andalso (ctl(0).width + ctl(0).left) > frm.clientsize.width             ctl(0).width = frm.clientsize.width - ctl(0).left - 5         end if         ctl = frm.controls.find("statusstrip1", false)         if ctl.length = 1 andalso (ctl(0).width + ctl(0).left) > frm.clientsize.width             ctl(0).width = frm.clientsize.width         end if         ctl = frm.controls.find("toolstrip1", false)         if ctl.length = 1 andalso (ctl(0).width + ctl(0).left) > frm.clientsize.width             ctl(0).width = frm.clientsize.width - ctl(0).left - 5         end if         ctl = frm.controls.find("pnlresizer", false)         if ctl.length = 1 andalso (ctl(0).width + ctl(0).left) > frm.clientsize.width             ctl(0).width = frm.clientsize.width - ctl(0).left - 5         end if     catch ex exception      end try 

Comments