Jump to content
  • Advertisement
Sign in to follow this  

Custom Controls

This topic is 2223 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts


Recently I've started learning Direct2D. Now I wanted to start learning Direct2D to do a project which was not involving a game, but just a simple UI. So creating my own controls, this could become handy in the future and I think it's not as diffiuclt as a game.

Now my design of my control is like this:

struct MESSAGE_ID // so I can use 1 functions for the messages

struct DrawInfo // the draw structure, so I can draw the icon or something
dword bitmapID;
std::pair. ..

class Control

void SetSize(...)
void SetPos(...)

std::pair possition;
std::pair size;

void OnMessage(MESSAGE_ID id); // call user setted function trhougha void* pointer

class Button() : public Control


My idea is basically that a class holds all the info and returns a DrawInfo structure to the paiting class. And that a button for example is just a icon, which can change when someone clicked it or whatsoever. Is this the propper way of doing this?

Also, I draw my window in the WM_PAINT message and update it when a user does something or else in the WM_PAINT message to, is this also correct?



Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!