You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
helpviewer_keywords: ["Size to Content command", "size, controls", "text, autosizing controls to fit text", "controls [C++], sizing"]
4
+
f1_keywords: ["vc.editors.dialog.combo"]
5
+
helpviewer_keywords: ["Size to Content command", "size, controls", "text, autosizing controls to fit text", "controls [C++], sizing", "Make Same Size command", "combo boxes, sizing", "list controls [C++], scroll bar width", "CListBox::SetHorizontalExtent", "controls [C++], scroll bar", "scroll bars [C++], displaying in controls", "horizontal scroll bar width", "CListBox class, scroll bar width", "scroll bars [C++], width"]
5
6
ms.assetid: 14ccba02-7171-463a-a121-7018cf1e2e5a
6
7
---
7
-
# Sizing Individual Controls
8
+
# Sizing Controls
8
9
9
-
Use the sizing handles to resize a control. When the pointer is positioned on a sizing handle, it changes shape to indicate the directions in which the control can be resized. Active sizing handles are solid; if a sizing handle is hollow, the control cannot be resized along that axis.
10
+
Use the sizing handles to resize a control. When the pointer is positioned on a sizing handle, it changes shape to indicate the directions in which the control can be resized. Active sizing handles are solid; if a sizing handle is hollow, the control can't be resized along that axis.
10
11
11
12
You can also change the size of a control by snapping the control to guides or margins, or by moving one snapped control and guide away from another.
12
13
13
-
### To size a control
14
+
For information on adding resources to managed projects, see [Resources in Desktop Apps](/dotnet/framework/resources/index) in the *.NET Framework Developer's Guide*. For information on manually adding resource files to managed projects, accessing resources, displaying static resources, and assigning resource strings to properties, see [Creating Resource Files for Desktop Apps](/dotnet/framework/resources/creating-resource-files-for-desktop-apps). For information on globalization and localization of resources in managed apps, see [Globalizing and Localizing .NET Framework Applications](/dotnet/standard/globalization-localization/index).
15
+
16
+
## To size an individual control
14
17
15
18
1. Select the control.
16
19
17
-
2. Drag the sizing handles to change the size of the control:
20
+
1. Drag the sizing handles to change the size of the control:
18
21
19
22
- Sizing handles at the top and sides change the horizontal or vertical size.
20
23
@@ -23,21 +26,73 @@ You can also change the size of a control by snapping the control to guides or m
23
26
> [!TIP]
24
27
> You can resize the control one dialog unit (DLU) at a time by holding down the **Shift** key and using the **Right Arrow** and **Down Arrow** keys.
25
28
26
-
###To automatically size a control to fit the text within it
29
+
## To automatically size a control to fit the text within it
27
30
28
-
1.Choose **Size to Content** from the **Format** menu.
31
+
Choose **Size to Content** from the **Format** menu.
29
32
30
33
\- or -
31
34
32
-
- Right-click the control and choose **Size to Content** from the shortcut menu.
35
+
Right-click the control and choose **Size to Content** from the shortcut menu.
36
+
37
+
## To make controls the same width, height, or size
38
+
39
+
You can resize a group of controls based on the size of the dominant control.
40
+
41
+
1.[Select the controls](../windows/selecting-multiple-controls.md) you want to resize.
42
+
43
+
The control selected first in the series is the dominant control. The final size of the controls in the group depends on the size of the dominant control. For more information on selecting the dominant control, see [Specifying a Dominant Control](../windows/specifying-the-dominant-control.md).
44
+
45
+
1. From the **Format** menu, choose **Make Same Size**, then choose one of the following commands:
46
+
47
+
-**Both**
48
+
49
+
-**Height**
50
+
51
+
-**Width**
52
+
53
+
## To set the size of the combo box and its drop-down list
54
+
55
+
You can size a combo box when you add it to the dialog box. You can also specify the size of the drop-down list box. For more information, see [Adding Values to a Combo Box Control](../windows/adding-values-to-a-combo-box-control.md).
56
+
57
+
### To size a combo box
58
+
59
+
1. Select the combo-box control in your dialog box.
60
+
61
+
Initially, only the right and left sizing handles are active.
62
+
63
+
1. Use the sizing handles to set the width of the combo box.
64
+
65
+
You can also set the vertical size of the drop-down portion of the combo box.
66
+
67
+
### To set the size of the combo box drop-down list
68
+
69
+
1. Select the drop-down arrow button at the right of the combo box.
70
+
71
+

72
+
73
+
The outline of the control changes to show the size of the combo box with the drop-down list area extended.
74
+
75
+
1. Use the lower sizing handle to change the initial size of the drop-down list area.
76
+
77
+

78
+
79
+
1. Select the drop-down arrow again to close the drop-down list portion of the combo box.
80
+
81
+
## To set the width of a horizontal scroll bar and make it appear
82
+
83
+
When you add a list box with a horizontal scroll bar to a dialog box using MFC classes, the scroll bar won't automatically appear in your application.
84
+
85
+
Set a maximum width for the widest element by calling [CListBox::SetHorizontalExtent](../mfc/reference/clistbox-class.md#sethorizontalextent) in your code.
33
86
34
-
For information on adding resources to managed projects, please see [Resources in Desktop Apps](/dotnet/framework/resources/index) in the *.NET Framework Developer's Guide*. For information on manually adding resource files to managed projects, accessing resources, displaying static resources, and assigning resource strings to properties, see [Creating Resource Files for Desktop Apps](/dotnet/framework/resources/creating-resource-files-for-desktop-apps). For information on globalization and localization of resources in managed apps, see [Globalizing and Localizing .NET Framework Applications](/dotnet/standard/globalization-localization/index).
87
+
Without this value set, the scroll bar won't appear, even when the items in the list box are wider than the box.
88
+
> [!NOTE]
89
+
> The horizontal scroll bar requires MFC.
35
90
36
91
## Requirements
37
92
38
93
Win32
39
94
40
-
## See Also
95
+
## See also
41
96
42
97
[Controls in Dialog Boxes](../windows/controls-in-dialog-boxes.md)<br/>
0 commit comments