Softelvdm.Controls Class Library for Windows Controls 1.0

CalcSize Method, DropDownButtonPartClass Class

Softel vdm, Inc.

Calculates the size of the part.

Syntax      DropDownButtonPartClass Class (Softelvdm.Controls)

VB   

Protected Friend Overrides Function CalcSize( _
     ByVal pr As PartsRenderingClass, _
     ByVal g As Graphics, _
     ByVal rPartArea As Rectangle, _
     ByVal calc As CalcSizeEnum _
  ) As Size

C#   

protected internal override Size CalcSize(
     PartsRenderingClass pr,
     Graphics g,
     Rectangle rPartArea,
     CalcSizeEnum calc );

C++   

protected friend: virtual Size CalcSize(
     PartsRenderingClass^ pr,
     Graphics^ g,
     Rectangle rPartArea,
     CalcSizeEnum calc );

calc

Defines the method to calculate the part's size.

CalcSizeEnum

Value

Description

Exact

0

Calculate the exact size of the part. If possible, the maximum area (r) of the CalcSize method should be honored. This is used by a part to call its own CalcSize method.

BestFit

1

Calculate the exact size of the part. If possible, the maximum area (r) of the CalcSize method should be honored. This is used by the internal PartsRenderingClass.CalcSize method.

LargestSize

2

Calculate the exact size of the part. If possible, the maximum area (r) of the CalcSize method should be honored. This is used by the internal PartsRenderingClass.StrategyRoutine method.

LargestSize2

3

Calculate the exact size of the part. If possible, the maximum area (r) of the CalcSize method should be honored.
SftTree/NET 2.0: This is only used to determine the height of the first part in a cell's parts collection (CellBaseClass.Parts).
It is not currently used by other products.

g

Defines the drawing surface.

pr

Defines the PartsRenderingClass object.

rPartArea

Defines the maximum available area to render the part.

Return Value

The part's size.

Comments

The CalcSize method calculates the size of the part.

If a part can adapt to its surroundings and its maximum available space (r), it should adjust the returned size to reflect the maximum available space. For example, a string as used in the TextPartClass class can wrap around. If a part is wider than the available space, it may be clipped once it is displayed.

Calculating a part's size can be CPU intensive, in which case this routine should attempt to cache values to speed up its performance. The calc parameter can be used to distinguish the reason for the call to CalcSize, which may be helpful to cache values needed to optimize performance.

Version Information

Supported in version 1.0.
Products Table


Feedback / comments / error reports for this topic
© 2007 - Softel vdm, Inc. - www.softelvdm.com