CMFCDynamicLayout Class

Visual Studio 2015
 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at CMFCDynamicLayout Class.

Specifies how controls in a window are moved and resized as the user resizes the window.

class CMFCDynamicLayout : public CObject  

Public Constructors

NameDescription
CMFCDynamicLayout::CMFCDynamicLayoutConstructs a CMFCDynamicLayout object.
CMFCDynamicLayout::~CMFCDynamicLayoutDestructor.

Public Methods

NameDescription
CMFCDynamicLayout::AddItemAdds a child window, typically a control, to the list of windows that are controlled by the dynamic layout manager.
CMFCDynamicLayout::AdjustAdds a child window, typically a control, to the list of windows that are controlled by the dynamic layout manager.
CMFCDynamicLayout::CreateStores and validates the host window.
CMFCDynamicLayout::GetHostWndReturns a pointer to a host window.
CMFCDynamicLayout::GetMinSizeReturns the window size below which layout is not adjusted.
CMFCDynamicLayout::GetWindowRectRetrieves the rectangle for the window's current client area.
CMFCDynamicLayout::HasItemChecks if a child control was added to dynamic layout.
CMFCDynamicLayout::IsEmptyChecks if a dynamic layout has no child windows added.
CMFCDynamicLayout::LoadResourceReads the dynamic layout from AFX_DIALOG_LAYOUT resource and then applies the layout to the host window.
static CMFCDynamicLayout::MoveHorizontalGets a MoveSettings value that defines how much a child control is moved horizontally when the user resizes its hosting window.
static CMFCDynamicLayout::MoveHorizontalAndVerticalGets a MoveSettings value that defines how much a child control is moved horizontally when the user resizes its hosting window.
static CMFCDynamicLayout::MoveNoneGets a MoveSettings value that represents no motion, vertical or horizontal, for a child control.
static CMFCDynamicLayout::MoveVerticalGets a MoveSettings value that defines how much a child control is moved vertically when the user resizes its hosting window.
CMFCDynamicLayout::SetMinSizeSets the window size below which layout is not adjusted.
static CMFCDynamicLayout::SizeHorizontalGets a SizeSettings value that defines how much a child control is resized horizontally when the user resizes its hosting window.
static CMFCDynamicLayout::SizeHorizontalAndVerticalGets a SizeSettings value that defines how much a child control is resized horizontally when the user resizes its hosting window.
static CMFCDynamicLayout::SizeNoneGets a SizeSettings value that represents no change in size for a child control.
static CMFCDynamicLayout::SizeVerticalGets a SizeSettings value that defines how much a child control is resized vertically when the user resizes its hosting window.
NameDescription
CMFCDynamicLayout::MoveSettings StructureEncapsulates move data for controls in a dynamic layout.
CMFCDynamicLayout::SizeSettings StructureEncapsulates size change data for controls in a dynamic layout.

CObject

CMFCDynamicLayout

Header: afxlayout.h

Adds a child window, typically a control, to the list of windows that are controlled by the dynamic layout manager.

BOOL AddItem(
    HWND hwnd,
    MoveSettings moveSettings SizeSettings sizeSettings);

 
BOOL AddItem(
    int nID,
    MoveSettings moveSettings SizeSettings sizeSettings);

Parameters

hwnd
The handle to the window to add.

nID
The ID of the child control to add.

moveSettings
A structure that describes how the control should be moved as the window size changes.

sizeSettings
A structure that describes how the control should be resized as the window size changes.

Return Value

TRUE if the item was added successfully; otherwise FALSE.

Remarks

The position and size of a child control is changed dynamically when a hosting window is being resized.

Adds a child window, typically a control, to the list of windows that are controlled by the dynamic layout manager.

void Adjust();

Remarks

The position and size of a child control is changed dynamically when a hosting window is being resized.

Stores and validates the host window.

BOOL Create(CWnd* pHostWnd);

Parameters

pHostWnd
A pointer to the host window.

Return Value

TRUE if creation succeeded; otherwise FALSE.

Remarks

Returns a pointer to a host window.

CWnd* GetHostWnd();

Return Value

A pointer to the host window.

Remarks

By default all child control positions recalculated relative to this window.

Returns the window size below which layout is not adjusted.

CSize GetMinSize();

Return Value

The window size below which layout is not adjusted.

Remarks

The position and size of a child control is changed dynamically when a hosting window is being resized, but there is a minimum size below which the layout is not adjusted. The user can resize the window to a smaller size, but parts of the window are then hidden from view.

Retrieves the rectangle for the window's current client area.

void GetHostWndRect(CRect& rect,);

Parameters

rect
After the function returns, this parameter contains the bounding rectangle of the layout area. This is an out parameter; the input value is overwritten.

Remarks

Checks if a child control was added to dynamic layout.

BOOL HasItem(HWND hwnd);

Parameters

hwnd
The window handle for the control.

Return Value

TRUE if layout already has this item; otherwise FALSE.

Remarks

Checks if a dynamic layout has no child windows added.

BOOL IsEmpty();

Return Value

TRUE if layout has no items; otherwise FALSE.

Remarks

Reads the dynamic layout from AFX_DIALOG_LAYOUT resource and then applies the layout to the host window.

static BOOL LoadResource(CWnd* pHostWnd,
    LPVOID lpResource,
    DWORD dwSize);  

Parameters

pHostWnd
A pointer to the host window.

lpResource
A pointer to the buffer that contains the AFX_DIALOG_LAYOUT resource.

dwSize
The buffer size in bytes.

Return Value

TRUE if resource is loaded and applied to the host window; otherwise FALSE.

Remarks

Gets a MoveSettings value that defines how much a child control is moved horizontally when the user resizes its hosting window.

static MoveSettings MoveHorizontal(int nRatio);  

Parameters

nRatio
Defines as a percentage how far a child control is moved horizontally when the user resizes the host window.

Return Value

A MoveSettings value that encapsulates the requested move ratio.

Remarks

Gets a MoveSettings value that defines how much a child control is moved horizontally when the user resizes its hosting window.

static MoveSettings MoveHorizontalAndVertical(int nXRatio int nYRatio);  

Parameters

nXRatio
Defines as a percentage how far a child control is moved horizontally when the user resizes the host window.

nYRatio
Defines as a percentage how far a child control is moved vertically when the user resizes the host window.

Return Value

A MoveSettings value that encapsulates the requested move ratio.

Remarks

Gets a MoveSettings value that represents no motion, vertical or horizontal, for a child control.

static MoveSettings MoveNone();  

Return Value

A MoveSettings value that fixes the control in place, so that it does not move as the user resizes the host window.

Remarks

Encapsulates move data for controls in a dynamic layout.

struct CMFCDynamicLayout::MoveSettings;  

Remarks

This is a nested class inside CMFCDynamicLayout.

Check if the move data specifies a nonzero horizontal move.

BOOL IsHorizontal() const 

TRUE if the MoveSettings object specifies a nonzero horizontal move.

Check if the move data specifies no movement.

BOOL IsNone() const 

TRUE if the MoveSettings object specifies no movement.

Check if the move data specifies a nonzero vertical movement.

BOOL IsVertical() const 

TRUE if the MoveSettings object specifies a nonzero vertical movement.

Gets a MoveSettings value that defines how much a child control is moved vertically when the user resizes its hosting window.

static MoveSettings MoveVertical(int nRatio);  

Parameters

nRatio
Defines as a percentage how far a child control is moved vertically when the user resizes the host window.

Return Value

A MoveSettings value that encapsulates the requested move ratio.

Remarks

Sets the window size below which layout is not adjusted.

void SetMinSize(const CSize& size);

Parameters

size
The desired size below which layout is not adjusted.

Remarks

The position and size of a child control is changed dynamically when a hosting window is being resized, but there is a minimum size below which the layout is not adjusted. The user can resize the window to a smaller size, but parts of the window are then hidden from view.

Gets a SizeSettings value that defines how much a child control is resized horizontally when the user resizes its hosting window.

static SizeSettings SizeHorizontal(int nRatio);  

Parameters

nRatio
Defines as a percentage how far a child control is resized horizontally when the user resizes the host window.

Return Value

A SizeSettings value that encapsulates the requested size ratio.

Remarks

Gets a SizeSettings value that defines how much a child control is resized horizontally when the user resizes its hosting window.

static SizeSettings SizeHorizontalAndVertical(int nXRatio int nYRatio);  

Parameters

nXRatio
Defines as a percentage how far a child control is resized horizontally when the user resizes the host window.

nYRatio
Defines as a percentage how far a child control is resized vertically when the user resizes the host window.

Return Value

A SizeSettings value that encapsulates the requested size ratio.

Remarks

Gets a SizeSettings value that represents no change in size for a child control.

static SizeSettings SizeNone();  

Return Value

A SizeSettings value that fixes the control at a certain size, so that it does not change size as the user resizes the host window.

Remarks

Encapsulates size change data for controls in a dynamic layout.

struct CMFCDynamicLayout::SizeSettings;  

Remarks

This is a nested class inside CMFCDynamicLayout.

Checks if the resize data specifies a nonzero horizontal resizing.

BOOL IsHorizontal() const 

TRUE if the SizeSettings object specifies a nonzero horizontal resizing.

Checks if the resize data specifies no resizing.

BOOL IsNone() const 

TRUE if the SizeSettings object specifies no resizing.

Checks if the resize data specifies a nonzero vertical resizing.

BOOL IsVertical() const 

TRUE if the SizeSettings object specifies a nonzero vertical resizing.

Gets a SizeSettings value that defines how much a child control is resized vertically when the user resizes its hosting window.

static SizeSettings SizeVertical(int nRatio);  

Parameters

nRatio
Defines as a percentage how far a child control is resized vertically when the user resizes the host window.

Return Value

A SizeSettings value that encapsulates the requested size ratio.

Remarks

Hierarchy Chart
Classes

Show: