Solved

Graphics and dynamic control creation

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Strange date stored 22 106
not able to insert into temp table 68 157
deburging in oracle form 12 88
Change owner from userA to server Local Administrators 7 59
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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 Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
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.

920 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

14 Experts available now in Live!

Get 1:1 Help Now