SftTree/NET 2.0 - Tree Control for Windows Forms


CalcSize Method, GenericPartClass Class

Calculates the size of the part.

Class: GenericPartClass
Namespace: Softelvdm.Controls
Assembly: Softelvdm.SftTreeNET


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



Defines the PartsRenderingClass object.


Defines the drawing surface.


Defines the maximum available area to render the part.


Defines the method to calculate the part's size.

Return Value

The part's size.


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.

See Also GenericPartClass Class | Classes | SftTree/NET 2.0