With The Case Of  Release The Power OF  Visual C++ !   HomeProducts | PurchaseSupport | Downloads  
Download Evaluation
Pricing & Purchase?
E-XD++Visual C++/ MFC Products
Features Tour 
Electronic Form Solution
Visualization & HMI Solution
Power system HMI Solution
CAD Drawing and Printing Solution

Bar code labeling Solution
Workflow Solution

Coal industry HMI Solution
Instrumentation Gauge Solution

Report Printing Solution
Graphical modeling Solution
GIS mapping solution

Visio graphics solution
Industrial control SCADA &HMI Solution
BPM business process Solution

Industrial monitoring Solution
Flowchart and diagramming Solution
Organization Diagram Solution

Graphic editor Source Code
UML drawing editor Source Code
Map Diagramming Solution

Architectural Graphic Drawing Solution
Request Evaluation
ActiveX COM Products
Technical Support
  General Q & A
Discussion Board
Contact Us


Get Ready to Unleash the Power of UCanCode .NET


VC++ Tutorials / UI Samples

UCanCode Software focuses on general application software development. We provide complete solution for developers. No matter you want to develop a simple database workflow application, or an large flow/diagram based system, our product will provide a complete solution for you. Our product had been used by hundreds of top companies around the world!

Microsoft Visual C++ is a programming environment used to create computer applications for the Microsoft Windows family of operating systems. To assist it, the Microsoft Foundation Class Library, or MFC, was created as an adaptation of Win32 in MS Visual Studio.

This web site provides lessons and links on how to exploit the MFC library, including its use in MS Visual Studio and its implementation of the C++ programming language.

"100% source code provided! Free you from not daring to use components because of unable to master the key technology of components!"

Below are the list of these VC++ Tutorials Codes:

VC++ Tool: Visual C++ and SQL generator for ODBC Database, with source code sample

VC++ MFC Tutorial: GDI Objects

E-XD++ GDI Drawing PolyBezier Example: Drawing Cloud Shape

VC++ MFC example: Micrsoft Visio 12 like Print Preview Source Code

E-XD++ GDI Drawing Example: Drawing A Clock Shape

E-XD++ GDI Drawing Example: Drawing Wave Shape

E-XD++ GDI Drawing Example: Drawing UML Actor Shape

E-XD++ UML Drawing Example: Drawing UML Package Shape

E-XD++ UML Drawing Example: Drawing UML Component Shape

VC++ MFC Codes: Display Message Balloon Tip Window with SetWindowRgn and CreateRectRgn and CombineRgn

Visual C++ Example: Load DIB Bitmap File and Save Bitmap file and Convert dib to bitmap and rotate bitmap file

GDI Example: Add and Draw US flag with E-XD++, five star shape

VC++ Code: Drag and Drop File in Dialog with WM_DROPFILES and WM_NCLBUTTONDOWN

E-XD++ GDI VC++ Drawing Example: Draw Animate Line with CBrush

Get Business Card / Label Print Component C++ Source Codes

E-XD++ GDI Drawing Example: Drawing ADDL Package Shape

Store and read from XML File with .NET and C# framework, C++/MFC Example

Draw or Paint Spline Curve Line with VC++ Source Code

VC++ Example: splitter control in dialog UpdateWindow GetWindowRect GetDlgItem

VC++ GDI Example: GDI AlphaBlend  and Bitmap Alpha

Create VC++ MFC Chart Control,  Drawing and Priint Bar Chart, Source Codes

CDialogBar, CBitmapButton in Dialog Bar, SubclassDlgItem and EnableDocking VC++ Example

Converter Convert RTF to HTML with VC++ Source Codes, and RICHED32.DLL

VC++ Sample: Create Shadow of bitmap, draw shadow with GDI, TransparentBlt, SetBitmapBits and GetBitmapBits or GetRValue, GetGValue and GetBValue

VC++ Ado Tutorial with VC++ Ado Sample and VC++ Ado Example

MFC Article: Create toolbar with SetButtons and SetButtonInfo and OnNotify

VC++ MFC Example: Clipboard on CF_DIB, CF_METAFILEPICT, OpenClipboard, GetClipboardData, CloseClipboard

Free VC++ Tool: Convert C++ Code file to HTML

VC++ Sample: Convert EMF to WMF using GDI+

COleDateTime, Get first day of week, COleDateTimeSpan, VC++ Example

MFC Multiple Page Print preview Article and CPrintPreviewState, it with CPrintPreview and DoPrintPreview, LPDEVMODE and GetPrinterDeviceDefaults

Visual C++ 2008 Feature Pack: MFC Visual Studio Office 2007 Style Enhancements

Create MFC VC++ Static Library, UpdateData and LoadIcon

VC++ GDI Example: Draw an periodic Table shape

OLE DB Sample, Database, Atldbcli.h,CoInitialize, MoveNext Visual C++ Example

VC++ Example:  HRGN, SetWindowPos, SetWindowRgn, Create Region from bitmap file

VC++ Example: GetPath, BeginPath, EndPath, True Type Font, Draw Outline of text

VC++ Sample:  Screen Capture

VC++ MFC Sample Code:  Transparent bitmap splash screen

MFC Example Multiple monitor support with GetSystemMetrics EnumDisplayMonitors and GetMonitorInfo

VC++ Example: Write HTML File (Table)


C# Article: Create, Open, Load, Save, Import, Export, Edit, SVG File Document With C#, SVG .NET Class Library

VC++ Example: Sizing Control Bar with Tab Control, DockControlBar

VC++ Example: Control for Load and  View Bitmap file, ScrollBar

VC++ Example: Draw Emboss text and other Shadow shape on your bitmap

VC++ Example:  Store Bitmaps into an Array, CBitmap, CreateBitmapIndirect

VC++ Example: CString Extension, Get Window Directory

VC++ Example: Draw or display Real-time data plot Chart

VC++ Tool: MFC under the hood, WinMain, VC++ Programmer

VC++ Article: Calculate the width of text with GetTextExtentPoint32, DT_CALCRECT and GetCharABCWidths

VC++ Sample: Multiple Views layout of RepositionBars and DeferWindowPos with RecalcLayout and UpdateAllViews

VC++ FAQ: Place a bitmap image on the clipboard

VC++ Example: Macintosh-like Progress Control, CProgressCtrl in Dialog

VC++ Article: Create menus with Unicode, ModifyMenu, GetSubMenu

VC++ Grid Control Library Source Code Based on CListCtrl

Add proto - logic diagram displays to your Java, C++, and .NET applications, for the desktop and rich internet applications.

VC++ MFC Example: Place Combo Box, Edit Box, Progress Control, Check Box on toolbar, CComboBox, CEdit, CCheckBox

VC++ Sample:  MP3 Player with C++ Source Code, Play MP3 File

VC++ Example: Rotate a bitmap DIB image File

VC++ Sample: Free C++ Twain Source Code

VC++ Example: Convert / Turn bitmap DIB File to a JPEG file

VC++ Article: Create Cursor, Display cursor, Convert bitmap to cursor, CreateIconIndirect, DeleteDC, SelectObject, ICONINFO

VC++ Tutorial: Using DirectX, DirectDraw in MFC, Article, Example Codes

VC++ Example:  A few skin library with source codes

VC++ Example: Retrieving lost passwords using Windows hook and WM_GETTEXT

VC++ Example: Sort CObList class

VC++ Example: Write, Create AVI Files

VC++ Article Draw Rotate / slant text strings SetWorldTransform

VC++ .NET Tutorial Programming: Using GDI+ Brushes to Draw Text

VC++ Single Instance Window, CreateWindow, CWinApp, SetWindowPos, SetFocus

VC++ Article: create or change the skin, shape, image of dialogs, SetWindowLong

VC++ MFC Example: Create or show Progress Bar/Edit Control/Combobox Control/icon in a status bar

VC++ MFC Tutorial: Auto Save files, CDocument - CView

VC++ Demo: Drop down Combo Box in CTreeCtrl and CListCtrl

VC++ Article: CSplitterWnd Extension that Allows Create Multiple Views, and Switch Views in Any Pane

VC++ Article: Print and Draw Html Document Text, draw like DrawText

VC++ Codes: Draw text along line and draw rotate text

VC++ MFC Example: Adding VBScript and JScript support in your C++ applications

Draw Rotate Text with GetTextExtent and SetTextAlign and ExtTextOut, VC++ Example

CAM simulator Sample with VC++ MFC Source Code

Using GDI+ with MFC or native C/VC++

VC++ MFC Tutorial: Undo Redo Source Code

_TrackMouseEvent, GetWindow, GetWindowRect, SubclassWindow, GetWindowLong, SetWindowLong, Drawing, VC++, source code

VC++ Article: Opening / Saving multiple types of documents in MFC MDI applications

Free VC++ MFC Grid Control with VC++ Source Code

C++ and VC++ Code Generator Tool, Free UML Class Diagram Drawing Tool

VC++ Example and Article: Drawing Double Buffering With GDI+

MFC Sample: Changing Bitmaps Color Depth, CBitmap, GetDIBits

VC++ Example: Drawing an Arrow Line with Source Code

MFC Sample Code: CList Iterator

MFC Source Code: Draw Text with GetCurrentFont, GetTextExtent and GetLogFont and MoveToEx

VC++ Controls: The Tree Control, CTreeCtrl Example

UML Diagram Component / Drawing C++ Source Code Solution from ucancode, it will save you 50% - 80% time for building any UML based application.

VC++ Sample: Address Book

VC++ Tool: MFC GDI Plus thumbnail CListCtrl, BMP File, Jpeg file, Gif File, Tiff file

VC++ Tool: Printer Settings - Change, Store and Load Printer Setting, Paper Orientation

VC++ Sample: ExtSelectClipRgn or IntersectClipRect, ExcludeClipRect and OffsetClipRgn or GetMetaRgn with InvalidateRect

Send Email using MAPI - A COM  Email DLL Component, VC++ Example With Source Code

VC++ MFC Example: Add bitmap into CImageList

VC++ MFC Example: Icon Select Combo Box, CComboBox

MFC Library: Drawing Spline application with OpenGL with sample Source Code

VC++ Example Capture Print Screen to Clipboard including dropdown menu, SetWindowsHookEx and UnhookWindowsHookEx, with RegisterWindowMessage

VC++ Article: Converting Wav file to MP3 or other format using DirectShow with source code

Printing Preview toolbar, MFC Example

VC++ MFC Example: Read / Write, Load / Save, Registry access to HKEY_LOCAL_MACHINE and HKEY_CURRENT_USER

VC++ Article: UnrealizeObject and SetBrushOrg or GetSystemMetrics with Pattern Brush

VC++ MFC Sample: Magnifying Glass - demonstrates different ways to obtain or create proper DC and use BitBlt - StretchBlt functions

VC++ MFC Example: Create MFC Extension DLL, COM  and ATL, dllimport, dllexport, AFX_EXT_CLASS

MFC visualisation software: Create and draw Thumbnail View with CWinApp and CDocTemplate and CMultiDocTemplate

Visual C++ Addin: CFileDialog AddIn, Download Example

VC++ Example: CListBox - A list box with Icons, AddString, InsertString, with Image Item

VC++ Tutorial /Database Print

VC++ MFC ActiveX Control Article, COM Drag - Drop  Example

VC++ Code: Change the font of window with SetFont and EnumChildWindows and CreateIconFromResource

VC++ Tutorial: Custom CListBox - A ListBox with Radio Box, DrawFrameControl, DrawFocusRect

VC++ Example: Load, Draw Bitmap File, CBitmap, GetBitmap,  BITMAPINFOHEADER

VC++ MFC Tutorial: Extend CStringArray and CString

MFC Library Article: Create Database with SQL Server and ADO Stored Procedures

MFC Sample Code: Load and Display PNG Image File

GDI+ Example:  Draw Curve ActiveX Control GraphicsPath and Graphics

C++ Article: Compuware, BoundsChecker, Tracking GDI resource memory leaks

MFC Example: Create Multiple Thread with CreateThread and CWinThread and SuspendThread and ResumeThread

Date-Time Edit Control A simple masked date-time editor. VC++ Article Source Code and GetWindowText

MFC GDI+ Sample: gdiplus.lib with GdiplusStartupInput and GdiplusStartup with GdiplusShutdown

VC++ Tips: Auto-complete edit control

VC++ Programming: Docking Toolbars and CControlBar, Side-By-Side, EnableDocking

OpenGL Tutorial:  Printing and Print Preview with VC++ Example

VC++ Example: CToolBar, ToolBar Customization, Saving, Restoring and Drag and Drop

MFC Sample: CSliderBarCtrl Sample Source Code - RealOne Player Volume Bar Clone

MFC Example: Export dialogs in MFC Extension DLLs

MFC Sample: Display or Create Splash Screen, Show Transparent Bitmap with SetWindowRgn

VC++ Example: CFormView, Replace a view in SDI Application, LoadLibrary, GetProcAddress, GetActiveView, AfxGetMainWnd, SetWindowLong

VC++ Tool: RTF-to-HTML Converter, Convert Rich Text to HTML Example

Add Phthon in or into C++ Application with Visual C++ Article or Tutorial Source Code

E-XD++ UML Drawing FlowChart Example: Drawing UML Note Shape

MFC Example: Rows of CToolBar and CToolBarCtrl, with CalcDynamicLayout, with SetRows CBRS_ALIGN_TOP , CBRS_SIZE_DYNAMIC and FloatControlBar

VC++ Article: Insert a bitmap file - HBITMAP into a Rich Edit Control, use COleDataSource, CF_BITMAP, and STGMEDIUM

Visual C++/MFC Tutorial - Lesson 1: Behind the Scenes with Handles and Post Messages

VC++ Debug Trace, Memory Check, Assert Article, DebugOutputString CMemoryState A C++ Projects

Customized Printing Dialog using PrintDlg

VC++ Example: Add VBScript and JScript support in VC++ applications with Script ActiveX Control MSSCRIPT.OCX

Create Multiple Language to MFC Extension DLL Toolkit with Resource only

VC++ MFC DIBLOOK Advance Sample, with file open dialog preview

MFC Sample: Add status bar to an MFC dialog, CStatusBar

VC++ Game Sample Source Code, Wave File Play, Midi file play, DirectX

VC++ Example: Using one VC++ extension DLL in another VC++ Extension Dll

Visual C++ XML Article, Load Parse and save XML Document with MSXML Library

VC++ MFC Tutorial: Unicode, MBCS and Generic text mappings

C++ Article STL Iterator and the VC++ MFC Iterator

Visual C++ Tutorial: Visual C++ Debug / VC++ Debug / MFC Debug

VC++ Example Source: 2D Chart and 3D Plot Print Chart Control

MFC Tutorial: MFC Printing

Runtime class information using CRuntimeClass in MFC

VC++ Article: Create 2d graphics editor, AutoCAD, like Toolbar

Globals in MFC Class Framework, CWinApp

VC++ Example: Display GIF-animatE using GDI+ with BMP, JPEG, PNG, TIFF, EMF, WMF, DrawImage

VC++ MFC Example:  CTreeCtrl, Create Tree Control

Unicode Programming in MFC

C# Example: Free Draw .NET GDI+ Gauge Control with Source Code

VC++ MFC Example: A Slider Control, CSliderCtrl

GDI+ Examples: Drawing Column Chart

VC++ MFC Example: Draw 2D Bar Chart, Draw 2D Pie Chart, Create Line Chart

VC++ Article: CTreeCtrl, OLE Drag and Drop Copy between Tree controls

VC++ Article: Draw Image Background and CScrollView text with bitmap brush and PreCreateWindow

VC++ Codes: GetRandomRgn  or MapWindowPoints or OffsetRgn, GetDCEx with GetClipBox, GetClipRgn and SelectClipRgn

C/C++ Drawing BarCode Tutorials

GDI Example: Transparent Bitmap - True Mask Method

VC++ Example: Classes to Record, Play, and Save WAV File to disk

GDI+ Example: Using GDI+ Brushes to Draw Text

VC++ MFC Tutorial: ActiveX Control Example

E-XD++ GDI VC++ Drawing Example: Drawing Pie Progress Control Shape

VC++ .NET Programming, Writing a Wrapper for COM Components

VC++ MFC Tutorial: CListCtrl, InsertItem, Using List Control, SetImageList, Article with source code.

Visual C# Samples: Scribble Sample - Visual C# MDI Drawing

VC++ MFC Example: Multiple Document / Views, CObList

MFC Example: Print Preview in MFC - Dialog

MFC Example: Using MFC For Drag '& Drop, Cut, Copy, and Paste

Visual C++ MFC Tutorials: CZoomView / A class that provides "zoom" feature

VC++ Source Code Tool: Project number Line code Counter Statistical

VC++ MFC Tutorial: C / C++ Tree Class

VC++ Example: CComboBoxEx with History, ComboBox, CComboBox to history!

VC++ Example: Draw or fill Gradient

VC++ Example: ODBC Database SQL DSN- A class to dynamically read data from any ODBC data source 

Visual C++ Examples: A fully customizable Property Grid, Grid Control, Property Window, Property Control with VC++ source codes.

VC++ XML Read and Write Article: C++ Source Code  for Creating and Processing XML documents

MFC Examples: MFC Solution to Explanding the CFileDialog Common Dialog

MFC Example: CreateFile and WriteFile with save memory dc to bitmap file

C++ Example: Formula Editor, and mathematical control with Drag Drop, Copy, Cut, Paste, Export to image support.

MFC GDI Tutorials: GDI Printing, GDI+ Printing

VC++ MFC Tutorial: Create MFC Extension Dll, Export MFC Classes

ActiveX Control Tutorial, COleControl

VC++ Tutorials: Visual C++ DLL: How to build a resource-only DLL?

Visual c++ character sets, Unicode, _MBCS

VC++ Example: Listbox In-place Editing, CListBox, Text Input

MFC Topics: CTreeCtrl, CListCtrl, SetItemData, GetItemData, InsertItem

VC++ MFC Example: Sharing file folders using tree control drag & drop

MFC Programming: MFC Tab Control, CTabCtrl

VC++ Article: Skin based slider control, CSliderCtrl

VC++ MFC Thread Tutorial: _beginthreadex, WaitForSingleObject, pausing, resuming, and stopping threads

Visual C++ Example: Multiple CRectTracker Drawing

Visual C++ Example: Transparent MFC CSliderCtrl Source Code

Visual C++ Example: MFC Bitmap Button Source Code (CButton)

VC++ Article: Tile, center and stretch a bitmap as your MFC dialog background

Visual C++ CComboBox: Auto-complete ComboBox

MFC Tutorial: Sort CObArray class

VC++ Sample: Quick Sort for CStringArray

Visual C++ / VC++ MFC Printing Class Library

Cool office XP Style Menu, Icon Menu and Bitmap Menu, CMenu

Visual C++ Example: How to swap two items of  CListView, GetItem, GetItemState

Cool MFC Font Combo Box with source codes (CComboBox)

MFC Source Code: WindowFromPoint and GetDlgItem or ScreenToClient

MFC GUI Framework: inside Atl & dll server

Visual C++ Example: MFC XML Serialize

MFC Example: CListBox with Image Item, CCheckListBox

Visual C++ Example: DXF File Drawing, load, write

Day, week, month calendar control with vc++ source code,MS OutLook Look

GDI+ Examples: GDI+ Line/Curve Drawing and Hit Test CObject and CObArray

CDC Examples: Drawing vertical text

VC++ Article: Print ListCtrl on multiple pages, CListCtrl, CListView

Visual C++ Drawing Example: Anti-Alias C++ Drawing

VC++ Tutorial: Drag, Drop, COleDataSource, CSharedFile, RegisterClipboardFormat

MFC CListCtrl: Print the contents of the list control

MFC SetTimer: WM_TIMER with VC++ Sample Source Code

VC++ Example: Change the background color of a dialog, CDialog, OnCtlColor

VC++ Example: Quick Draw Image Stretching Technique, StretchBlt Dib

VC++ Example: OnPreparePrinting and OnBeginPrinting and OnEndPrinting, Plug-in class to support printing from a listview

MFC VC++ Topics: Getting the location of a printer device

Com Programming: Com Component, ATL Library, Com Interface, QueryInterface Example

MFC Article: XP Style CBitmapButton

MFC VC++ Topics: Print a bitmap full page

VC++ Example: Com Programming

VC++ Example: Creating a CTabCtrl Application

C++ Example: Geometry Concepts Line Intersection and its Applications

VC++ Tutorial: High quality image rotation (rotate by shear)

MFC Example: CFile and Creating a File, Open, Write, CFile::modeCreate, CFile:: modeReadWrite

MFC Example: CStdioFile-derived class for multibyte and Unicode reading and writing

VC++ MFC Example: Paint and draw source code, CClientDC

Free VC++ Example: Free Properties Grid Control , Source Code Download

VC++ MFC Tutorial: A simple intorduction to using the MFC collections CArray, CList and CMap, Free Source Code Download

VC++ MFC Tutorial: Free Drawing Printing ActiveX Control that use GDI+

VC++ Sample Code: CFindReplaceDialog, CFrameWnd

Visual Studio .NET 2003 Tutorial - Using Visual Studio .Net 2003, Building C++ .Net Application

Drawing Tutorial for Visual C++ 2005

VC++ MFC Example: Extend draw text with ExtTextOut

VC++ MFC Tutorial: Property Pages for ActiveX Controls, COlePropertyPage, GetIDispatch

VC++ MFC Sample: CreateDIBSection, BITMAPINFOHEADER, CreateCompatibleDC, BITMAPINFO

VC++ Example:  RegisterWindowMessage, WM_USER, ON_NOTIFY 

VC++ Articles: Create Thread, CWinThread, AfxBeginThread

VC++ MFC Example: CButton, Button Contrl with 3D Text Drawing

VC++ MFC Tutorial: Print the contents of the list View control, CListCtrl, Custom Draw

VC++ MFC Source Code: Read, Write and Play GIF89A Gif image file, Example Download

VC++ Sample:  Outlookbar-style menu  control interface with source code download.

VC++ Tutorial: Drag and Drop Draw with Mouse by Using SetCapture, ReleaseCapture, TrackMouseEvent

VC++ Example: Free ActiveX Grid Control (Written with MFC Source Code)

VC++ Article: Color components, RGB Component, HSL Component Source Code, editor control

VC++ Example: ToolBar with ComboBox, add CComboBox to CToolBar

VC++ Example: How to print an ActiveX MSChart Report Chart control Component, Source Code

VC++ Article: CListCtrl, CListView to displaying jpeg image thumbnails with PaintLib

Full Screen with CWnd and Diagram Like Microsoft Visio 2007

VC++ development Sample: Build and Setting Multiple workspaces and project

VC++ MFC Project Setting, Unicode, MBCS,_MBCS or _UNICODE, wWinMainCRTStartup

Introduction to GDI+ in .NET

GDI+ Font, Brush and Bitmap

GDI+ GraphicsPath and LinearGradientBrush

GDI+ Printing.

GDI+ and DrawArc and DrawPath

GDI+ Color and ARGB with Example


How to enable or disable the tooltip of each shape on the canvas?

R. Call the following method that defined within class file FOGlobals.h:

// Enable canvas with tooltip showing or not.
FO_API_DECL void AFX_API FOPEnableToolTip(const BOOL &bEnable);

How to enable or disable the full feature of port shape?

R. By considering the memory size of the port shape, E-XD++ only use simple port shape (Without the full property) at start, with this state, you cann't change the port type, port width or port height features, but if your application still want to use other kind of port style, you can call the following method to enable it (Defined in class file FOGLobals.h:

// Enable full feature of properties of port.
FO_API_DECL void AFX_API FOEnablePortFullProp(const BOOL &bEnable);

How to enable or disable the auto scroll of canvas?

R. By default, the canvas ships with auto scroll for canvas, but if you want to disable this feature, call:

// Enable canvas auto scrolling or not.
FO_API_DECL void AFX_API FOPEnableAutoScrolling(const BOOL &bEnable);

How to enable the route style from left - right to top - down?

R. By default, when links route on the canvas, it shows from left to right route style, but if you want to change it to top - down style, call the following method:

// Enable link route from top or bottom.
FO_API_DECL void AFX_API FOPEnableRouteTop(const BOOL &bFromTop);

How to enable or disable the route feature of links?

R. With the following method, you can enable or disable the route feature of links:

// Enable link route or not.
FO_API_DECL void AFX_API FOPEnableLinkRoute(const BOOL &bEnable);

How to determine which kind of shape you take?

R. Mostly, we can use IsKindOf(RUNTIME_CLASS), but we can also use the following instead of:

#define HAS_BASE(pObj, class_name) pObj->IsKindOf(RUNTIME_CLASS(class_name))

How to use enable continue drawing feature?

R. By default, after you drawing some on the canvas, it will be changed to selection mode, but if you want to change it to drawing - drawing - drawing ... state, please call the following method to enable this:

// Enable continue drawing or not.
FO_API_DECL void AFX_API FOEnableContinueDraw(const BOOL &bEnable);

How to change the default width, height or type of the port on the canvas?

R. You can change the following values:

// Default port height
int m_nDefPortHeight;

// Default port width.
int m_nDefPortWidth;

// Default port type
int m_nDefPortType;

// Default port side
int m_nDefPortSide;

for example:

gfxData.m_nDefPortHeight = 15;

How to customize the drawing of Table's cell item?

R. Override the following method that defined within class CFOPVisualProxy:

// Drawing customized table cell.
virtual void DoDrawTableCell(CDC *pDC, const CRect &rcCell,const int &nRow,const int &nCol);

How to customize the pen style of tracking on the canvas?

R. Override the following method that defined within class CFOPVisualProxy:

// Build track pen of the shape.
virtual CPen *BuildTrackPen(const int &nWidth);

Do something before any shape created?

R. Override the following method of class CFODataModel, you can do something before any shape created:

// Call before create shape new shape,this method will be called after each new shape is created,
// You can override this method to do something before shape created.
// pShape -- the pointer of shape that created.
virtual void DoInitCreateShape(CFODrawShape *pShape);

Do something before link line is created?

R. When any link is created on the canvas, the following virtual method will be called (Defined in class CFODataModel):

// Add Link Shape
// m_drawshape -- Shape Type id start from FO_COMP_CUSTOM
// arPoints -- Init position of link shape.
// pFrom -- start link port shape pointer.
// pTo -- end link port shape pointer.
// nArrowType -- if being true,it has an arrow else it doesn't has an arrow.
// 0-None arrow.
// 1-One arrow at the end.
// 2- Two arrow,start arrow and end arrow.
virtual void AddLinkShape(UINT m_drawshape,
CArray<CPoint,CPoint> *arPoints,
CFOPortShape *pFrom = NULL,
CFOPortShape *pTo = NULL,
int nArrowType = 0);

Override this method to init the link line.

What's the quickest way to add hundreds of shapes to canvas?

R. Please call the codes like below:

CRect rc = CRect(150,200,230,240);

int xy = 0;
CFODrawShapeList m_listUpdate;
for(xy = 0; xy < 300; xy ++)
CFORectShape *pReturn = new CFORectShape;



Call AddTail to add shape to the list of canvas at first, and then call UpdateShapes one time, it will be very fast.

How to hide the ruler bar of canvas?

R. Call the following method that defined in CFOPCanvasCore:

// Show or hide ruler bar
// bVisible -- visible or not
virtual void ShowRulers(const BOOL &bVisible);

How to change the unit of the ruler by code?

R. Call the following method that defined in CFOPCanvasCore:

// Change the ruler unit.
// unit -- unit of the ruler mark,it must be one of the following value.
// enum FieldUnit 
// { 
// FUNIT_NONE = -1,
// FUNIT_FEET, //1
// FUNIT_MM, //2
// FUNIT_CM, //3
// FUNIT_KM, //5
// };
void SetRulerUnit(const FieldUnit &unit);

How to load a composite from resource?

R. Call the code like below:

CRect rc = CRect(0,0,100,100);
BOOL bFirst = FALSE;
CFOCompositeShape *pReturn = new CFOCompositeShape;

CRect rcComp = CRect(0,0,0,0);
POSITION pos = pReturn->GetCompList()->GetHeadPosition();
CFODrawShape *pShape = NULL;
while(pos != NULL)
pShape = (CFODrawShape* )pReturn->GetCompList()->GetNext(pos);

CRect rcPos = pShape->GetSnapRect();
rcComp = rcPos;
bFirst = FALSE;
rcComp = CFODrawHelper::GetMaxRectExt(rcComp,rcPos);

CPoint ptNew = CPoint(30,30);

CRect rcNew = CRect(ptNew.x,ptNew.y,ptNew.x + rcComp.Width(),ptNew.y+rcComp.Height());


pReturn = NULL;

How to load an emf file to canvas?

R. Call the codes as below:

CRect rc;
rc = CRect(20,20,200,100);
CFOWMFShape *pReturn = new CFOWMFShape;

How to add a rich text shape to canvas?

R. Call the codes as below:

CRect rcPos = CRect(20,20,200,200);
CFOPRichEditShape *pReturn = new CFOPRichEditShape;
pReturn->Create(rcPos,this,"{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\froman\\fprq2\\fcharset0 Times New Roman;}{\\f1\\fswiss\\fprq2\\fcharset0 System;}}{\\colortbl ;\\red255\\green0\\blue0;\\red51\\green153\\blue102;\\red0\\green0\\blue255;}\\viewkind4\\uc1\\pard\\cf1\\i\\f0\\fs24 Inputted\\cf0\\i0 \\cf2\\b rich\\cf0\\b0 \\cf3 text\\cf0 !\\b\\f1\\fs20 \\par }");
pReturn = NULL;

How to add a rectangle to the background of canvas?

R. Call the codes as below:

CFORectShape *pRect = new CFORectShape;
CRect rcPos = CRect(10,10,200,200);


How to add a line shape to the canvas?

R. Call the following codes:

CArray<CPoint,CPoint> ptArray;

CFOLineShape *pReturn = new CFOLineShape;
CString strCaption = GetCurrentModel()->GetUniqueCaption(pReturn->GetType());
CString strName = GetCurrentModel()->GetUniqueName(pReturn->GetType());


How to obtain the list of all shapes on the canvas?

R. Call the following methods to obtain the shapes of datamodel:

// Obtain all the shapes on the canvas,it will return a pointer to the list of child shapes on the canvas.
CFODrawShapeSet * GetShapes() { return GetFormObjects(); }

// Obtain all the shapes on the canvas,it will return a pointer to the list of child shapes on the canvas.
void GetAllShapes(CFODrawShapeList &list);

// Get shapes count on the canvas.
int GetCompsCount() const;

// returns TRUE if the document has no shapes on the canvas.
BOOL IsEmpty() { return m_ShapeList.IsEmpty(); }

Call the following methods to obtain the shapes within the background of canvas:

// get shape list
CFODrawShapeSet *GetCompList() { return &m_GroupList; }

// get shape count
virtual int GetCompCount() { return m_GroupList.GetCount(); }

How to obtain the list of shapes that selected?

R. Call the following method that defined within class CFOPCanvasCore:

CFODrawShapeList *GetSelectShapes()

How to check which shape is hitted with mouse on the canvas?

R. Call the following method to do that:

// Hit test, return the hit test shape pointer.
// point -- HitTest logical point.
virtual CFODrawShape * HitTest(
// Mouse hit point.
CPoint point
For port, please call:

// Hit Test Port,ports are the shapes that link together.
// return the pointer of current shape's port shape.
// point -- HitTest logical point.
virtual CFOPortShape* HitTestPort(
// Mouse hit point.
CPoint point,
// Use extend border hit or not
const BOOL &bUseExt = TRUE,
// Hit expand value.
const int &nExp = 30

How to change the UI Unit of canvas?

R. Call the following method that defined in class CFODataModel:

// Change the UI unit
// eUnit -- Unit type to be converted,it must be one of the following value:
// enum FieldUnit 
// { 
// FUNIT_NONE = -1,
// FUNIT_FEET, //1
// FUNIT_MM, //2
// FUNIT_CM, //3
// FUNIT_KM, //5
// };
void SetUIUnit(FieldUnit eUnit);

How to change the UI Scale of canvas?

R. Call the following method to do that:

// Default drawing scale,Default 1/1.
void SetUIScale(const FOPFraction& aScale);

How to enable each shape on the canvas has an unique name?

R. Call the following method that defined in class CFODataModel:

// Show with unique name and caption.
void EnableUniqueName(const BOOL &bUniqueName);

How to disable the automatically link feature?

R. When we move our mouse over any port (Read Corss within any shape), we can start to click on it to draw link immediate, but if we want to disable this feature, call the following method (Defined in class CFODataModel):

// Change to allow hole link mode,mostly,when we move mouse over the connection ports,we want to 
// click the mouse to start creating links from this port right now.This method is defined for this kind
// of case,you can change the value of bAllow to switch to allow link or not.
void SetAllowHoleLink(const BOOL &bAllow);

How to obtain the size of the canvas?

R. Call the method below (Defined in class CFODataModel):

// Obtain the size of the canvas.
virtual CSize GetCanvasSize() const;

Which is the quickest way to rotate points?

R. Call the following codes to rotate points:

void CMyShape::RotatePoints(int nAngle, double dStartX, double dStartY, LPPOINT cCtlPt, const int &nPtCount)
CFOMatrix* pMat = new CFOMatrix();


CPoint ptx;
for (int j=0; j<nPtCount; j++)
ptx = cCtlPt[j];
cCtlPt[j] = ptx;

delete pMat;
pMat = NULL;

How to start timer within any shape on the canvas?

R. Call the codes as below:

m_nTimerID = RegisterTimerEvent( this, 800 );

How to stop timer within any shape on the canvas?

R. Call the codes as below:

UnregisterTimerEvent( m_nTimerID );
m_nTimerID = -1;

How to update any shape within itself?

R. Call the method as below:

UpdateControl() ;

How to make shape to be cann't rotated?

R. Call the codes as below:


How to change the style of link bridge?

R. Call the codes as below:

gfxData.m_DefBridgeStyle = FOPArc;

There are the following styles can be used:

enum FOPBridgeStyle
FOPCap = 0,

. How can I include the resources (*.rc file) if I have one included already?

R: For VC6, to include a resource file, for example, rores.rc , go to View->Resource Includes.. and enter it in the dialog box as shown:

For VS2005, you can right click on an existing .rc file in the resource view and select Resource Includes...




Copyright ?1998-2009 UCanCode.Net Software , all rights reserved.
Other product and company names herein may be the trademarks of their respective owners.

Please direct your questions or comments to