Class UIDialogMapping
public class UIDialogMapping
{
// Constructors
public UIDialogMapping();
public UIDialogMapping(Component Parent);
public UIDialogMapping(Font font);
// Methods
public Dimension mapDimension(Dimension dim);
public Rectangle mapRectangle(Rectangle rect);
}
This class maps pixels to dialog logical units (DLUs). DLUs are resolution-independent coordinates that are useful for laying out controls in a dialog box. The mapping from pixels to DLUs is based on the font of the dialog box. An x coordinate DLU is 1/4 (.25) of the average character width of the font used in the dialog box. A y coordinate DLU is 1/8 (.125) of the character height.
Note The average character width is not the average of all characters. Rather, it is the average of all alpha characters, both uppercase and lowercase. That is, the average character width is the total width of the string "a...zA...Z" divided by 52.
public UIDialogMapping();
Creates a UIDialogMapping object with a default font.
Remarks:
The default font has a style of Font.PLAIN and a point size of 8. The mapDimension and mapRectangle methods use this font to convert pixels to dialog logical units (DLUs). For more information about the relationship between pixels and DLUs, see the UIDialogMapping overview.
public UIDialogMapping(Component Parent);
Creates a UIDialogMapping object using the font of the specified component.
Parameter | Description |
Parent
| The component that defines the font to be used.
|
Remarks:
The mapDimension and mapRectangle methods use the font of the specified component to convert pixels to dialog logical units (DLUs). For more information about the relationship between pixels and DLUs, see the UIDialogMapping overview.
public UIDialogMapping(Font font);
Creates a UIDialogMapping object using the specified font.
Parameter | Description |
font
| The font to be used.
|
Remarks:
The mapDimension and mapRectangle methods use the specified font to convert pixels to dialog logical units (DLUs). For more information about the relationship between pixels and DLUs, see the UIDialogMapping overview.
public Dimension mapDimension(Dimension dim);
Maps a Dimension object given in pixels to a Dimension object given in dialog logical units (DLUs).
Return Value:
Returns the Dimension object given in DLUs.
Parameter | Description |
dim
| The Dimension object given in pixels.
|
Remarks:
This method converts pixels to DLUs based on the font associated with the UIDialogMapping object. For more information about the relationship between pixels and DLUs, see the UIDialogMapping overview.
public Rectangle mapRectangle(Rectangle rect);
Maps a Rectangle object given in pixels to a Rectangle object given in dialog logical units (DLUs).
Return Value:
Returns the Rectangle object given in DLUs.
Parameter | Description |
rect
| The Rectangle object given in pixels.
|
Remarks:
This method converts pixels to DLUs based on the font associated with the UIDialogMapping object. For more information about the relationship between pixels and DLUs, see the UIDialogMapping overview.