We help IT Professionals succeed at work.
Get Started

VB.Net Form Height and Width questions

dds110
dds110 asked
on
4,187 Views
Last Modified: 2008-01-09
Hi all,

I have a form that is initially displayed at 300, 300.  On the Form Load event, I'm setting the width of the rows and columns in a 4 Column X 5 Row Table Layout Panel based on the forms width and height.  Here's my code so far:

        Dim styles As TableLayoutRowStyleCollection = Me.TableLayoutPanel1.RowStyles
        For Each style As RowStyle In styles
            style.SizeType = SizeType.Absolute
            style.Height = Me.Height / 5
        Next

        Dim cols As TableLayoutColumnStyleCollection = Me.TableLayoutPanel1.ColumnStyles
        For Each col As ColumnStyle In cols
            col.SizeType = SizeType.Absolute
            col.Width = Me.Width / 4
        Next

The problem is that the Table Layout Panel always seems to be a bit larger than the actual height and width of the form.  This results in my Right-Most column and Bottom-Most Row being cut off.

What gives?

TIA
Comment
Watch Question
High School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
CERTIFIED EXPERT
Top Expert 2009
Commented:
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE