Using Dialog Box:
I want to draw a ball in a solid color and be able to move the ball around on the Dialog Box.
Thanks
There's different ways to do this. How do you want to do it? You can do it quickly with dialog wizards or code it from scratch. This sounds like a class assignment. You have to be more specific.
Using Dialog Box:
I want to draw a ball in a solid color and be able to move the ball around on the Dialog Box.
Simplest way I can think of would be to set up a timer and update the coordinates of the ball in it. Call InvalidateRect and UpdateWindow to force an update of the screen.
Override the OnPaint message handler for your dialog. Draw your ball in there using the device context pointer provided.
I think what it seems to me that he wants is to associate the moving object (the ball) with a keyboard or mouse control.
I've coded a simple program that lets the user control the position of a ball via the arrow keys.
[img]http://www.abdn.ac.uk/~u02cll2/windowsapi/movingball.jpg[/img]
The program can be downloaded here.
The source code can be viewed in HTML format here.
You got too much time on your hands. ;)
Nah, it was good practice. :D
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.