Danh mục

Professional VB 2005 - 2006 phần 6

Số trang: 110      Loại file: pdf      Dung lượng: 6.30 MB      Lượt xem: 18      Lượt tải: 0    
Hoai.2512

Xem trước 10 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

Đặt một nút ở góc dưới bên phải của biểu mẫu, và thiết lập thuộc tính Neo cho các nút hại và phải. Sau đó, đặt hai hộp văn bản trong FlowLayoutPanel, giữ kích thước mặc định của họ. Các hình thức mà bạn đã tạo ra nên bây giờ trông giống như hình 14-14.
Nội dung trích xuất từ tài liệu:
Professional VB 2005 - 2006 phần 6 Chapter 14 Place a button in the bottom-right corner of the form, and set the Anchor property for the button to Bottom and Right. Then place two text boxes in the FlowLayoutPanel, keeping their default sizes. The form you have created should now look much like that in Figure 14-14.impo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Figure 14-14 Now run the application. The initial layout will be similar to the design-time layout. However, if you resize the form to about half of its original width, the layout of the text boxes will change. Since there is no longer enough room for them to be arranged side by side, the arrangement will automatically switch, and the form will look more like that in Figure 14-15. Figure 14-15 Padding and Margin properties To assist in positioning controls in the FlowLayoutPanel, all controls have a new property called Margin. There are settings for Margin.Left, Margin.Right, Margin.Top, and Margin.Bottom. These settings determine how much space is reserved around a control when calculating its automatic position in a FlowLayoutPanel. You can see the Margin property in action by changing the Margin property for one or more of the text boxes in the previous example. If you change all the Margin settings for the first Textbox to 20 pixels, for example, and run the application, the form will look like Figure 14-16. 518 Windows Formsimpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Figure 14-16 The first text box now has a 20 pixel separation from all the other controls in the FlowLayoutPanel, as well as a 20 pixel separation from the edges of the FlowLayoutPanel itself. The Padding property is for the FlowLayoutPanel or other container control. When a control is embedded into a FlowLayoutPanel, the Padding.Left, Padding.Right, Padding.Top, and Padding.Bottom properties of the FlowLayoutPanel determine how far away from the inside edge of the container to position the control. You can see the Padding property in action by changing the Padding property for the FlowLayoutPanel in the previous example. If you set all Padding settings to 20 pixels, and reset the Margin property for the first Textbox back to the default, then the form will look like Figure 14-17 in the visual designer. Figure 14-17 519 Chapter 14 Notice that all the controls in the FlowLayoutPanel are now at least 20 pixels from the edges. The Padding property is also applicable for other container controls, if the contained controls have theirimpo PDF Merge andIfSplit Unregistered Version - http://www.simpopdf.com the edge Dock property set. the settings for Padding are not zero, a docked control will be offset from of the container by the amount specified by the Padding property. TableLayoutPanel Control The other new control for dynamic layout is the TableLayoutPanel. This control consists of a table of rows and columns, resulting in a rectangular array of cells. You can place one control in each cell. The dimensions of the columns and rows can be controlled by setting some key properties. For columns, set the number of columns with the ColumnCount property, and then control each individual column with the ColumnStyles collection. When you click on the button for the ColumnStyles collection, you’ll get a designer window that allows you to set two key properties for each column — the SizeType and Width properties. SizeType can be set to one of the following enumerations: ❑ Absolute — Sets the column width to a fixed size in pixels ❑ AutoSize — Indicates that the size of the column should be managed by the TableLayoutPanel, which will allocate width to the column depending on the widest control contained in the column ❑ Percent — Sets the percentage of the TableLayoutPanel to use for the width of the column The Width property is only applicable if you do not choose a SizeType of AutoSize. It sets either the number of pixels for the width of the column (if the SizeType is Absolute) or the percentage width for the column (if the SizeType is set to Percent). Similarly, for rows, there is ...

Tài liệu được xem nhiều: