Packages
 In this topic

*Constructors

*Methods

 

Packages   PreviousThis PackageNext
Package com.ms.ui   Previous This
Package
Next

 


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.

Constructors

UIDialogMapping

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.

UIDialogMapping

public UIDialogMapping(Component Parent);

Creates a UIDialogMapping object using the font of the specified component.

ParameterDescription
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.

UIDialogMapping

public UIDialogMapping(Font font);

Creates a UIDialogMapping object using the specified font.

ParameterDescription
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.

Methods

mapDimension

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.

ParameterDescription
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.

mapRectangle

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.

ParameterDescription
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.

upnrm.gif © 1998 Microsoft Corporation. All rights reserved. Terms of use.