Click here to Skip to main content
13,345,438 members (51,300 online)
Click here to Skip to main content
Add your own
alternative version


42 bookmarked
Posted 15 Sep 2001

CCurveDlg - Curve Interpolation

, 15 Sep 2001
Rate this:
Please Sign up or sign in to vote.
A Photoshop-like curve dialog.

Sample Image - CurveDlg.gif


Welcome to CCurveDlg, a Freeware MFC Curve Class

Its appearance is similar to the curves dialog as seen in the Adobe Photoshop. The classes are split up into a document/view architecture.

  • CCurveWnd, derived from CWnd, for the visual representation of the curve. This class takes care of drawing and user interaction.
  • CCurveObject, derived from CObject for the data representation of the curve. This class holds the curve data, and does all calculation calls, to perform the curve interpolation.

The actual calculation is done with the help of the XlXtrFun.dll. This is actually an Excel extension DLL or XLL, but I have written a wrapper class CCurveDllImpl for it, so it can easily be used in VC++. For more info regarding this DLL, check their website.


Adding a CCurveWnd is simple, just follow the next steps:

  1. Add the following files to your project workspace:
    • CurveWnd.h and CurveWnd.cpp
    • CurveObject.h, CurveObject.cpp and CurveObjectDef.h
    • CurveDllImpl.h and CurveDllImpl.cpp.
  2. Copy the XlXtrFun.dll to your project directory

    You should also ensure that the 3 cursors (namely, IDC_ARRBLCK, IDC_ARRWHITE and IDC_ARRBLCKCROSS) are copied over into your rc file and renamed properly.

  3. Add the following include statement to your project stdafx.h file
    #include "resource.h"
  4. Then add a CCurveWnd member to your own CDialog class:
    CCurveWnd m_cCurveWnd;

    In your CDialog::OnInitDialog(), you need to create the CurveWnd:

    CRect(25, 55, 235, 265), this, 2001, true);

    The Create method is defined as follows:

    BOOL Create(LPCTSTR lpszCurveName,   //Points to a null-terminated 
                                         //character string that 
                                         //contains the window name
                const RECT &rect,        // The size and position 
                                         //of the window, in client 
                                         //coordinates of pParentWnd
                CWnd* pWndParent,        // The parent window
                UINT nID,                // The ID of the child window
                BOOL CreateCurveObj)     // Set to true if the create 
                                         // function has to
                                         // create a curve object

Note: If you set CreateCurveObj = false and you don't create a curve object manually by calling CCurveWnd::CreateCurveObject(CString strCurve), the application may assert.

If you want the CurveWnd to draw a parabolic curve, you have to add the following code:

CCurveObject* pCurve = m_cCurveWnd.GetCurveObject();
pCurve->m_bParabolic = true;

The GetCurveObject method is defined as follows:

CCurveObject* GetCurveObject(); // Returns a pointer to the curveobject

Basically that will do the job.

API Functions

Full description of the API functions is not yet available, I haven't had the time to write it. But I will come up with the first update of the code, so until then just email me if u have problems and questions.


  • v1.0 (16 september 2001)

    CCurveDlg first released.

Planned Enhancements

If you have any suggested improvements, please let me know so that I can incorporate them into the next release.

Special Thanks


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Janssens Johan
Web Developer
Russian Federation Russian Federation
No Biography provided

You may also be interested in...

Comments and Discussions

Generalupgrade this article ... Pin
RedDK2-Jun-11 8:11
memberRedDK2-Jun-11 8:11 
GeneralI've ripped all of my hair out.. :( Pin
aquawicket24-May-07 11:38
memberaquawicket24-May-07 11:38 
QuestionHow to get output from input [modified] Pin
aquawicket22-May-07 9:24
memberaquawicket22-May-07 9:24 
AnswerRe: How to get output from input Pin
aquawicket22-May-07 13:19
memberaquawicket22-May-07 13:19 
I fixed it... This works great...
I changed double ptY; to unsigned int ptY;

CString temp;
unsigned int ptY = m_pCurveObj->GetCurveY(100);
temp.Format("%d", ptY);
QuestionVC++ Source Code to draw a parabola and find the location of co-ordinates and display them in a list box. Pin
avins12345621-Oct-06 8:25
memberavins12345621-Oct-06 8:25 
Questionhow to insert point(x,y) in your code Pin
DAR TO9-Jan-05 19:33
memberDAR TO9-Jan-05 19:33 
Generalthere is another way (to access the excel curve calculations) Pin
spare_me19-Jul-04 21:44
memberspare_me19-Jul-04 21:44 
GeneralDeveloping CCurveDllImpl Pin
Michael Robbins24-Oct-03 5:24
memberMichael Robbins24-Oct-03 5:24 
GeneralProgram only runs under WinNT/2000 Pin
Janssens Johan17-Sep-01 13:19
memberJanssens Johan17-Sep-01 13:19 
GeneralRe: Program only runs under WinNT/2000 Pin
Paolo Messina20-Sep-01 7:32
memberPaolo Messina20-Sep-01 7:32 
GeneralXlXtrFun.dll can't be loaded Pin
Matthias Mann17-Sep-01 7:37
memberMatthias Mann17-Sep-01 7:37 
GeneralRe: XlXtrFun.dll can't be loaded Pin
Janssens Johan17-Sep-01 11:47
memberJanssens Johan17-Sep-01 11:47 
GeneralTypo in link Pin
Ravi Bhavnani17-Sep-01 5:03
memberRavi Bhavnani17-Sep-01 5:03 
GeneralRe: Typo in link Pin
Janssens Johan17-Sep-01 12:07
memberJanssens Johan17-Sep-01 12:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.180111.1 | Last Updated 16 Sep 2001
Article Copyright 2001 by Janssens Johan
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid