Which code segment should you use to format the columns at run time?

You are creating a Windows Form. You add a TableLayoutPanel control named pnlLayout to the form. You set the properties of pnlLayout so that it will resize with the form. You need to create a three-column layout that has fixed left and right columns. The fixed columns must each remain 50 pixels wide when the form is resized. The middle column must fill the remainder of the form width when the form is resized. You add the three columns in the designer. Which code segment should you use to format the columns at run time?

You are creating a Windows Form. You add a TableLayoutPanel control named pnlLayout to the form. You set the properties of pnlLayout so that it will resize with the form. You need to create a three-column layout that has fixed left and right columns. The fixed columns must each remain 50 pixels wide when the form is resized. The middle column must fill the remainder of the form width when the form is resized. You add the three columns in the designer. Which code segment should you use to format the columns at run time?

A.
pnlLayout.ColumnStyles.Clear()
pnlLayout.ColumnStyles.Add(New ColumnStyle(SizeType.Absolute, 50.0F))
pnlLayout.ColumnStyles.Add(New ColumnStyle(SizeType.AutoSize, 100.0F))
pnlLayout.ColumnStyles.Add(New ColumnStyle(SizeType.Absolute, 50.0F))

B.
pnlLayout.ColumnStyles(0).Width = 50.0F
pnlLayout.ColumnStyles(0).SizeType = SizeType.Absolute pnlLayout.ColumnStyles(2).Width = 50.0F
pnlLayout.ColumnStyles(2).SizeType = SizeType.Absolute

C.
pnlLayout.ColumnStyles(0).Width = 50.0F
pnlLayout.ColumnStyles(0).SizeType = SizeType.Absolute pnlLayout.ColumnStyles(1).Width = 100.0F
pnlLayout.ColumnStyles(1).SizeType = SizeType.AutoSize pnlLayout.ColumnStyles(2).Width = 50.0F
pnlLayout.ColumnStyles(2).SizeType = SizeType.Absolute

D.
pnlLayout.ColumnStyles.Clear()
pnlLayout.ColumnStyles.Add(New ColumnStyle(SizeType.Absolute, 50.0F))
pnlLayout.ColumnStyles.Add(New ColumnStyle(SizeType.Percent, 100.0F))
pnlLayout.ColumnStyles.Add(New ColumnStyle(SizeType.Absolute, 50.0F))



Leave a Reply 0

Your email address will not be published. Required fields are marked *