Solved

Graphics and dynamic control creation

Posted on 2002-05-23
3
332 Views
Last Modified: 2013-11-20
I have two questions

1)I usually get involved with developing graphics application (not games) such as one can create 2D or 3D chart based on a set of given data points. My application should be able to run on Windows 9x/NT/2000/XP
Which one should I use ?
a)Windows GDI
b)Directr X
c)OpenGL

I heard that OpenGL can do games and graphics but can MFC
do the same without using any graphic library ?

2)Second, can MFC create dynamic Windows control on the fly (at run-time) in an MFC application just like Visual Basic does ? If it can, how is it done ?

I'd appreciate any links/sources or technical documents that can answer my two questions ?
0
Comment
Question by:kevinnguyen
  • 2
3 Comments
 
LVL 8

Expert Comment

by:fl0yd
ID: 7030858
1) You certainly cannot do with windows GDI what OpenGL/DirectX can. But for simple drawing GDI-functions are sufficient. OpenGL/DX do ask you to do a LOT of initialization and uninitilization.
2) If I recall correct you can accomplish this:
CButton* pB = new CButton;
pB->Create( lpszCaption, dwStyle, rect, pParentWnd, nID );
Don't forget to
delete pB;
if you don't need the button any more.
0
 
LVL 1

Author Comment

by:kevinnguyen
ID: 7030878
How can I add the newly created button to "MyDialog" dialog at a desired location ? What function do I call and what are the parameters ?
0
 
LVL 8

Accepted Solution

by:
fl0yd earned 87 total points
ID: 7031621
When creating the button with
pB->Create( lpszCaption, dwStyle, rect, pParentWnd, nID );
rect will hold the position of the control. Use
RECT rect = { 0 };
and initialize the values for 'left', 'top', 'right', and 'bottom' to the desired values. For pParendWnd pass
static_cast<CWnd*>( &MyDialog );
If you need to reposition the button later, you can call SetWindowPos with the appropriate values.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now