Solved

Graphics and dynamic control creation

Posted on 2002-05-23
3
336 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Expand LInux Boot partition remotly 3 102
how to split multiple lines delimiter : 8 119
Problem to App source 6 92
Authenticate using sesu from script 7 111
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

749 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