YOU CAN CODE!

 

With The Case Of UCanCode.net  Release The Power OF  Visual C++ !   HomeProducts | PurchaseSupport | Downloads  
View in English
View in Japanese
View in
참고
View in Français
View in Italiano
View in 中文(繁體)
Download Evaluation
Pricing & Purchase?
E-XD++Visual C++/ MFC Products
Overview
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
Purchase
VX++ Cross-Platform C/C++
Overview
Download
Purchase
ActiveX COM Products
Overview
Download
Purchase
Technical Support
  General Q & A
Discussion Board
Contact Us

Links

Get Ready to Unleash the Power of UCanCode .NET


VC++ FAQ / MFC FAQ.

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 new VC++ is a programming environment used to create computer applications for the Microsoft Windows family of operating systems. To assist it, the Microsoft Foundation VC++ Class Library, MFC, was created as an adaptation of Win32 in MS Visual Studio.

2023.7, UCCVisio 2023 is Ready!

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 VC++ language. 

 
  Advance Solution

 

New HMI & SCADA Graphics Visualization Source Code Solution is ready!

UCanCode HMI-SCADA Graphics Visualization VC++ Source Code Solution -- Industrial Control \Design and Simulation Integrated Development Platform VC + + source code solution, to use E-XD++ source code visualization component library will save you more than 70% of development time.

Use E-XD++ Enterprise Edition visualization, build your own professional industrial control, simulation platform within hours, more...

"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  and VC++ File:

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

Next--> GIS and SCADA, SCADA Software With GIS, Real - Time Software with GIS, Source Code solution for C/C++, .NET

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

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

VC++ MFC Tutorial: GDI Objects

Free EMF to SVG File Convert Tool

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

Visual C++ 2010

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

VC++ Example CFilterEdit Regular Expression : Use Regular Expression to Filter Your Input, Boost C++ Library

VC++ Example: Write HTML File (Table)

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

Visual Studio 2010 in VC + + Parallel Construction of tuning

C# Article: Graph Draw and Layout Control Source Code

MATLAB Simulation Visualization Solution -- Full VC++ Source Codes

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

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

CListView Loading Images BMP, PNG, GIF, JPEG, WMF, ICO, and EMF Files

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

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

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

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

Visual Studio 2013

HMI-SCADA Software from UCanCode Software

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

MFC Sample Code: Load and Display PNG Image File

Visual C++ Sample: Resize dialog, Resize Property Sheet and Resize Property Page with CPropertySheet and CPropertyPage

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

Call Lua Script in Visual C++ / MFC Sample

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

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

VC++ Example: Loading DLLs LoadLibrary and GetProcAddress and FreeLibrary

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

LoadResource FindResource and LockResource, with UnlockResource or VC++ Sample

Create MFC VC++ Static Library, UpdateData and LoadIcon

VC++ MFC Tutorial: Adding Context Help to your application HtmlHelp

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

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

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

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

Windows Debug - Debug Application Crash, Visual C++

GetDeviceType and _splitpath with lstrlen and lstrcat

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

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

Visual C++ Serial Data Communication, with Open Port, Close Port and Write, data tranmission, and read data

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

ChartDirector

DCS PLC HMI SCADA

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

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

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

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

Graphics Drawing Tool by with C# Source Code

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

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

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

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

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

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

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

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

SVG Vector Graphics Editor With Source Code

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

RegisterClipboardFormat with COleDropSource, CSharedFile to drag to word and excel Visual C Codes

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

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

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

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

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

VC++ Article: Skin based slider control, CSliderCtrl

VC++ Example: SaveDC and RestoreDC, IsPrinting and GetSysColor

Visual C++ Express Download

VC++ Controls: The Tree Control, CTreeCtrl Example

Open Source Project's in VC++ & MFC

GIS and GPS Mapping Software for .NET

Visual Studio example and Visual Studio Tutorial and mfc tree control

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

VC++ Grid Control Library Source Code Based on CListCtrl

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

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

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

VC++ Logical Circuit Simulator Source Codes

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

OPC, PLC, SCADA Component And Source Code

VC++ Printing Article with Printing Text and Printing Table, Printing Jpg and Gif and PCX

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

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

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

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

C++ XML Parser

VC++ Article: DECLARE_SERIAL and IMPLEMENT_SERIAL and serialize data from or to disk

C# Aircraft Instrument Control

HMI Graphics Component with VC++ Source Code

VC++ GDI Example: Draw an periodic Table shape

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

MFC MDI and SDI Example to create ruler scrollview and splitter

Visual C++ 2010 Article: MFC  Thumbnail Preview and Com DLL with Com Interface

Draw transparency  image file, Alpha Blending using GDI+ Sample

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

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

VC++ Sample:  Screen Capture

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

Visual C++ MFC Class Wizard

VC++ Source Code Example: Create TIFF File and Write Tiff file and Read Tiff file

VC++ Example: Write, Create AVI Files

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

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

ExtTextOut, TabbedTextOut, in WinCE in VC++

ActiveX Control with MFC Source Code CStatusBar

Free VC++ Port / IO Serial Communication Source Code

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

VC++ MFC Sample Code:  Transparent bitmap splash screen

MFC Example: Docking CSizingControlBar Windows inside ActiveX Control with CFrameWnd and SetTimer

RichEdit Control in MFC CRichEditView and MSFTEDIT

StatusBar in CDialog,  SetPaneText and CTime, GetCurrentTime with VC++ Sample

Visual C++ and MFC Appwizard: CMDIChildWnd with CenterWindow AfxGetMainWnd

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

Hosting WPF Content in an VC++ MFC Application

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

MFC Article: XP Style CBitmapButton

Screen Capture , to Clipboard, C++ Source Code, Get bitmap of Window

MFC Example:Store and read with Ini file

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

HMI-SCADA Visualization Solutions for C/C++, Java, C# and VB

High-speed Charting Control, Real Time Chart, Data Visualization, C# Source Code

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

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

VC++ Sample: Address Book

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

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

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

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

C++ Chart Graph Library

Play GIF, Load GIF, GIF Animate, with GDI+ Example

MFC Example: CoInitializeEx and SHBrowseForFolder  with file folder browser

MFC Example: Copy, Move and Delete files and rename directories,  SHFileOperation and CFileFind and FindFirstFile with FindNextFile

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

C++ Property Grid Control

Play MP3 File and MP3 Palyer with Visual C++ Source Codes

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

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

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

Visual C++ Addin: CFileDialog AddIn, Download Example

MFC Article: Creating Self-Extracted Executable file with open-source compression libraries

Get file or folder time and set file or folder time, FindFirstFile and FindNextfile with  GetFileAttributes vc++ example

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

Intouch with SCADA System and HMI, OPC, PLC VC++ Source Code

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

Direct2D Vector Graphics Rendering with Visual C++, MFC

Visual C++ 2008 Feature Pack

MFC Source Code: SQLPrepare and SQLAllocStmt with CDBException and SQL Query and ExecuteSQL

Spell Checker with VC++ Source Codes and CStringArray with TrimLeft, TrimRight and CompareNoCase CWaitCursor

MFC Example: WM_KICKIDLE and CCmdUI and ON_UPDATE_COMMAND_UI and WM_IDLEUPDATECMDUI

OpenGL Line draw, 2D Graphics, and Render Article and Samples Code

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

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

MFC Sample: Changing Bitmaps Color Depth, CBitmap, GetDIBits

PLC Programming, Read data from PLC, Write Data to PLC, PLC Communication

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

Visual C++ Codes: BITMAPINFO, GetDIBits, BITMAPINFOHEADER, PBITMAPINFO, RGBQUAD, DIB_RGB_COLORS

MFC Example Multiple monitor support with GetSystemMetrics EnumDisplayMonitors and GetMonitorInfo

.NET Article: Draw 2d and 3d text with GDI+, and Draw Shadow text and  Emboss text with Visual C++ Source Codes

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

Indusoft - like HMI Software, SCADA System, OPC, Web Studio, Web SCADA, VC++ Source Code 2023

Context menu with OnInitMenuPopup and TrackPopupMenu and IsClipboardFormatAvailable Visual ++

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

MFC Example: Merge Menu with CreatePopupMenu and GetMenuItemCount GetSubMenu and AppendMenu and InsertMenu

VC++ MFC Ruler Control with Source Code, AfxGetResourceHandle, LoadStandardCursor and RegisterWindowClass

OpenGL 3D Graph ActiveX Control

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

MFC Extension DLL with AFX_EXT_CLASS

VC++ Example: Draw or fill Gradient

Real Time Graph Control, Plot ActiveX Control with Visual C++

ETAP Electrical Power Simulation Solution -- Full VC++ Source Codes

Real Time Wave Sine Square Triangle Signal Generator with C# Source Code

Draw Vertial gradient, Horizontal Gradient and Draw Diagonal gradient with VC++

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

CAD 2D Draw - Geometry Library with VC++ Source Codes

VC++ Converting ANSI to Unicode with _MSC_VER, MBCS, Multiple Byte

Globals in MFC Class Framework, CWinApp

Data Preprocessing And Visualization In C++

VC++ Example: Rotate a bitmap DIB image File

Multiple Monitor Support with GetSystemMetrics and AfxRegisterWndClass VC++ Example

MFC Source Code: File dialog with image preview WM_QUERYNEWPALETTE and WM_PALETTECHANGED

MS Chart Control with VC++

EC61131 PLC Automation Programming and Simulation Visualization Source Code Kit for C/C++,  .NET

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

Free Graphics and Free Meter, Free Dials with C/C++ Source Code, ActiveX Control, .NET

C++ Barcode source codes with draw Code39 Code93 AND Code128A  Code128B with Code128C

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

Video Capture with Visual C++

Generate and Write Word Reports Documents with .NET C++ Source Code

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

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

OpenGL printing and Print Preview with Visual C++

Drawing Graphics with DirectDraw, Double Buffer Drawing with MFC

VC++ Example: CString Extension, Get Window Directory

Download Visual Assist

OPC Software and OPC Server Component for C/C++, c#

HMI & SCADA Designer and ProgressBar

Draw Real - time data bar chart control MFC Source Codes

Free Codes with BITMAPINFO BITMAPINFOHEADER and CreateDIBSection

Data Visualization Component, Data Visaulization VC++Source Code Control with Process Simulation Software

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

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

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

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

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

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

VC++ MFC Example: Add bitmap into CImageList

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

3D font OpenGL ActiveX Control with Visual C++ Source Code

Create HTML Help and HTML help workshop with HtmlHelp VC++ MFC Example

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

Printing ActiveX Controls, C++ Source Code

Serial Port Communication, Read data from port Visual C++ Samples

GDI+ Example:  Draw Curve ActiveX Control GraphicsPath and Graphics

DPtoLP and LPtoDP, CPrintInfo and GetDeviceName and DOCINFO with StartPage and EndPage, VC++ Printing

MFC Example: Export dialogs in MFC Extension DLLs

2D CAD  Draw Application with C# Source Code

WinCE MFC TCP SOCKET AND UDP SOCKET Sample Codes

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

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

.NET HMI Control Solution.

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

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

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

Call JavaScript from Visual C++ and MFC, Article and Example

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

AfxGetStaticModuleState and LoadLibrary of GetProcAddress and FreeLibrary MFC ARTICLE with LOAD DLL

Real time software and HMI Software with Trend Chart VC++ Source Code

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

CTucancode.netDialog in MFC in Visual C++ 2010

SCADA Automation Programming Tool And visualization component Control VC++ Source Code Solution

AutoCAD File Format, Read and Write drawing with Visual C++ Source Code

MFC Source Code: WindowFromPoint and GetDlgItem or ScreenToClient

VC++ Article: PARSE AND write XML file with Microsoft MSXML 4 of C++ Wrapper

VC++ Example: Load or Save Dib Bitmap File, GetScrollPosition and FillRgn or CombineRgn and Create Cursor

Create Multiple Language to MFC Extension DLL Toolkit with Resource only

OPC Client, OPC Server and OPC Component in C++ Source Code

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

VC++ Example: Sort CObList class

UML Case Diagram, UML Sequence Diagram, VC + +/.NET visualization component library source code

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

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

Read DXF File, Write DXF File, Draw DXF File and autocad with source codes

MSBuild VCBuild VBBuild Features for Visual C++ Project

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

VC++ MFC Tutorial: WM_INITMENUPOPUP,WM_INITMENUPOPUP,WM_INITMENUPOPUP, menu in dialog

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

Draw Curve Line with VC++/MFC visualization Control

CXImage Library, PNG, Show, Pocket PC with VC++ Sample

3D Plot - Chart Graph ActiveX Control with OpenGL

HMI and SCADA LED Control

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

VC++ Sample: Quick Sort for CStringArray

HMI Led Contrl and Meter Control for C#

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

Add Skin to your Visual C++ MFC application, download source codes

Real-time Chart, VC++ Source Code with SImulation Software

MFC Sample Code: TrackMouseEvent and GetCapture or SetCapture and ReleaseCapture and GetCursorPos

MFC Tutorial: Sort CObArray class

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

Create COM Object, Build COM Component, ATL Component with Visual C++

VC++ Article: CTreeCtrl and GetRootItem, GetItemRect and GetNextItem with Printing Tree View and CreateBitmap

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

VC++ GDI Example: GDI AlphaBlend  and Bitmap Alpha

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

VC++ MFC Example:  CTreeCtrl, Create Tree Control

VC++ Article Draw Rotate / slant text strings SetWorldTransform

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

Tooltips CToolBar EnableToolTips and CBRS_ALIGN_ANY | CBRS_TOOLTIPS | CBRS_FLYBY with_countof

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

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

MFC Example: CListBox with Image Item, CCheckListBox

Direct2D & DirectWrite, Draw and Rendering text C++ Source Code

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

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

WPF 3D Article, Tutorial with Chart Graphics C# Code

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

VC++ Example: Return or Esc Key with EndDialog and OnSysCommand

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

Printing Preview toolbar, MFC Example

PID process control, Process Simulation, PLC Real Time, VC++ Source Code

VC++ Example: Read font from file name, TTF Font name CFile and Open

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

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

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

Factory Pattern in C++

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

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

Graphics Library for WinCE, Draw Bitmap, Draw Gif, Draw Jpg with Win CE, Visual C++ Codes

VC++ Control: Spell Checker Control Source Code

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

VC++ MFC Tutorial: Undo Redo Source Code

.NET HMI & SCADA Solution.

Visual C++ MFC Programming: Skin CListCtrl with InsertColumn SetItemText and ListView_SetExtendedListViewStyle

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

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

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

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

Database Programming with C/C++, with mySQL

VC++ Tutorial /Database Print

VC++ Tips: LOGBRUSH and PS_DOT and PS_SOLID and PS_COSMETIC and PS-ALTERNATE

VC++ MFC Example: Extend draw text with ExtTextOut

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

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

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

MFC Article: Keep an Window Always on Top with WS_EX_TOPMOST and OnWindowPosChanged

call VC++ / C++ and MFC DLL function with VB Program

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

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

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

VC++ Tips: Auto-complete edit control

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

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

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

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

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

Customized Printing Dialog using PrintDlg

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

ADO MFC Visual C++ ODBC OLE DB Codes

MFC Tutorial: MFC Printing

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

VC++ MFC Tutorial: Extend CStringArray and CString

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

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

Runtime class information using CRuntimeClass in MFC

MFC Article: Create toolbar with SetButtons and SetButtonInfo and OnNotify

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

Unicode Programming in MFC

GDI+ Examples: Drawing Column Chart

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

Open Souce VC++ Code  and MFC Code Site, VC++ FAQ Site and Tutorial Site

Full Screen with CWnd and Diagram Like Microsoft Visio 2007

C/C++ Drawing BarCode Tutorials

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

CEdit-derived Hyper link control, so user can edit hyper links

VC++ MFC Tutorial: ActiveX Control Example

GDI Example: Transparent Bitmap - True Mucancode.net Method

GDI+ Example: Using GDI+ Brushes to Draw Text

Windows hook programming with VirtualProtect,SetWindowHookEx and beginthread

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

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

MFC Example: Print Preview in MFC - Dialog

Introduction to GDI+ in .NET

GDI+ Font, Brush and Bitmap

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

GDI+ GraphicsPath and LinearGradientBrush

GDI+ Printing.

GDI+ and DrawArc and DrawPath

GDI+ Color and ARGB with Example

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

MFC Example Retrieve color from desktop with CreateDC and GetCursorPos, GetPixel

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

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

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

Draw, Print and encode UPCA barcode and UPCE barcode, and EAN13 barcode with VC++ Codes

MFC Examples: MFC Solution to Explanding the CFileDialog Common Dialog

MFC GDI Tutorials: GDI Printing, GDI+ Printing

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

ActiveX Control Tutorial, COleControl

DXF File, Read and Draw, Import and View .NET and C++ Source Code

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

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

Visual c++ character sets, Unicode, _MBCS

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

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

MFC Programming: MFC Tab Control, CTabCtrl

Visual C++ Example: Multiple CRectTracker Drawing

Visual C++ Example: Transparent MFC CSliderCtrl Source Code

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

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

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

Visual C++ CComboBox: Auto-complete ComboBox

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 Multiple Page Print preview Article and CPrintPreviewState, it with CPrintPreview and DoPrintPreview, LPDEVMODE and GetPrinterDeviceDefaults

MFC GUI Framework: inside Atl & dll server

Visual C++ Example: MFC XML Serialize

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

VC++ MFC Example: A Slider Control, CSliderCtrl

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

CDC Examples: Drawing vertical text

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

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

MFC CListCtrl: Print the contents of the list control

MFC SetTimer: WM_TIMER with VC++ Sample Source Code

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

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

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

Visual C++ Article: free image library with image viewer with CxImage and CListCtrl thumbnail images

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

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

MFC VC++ Topics: Print a bitmap full page

VC++ Example: Com Programming

CAM simulator Sample with VC++ MFC Source Code

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

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+

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

VC++ MFC Example: The CPageSetupDialog Class

VC++ MFC Tutorial: The CPrintDialog Class

VC++ Sample Code: CFindReplaceDialog, CFrameWnd

Drawing Tutorial for Visual C++ 2005

C# Tutorial:  A gauge control with all source code, .net 2.0

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

VC++ FAQ:  RegisterWindowMessage, WM_USER, ON_NOTIFY 

VC++ Articles: Create Thread, CWinThread, AfxBeginThread

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

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

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

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

MFC Sample Code: CList Iterator

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


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

VC++ Codes: bitmap and bmWidth with bmHeight, biBitCount

VC++ Codes: BeginPaint and EndPaint, CPaintDC, CClientDC, GetDC and ReleaseDC

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;
pReturn->AddRef();
pReturn->Create(rc,_T(""));
pReturn->UpdatePosition();

rc.OffsetRect(CPoint(10,10));
GetCurrentModel()->GetShapes()->AddTail(pReturn); 
m_listUpdate.AddTail(pReturn);
pReturn->Release();
}

UpdateShapes(&m_listUpdate);

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_INCHES, //0
// FUNIT_FEET, //1
// FUNIT_MM, //2
// FUNIT_CM, //3
// FUNIT_METERS, //4
// FUNIT_KM, //5
// FUNIT_YARDS, //6
// FUNIT_MILES, //7
// FUNIT_POINTS, //8
// FUNIT_TWIPS //9
// };
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;
pReturn->AddRef();
pReturn->Create(rc,"");
pReturn->LoadFromResource(IDR_COMPSRES2);

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

pShape->UpdatePosition();
CRect rcPos = pShape->GetSnapRect();
if(bFirst)
{
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->PositionShape(rcNew);

GetCurrentModel()->InsertShape(pReturn);
pReturn->Release();
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;
pReturn->AddRef();
pReturn->Create(rc,_T(""));
pReturn->LoadImage("C:\\Temp\\test.wmf");
pReturn->SetObjectCaption(GetCurrentModel()->GetUniqueCaption(pReturn->GetType()));
pReturn->SetObjectName(GetCurrentModel()->GetUniqueName(pReturn->GetType()));
GetCurrentModel()->InsertShape(pReturn);
pReturn->Release();

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->AddRef();
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 }");
GetCurrentModel()->InsertShape(pReturn);
pReturn->Release();
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);
pRect->AddRef();
pRect->Create(rcPos);
GetCurrentModel()->GetBackDrawComp()->AddShape(pRect);
pRect->SetBkColor(RGB(255,0,0));
pRect->Release();

Invalidate();

How to add a line shape to the canvas?

R. Call the following codes:

CArray<CPoint,CPoint> ptArray;
ptArray.Add(CPoint(20,20));
ptArray.Add(CPoint(120,90));
ptArray.Add(CPoint(200,40));

CFOLineShape *pReturn = new CFOLineShape;
pReturn->AddRef();
pReturn->Create(&ptArray);
CString strCaption = GetCurrentModel()->GetUniqueCaption(pReturn->GetType());
CString strName = GetCurrentModel()->GetUniqueName(pReturn->GetType());
pReturn->SetObjectCaption(strCaption);
pReturn->SetObjectName(strName);
GetCurrentModel()->InsertShape(pReturn);
pReturn->Release();

InvalidateShape(pReturn);

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_INCHES, //0
// FUNIT_FEET, //1
// FUNIT_MM, //2
// FUNIT_CM, //3
// FUNIT_METERS, //4
// FUNIT_KM, //5
// FUNIT_YARDS, //6
// FUNIT_MILES, //7
// FUNIT_POINTS, //8
// FUNIT_TWIPS //9
// };
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();

pMat->Move(-dStartX,-dStartY);
pMat->Rotate(nAngle);
pMat->Move(dStartX,dStartY);

CPoint ptx;
for (int j=0; j<nPtCount; j++)
{
ptx = cCtlPt[j];
pMat->ChangeValue(ptx);
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:

SetPolyObject(FALSE);

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,
FOPArc,
FOPSquare,
FOPSides2,
FOPSides3,
FOPSides4,
FOPSides5,
FOPSides6,
FOPSides7
};

How do I filter characters in a CEdit?

R. Create a CEdit derivative (CMyEdit) and create an OnChar() message map entry.


   // Assume that CMyEdit is derived from the CEdit class.

   afx_msg void CMyEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
   {
      if (nChar == 'a' || nChar == 'A')
      {
          nChar = 'X';
      }
      DefWindowProc(WM_CHAR, nChar, MAKELONG(nRepCnt, nFlags));
   }

How to create a tru dot pen?

R. by call the codes as below:

LOGBRUSH LogBrush;

LogBrush.lbColor = c_colorGridLine;

LogBrush.lbStyle = PS_SOLID;

penDotted.CreatePen( PS_COSMETIC | PS_ALTERNATE , 1, &LogBrush, 0, NULL );

How to draw text on bitmap?

R. The first order of business was to load a bitmap image into the a Device Context (DC) that is compatible with the display DC. This was done using:

HBITMAP hBitmap = (HBITMAP) LoadImage(0, 
  _T("somefile.bmp"), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
if (NULL != hBitmap)
{
    CBitmap Bitmap;
    Bitmap.Attach(hBitmap);

    CDC dcCompatible;
    dcCompatible.CreateCompatibleDC(pDC);

    CBitmap *pOldBitmap = dcCompatible.SelectObject(&Bitmap);
}

At this point, a temporary DC exists and contains the loaded bitmap. The next step is to render some text on that same DC. This was done using:

dcCompatible.TextOut(x, y, _T("Some text here"));

We now have text on top of a bitmap. To render the result to the display, we need to copy the contents of the temporary DC to the display DC. This was done using:

pDC->BitBlt(0, 0, width, height, &dcCompatible, 0, 0, SRCCOPY);

That's all there is to it! I did do some other things, but they were more for the sample project as opposed to the context of this article. Things like Print Preview, handling Desktops that do not have a wallpaper defined, and querying the network and workstation for useful information.

News:

1 UCanCode Advance E-XD++ CAD Drawing and Printing Solution Source Code Solution for C/C++, .NET V2023 is released!

2 UCanCode Advance E-XD++ HMI & SCADA Source Code Solution for C/C++, .NET V2023 is released!

3 UCanCode Advance E-XD++ GIS SVG Drawing and Printing Solution Source Code Solution for C/C++, .NET V2023 is released!

 


Contact UCanCode Software

To buy the source code or learn more about with:

 

 

Copyright ?1998-2023 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 webmaster@UCanCode.net