Solved

Graphics and dynamic control creation

Posted on 2002-05-23
3
338 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
mixString challenge 36 137
Installing Microsoft R server on REDHAT or SUSE Linux 4 162
java ^ examples 8 74
Adjust the codes 3 63
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Suggested Courses

732 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