BCGSuite for MFC
CBCGPDiagramVisualContainer

Detailed Description

The CBCGPDiagramVisualContainer class encapsulates the diagram object. A diagram has a visible area and contains diagram items. Call SetRect() to specify visible area. Call AddItem() to add a new diagram item. Call AddConnector() to add a new connector.

A code below demonstrates how to create the following simple diagram:

To take advantage of diagram control perform the following steps:

Copy
// Declare a member variable of CBCGPDiagramVisualContainerCtrl type:
// Call CBCGPBaseVisualCtrl::Create (CBCGPBaseVisualCtrl is the base class):
m_wndDiagramCtrl.Create(rect, pParentWnd, nID);
// Setup and use the Diagram visual object with the GetDiagramContainer accessor:
CBCGPDiagramVisualContainer* pDiagram = (CBCGPDiagramVisualContainer*) m_wndDiagramCtrl.GetVisualContainer();
pDiagram->SetFillBrush(CBCGPBrush(CBCGPColor::WhiteSmoke, CBCGPColor::White, CBCGPBrush::BCGP_GRADIENT_DIAGONAL_LEFT));
pDiagram->SetOutlineBrush(CBCGPBrush(CBCGPColor::Gray));
pDiagram->EnableInplaceEdit();
pDiagram->EnableScrollBars();
// Add items to the diagram:
CBCGPRect(CBCGPPoint(30, 10), CBCGPSize(90, 30)),
CBCGPBrush(CBCGPColor::PaleTurquoise, CBCGPColor::White, CBCGPBrush::BCGP_GRADIENT_DIAGONAL_LEFT),
CBCGPBrush(CBCGPColor::PaleTurquoise), CBCGPDiagramShape::Box);
pItem1->AddTextData(_T("Item A"));
pDiagram->AddItem(pItem1);
CBCGPRect(CBCGPPoint(200, 160), CBCGPSize(90, 30)),
CBCGPBrush(CBCGPColor::PaleTurquoise, CBCGPColor::White, CBCGPBrush::BCGP_GRADIENT_DIAGONAL_LEFT),
CBCGPBrush(CBCGPColor::PaleTurquoise), CBCGPDiagramShape::Box);
pItem2->AddTextData(_T("Item B"));
pDiagram->AddItem(pItem2);
// Add connectors to the diagram:
pConnector1_2->Connect(
pItem1, pItem2,
pConnector1_2->InsertPoint (1, CBCGPPoint(165, 25));
pConnector1_2->InsertPoint (2, CBCGPPoint(165, 175));
pDiagram->AddConnector(pConnector1_2);
// Redraw diagram:
m_wndDiagramCtrl.RedrawWindow();
See also
CBCGPVisualContainer, CBCGPDiagramVisualObject, CBCGPDiagramConnector, CBCGPDiagramAnchorPoint
+ Inheritance diagram for CBCGPDiagramVisualContainer:

Public Member Functions

 CBCGPDiagramVisualContainerConstructor.
 
 AddConnectorAdds a new connector to the container.
 
 AddItemAdds a new diagram item to the container.
 
 CalculatePointRetrieves an actual (X, Y) coordinates of connector's ending point.
 
 EditItemCalled by the framework when user starts to edit a diagram item label.
 
 EnableInplaceEditEnables or disables diagram item inplace editing.
 
 EndEditItemCalled by the framework when user finishes to edit a diagram item label.
 
 GetAnchorFillBrushGets anchor fill brush.
 
 GetAnchorOutlineBrushGets anchor outline brush.
 
 GetConnectorGets a connector by identifier.
 
 GetDefaultShapePaddingReturns a default padding of the diagram shapes added with automatic size calculation.
 
 GetItemGets a diagram item by identifier.
 
 IsCenterPointInAddItemsTells whether a newly added shape will be centered around the shape point.
 
 IsInplaceEditEnabledTells whether a diagram inplace editing is enabled.
 
 NewAnchorFromPointCreates a new anchor from the specified (X, Y) coordinates.
 
 RemoveRemoves the diagram item or connector from the container.
 
 RemoveAllRemoves all diagram items and connectors from the container.
 
 RemoveAllConnectorsRemoves all connectors from the container.
 
 RemoveSelectedRemoves all selected diagram items and connectors from the container.
 
 SetCenterPointInAddItemsSpecifies whether a newly added shape will be centered around the shape point.
 
 SetDefaultShapePaddingSpecifies a default padding of the diagram shapes added with automatic size calculation.
 
 UpdateItemsUpdates the list of items at once.
 
- Public Member Functions inherited from CBCGPVisualContainer
 CBCGPVisualContainerConstructor.
 
 AddAdds a new child visual object to the container.
 
 AreVisualEffectsEnabledTells whether the visual effects are enabled.
 
 ClearSelectionUnselect all previously selected objects.
 
 CopyToClipboardCopies visual container to the Clipboard.
 
 EnableAutoHideScrollBarsScpecifies whether container's scroll bars should be hidden when scroll bars are inactive (mouse cursor is located outside of scrollbar).
 
 EnableEditModeEnables or disables the container edit mode.
 
 EnableImageCacheEnables or disables visual container image cache.
 
 EnableLayoutEnables or disables layout manager for a visual container
 
 EnableScrollBarsEnables or disables visual container scroll bars.
 
 EnableVisualEffectsCall this method to temporarily enable/disable visual effects for all objects.
 
 ExportToBitmapExports the visual container to bitmap.
 
 ExportToFileExports the visual container to an image file (BMP or PNG).
 
 ExportToImageExports the visual container to an image.
 
 FindIndexGets a specified object index.
 
 GetAtGets a child object by index.
 
 GetBoundsRectGets a rectangle which includes all child visual objects.
 
 GetByIDGets a child object by identifier.
 
 GetCountGets the number of the child visual objects.
 
 GetFillBrushGets container fill brush.
 
 GetFromPointGets a visual object located at specified coordinates.
 
 GetGridBrushGets container grid brush.
 
 GetGridSizeGets container grid cell size.
 
 GetGridStyleGets container grid style.
 
 GetLayoutReturns a pointer to layout manager.
 
 GetOutlineBrushGets container outline brush.
 
 GetOwnerGets the visual container owner.
 
 GetRectGets the container bounding rectangle.
 
 GetScrollOffsetGets container scroll offset.
 
 GetSelGets a selected object by index.
 
 GetSelCountGets number of the selected objects.
 
 GetSelectedThemeObtain a currently selected visual theme.
 
 GetVisualThemesCountGets visual themes count.
 
 HasScrollBarsTells whether this container has scroll bars.
 
 InsertAtAdds a new child visual object to the container at the specific position.
 
 IsDPIAwareGridTells whether the grid cell size be automatically scaled according to current DPI.
 
 IsEditModeTells whether the container is in the edit mode.
 
 IsImageCacheTells whether image cache is enabled for this container.
 
 IsLayoutEnabledTells whether layout management is enabled for a visual container.
 
 IsScrollBarAutoHideEnabledTells whether control's scroll bars are auto-hidden.
 
 IsSingleSelTells whether a single selection mode is activated.
 
 LoadFromBufferLoads container data from buffer.
 
 LoadFromFileLoads container data from external file.
 
 LoadFromXMLLoads container data from XML resource.
 
 LoadFromXMLLoads container data from XML resource.
 
 OnAfterCreateWndCalled by the framework after custom control creating.
 
 OnBeforeDestroyWndCalled by the framework before custom window destroying.
 
 OnCreateCustomControlCalled by the framework to create a Visual Container custom control.
 
 OnDrawCalled by the framework to draw a visual container
 
 RemoveRemoves the child visual object by specified index.
 
 RemoveRemoves the child visual object.
 
 SaveToXMLSaves container data to external file.
 
 SelectSelects an object.
 
 SelectAllSelects all visual objects.
 
 SelectVisualThemeSelect a visual theme (by index) created in Visual Designer.
 
 SelectVisualThemeByNameSelect a visual theme (by name) created in Visual Designer.
 
 SetFillBrushSets container fill brush.
 
 SetGridBrushSets container grid brush.
 
 SetGridSizeSets container grid size.
 
 SetGridStyleSets container grid style.
 
 SetOutlineBrushSets container outline brush.
 
 SetOwnerSets the visual container owner window.
 
 SetRectSets a new bounding rectangle.
 
 SetScrollOffsetSets container scroll offset.
 

Additional Inherited Members

- Public Types inherited from CBCGPVisualContainer
enum  BCGP_VISUAL_CONTAINER_GRID_STYLE