次の方法で共有


PictureSelectionDisplay Property

Specifies how an image appears in the text box portion of a ComboBox control.

Note   You can specify an image by setting the Picture property of the control to an image file name.

Combobox.PictureSelectionDisplay = nExpr

Parameters

  • nExpr
    Numeric data type. The following table lists the values of nExpr.
    nExpr Description
    0 (None) Does not display the image in the text box of the combo box. (Default)
    1 (Clip) The image is clipped to the same height of the text box of a combo box. The width of the image remains the same.
    2 (Isometric) The image resizes to fit the height of the text box of a combo box while maintaining its original proportions.
    3 (Stretch) The image resizes to fit the height of the text box of a combo box but does not maintain its original proportions. The width of the image remains the same.

Remarks

If the combo box Style property is set to 0 (Drop-down ComboBox), images display in the text box of the combo box with the following behavior:

  • When the list portion of the combo box is not visible, and you are typing text directly into the combo box, the default image, if specified, appears until the text matches an item in the list. If no match exists, the default image appears even when the control loses focus.

  • The Margin property of the combo box specifies text spacing, plus padding, from the left and top borders of the text box. When an image appears in the text box, the Margin property specifies the spacing between the image borders and the left and top borders of the text box. The horizontal spacing between the right border of the image and the text is always four pixels, regardless of the setting of the Margin property of the combo box. The text cursor appears two pixels from the right border of the image. You can insert additional space by providing an image containing white space.

    Note   Even if Margin is set to 0, a three-pixel space from the left border and top borders exists to provide space for the text cursor. Specifying a value for Margin adds pixels to this padding. However, if an image appears, Margin affects only the margin between the top border of the text box and the text. The left margin of the text always appears four pixels from the image to maintain alignment of items inside the list.

If the combo box Style property is set to 2 (Drop-down List), images display in the text box of the combo box with two pixels of horizontal spacing between the right border of the image and the text.

See Also

Properties | Margin Property | Picture Property

Applies To: ComboBox Control