How to draw in c++

i need help.i would like to draw my own buttons.anyone plz.i am a beginner


  • What OS?
    What compiler?
  • op is Windows xp and my compiler is visual c++ 6
  • My op is windows xp and my compiler is visual c++ 6.
  • [color=Blue]
    If you just started Windows programming this will not be easy, but here goes:

    Create your buttons with Owner Drawn style and then respond to WM_DRAWITEM message in your window procedure for the PARENT window of your button. In the response to this message you must draw button states and focus.[/color]
  • There are several ways of achieving this.

    The most instructive is to declare you own "mybutton" class.

    Start by getting up a window and printing "Hello world" in it. Then get a subwindow into your main window and set the background colour, and draw in it.

    Now start your own mybutton.c file. It should contain code to register the window class, and the WndProc message handling function for your button. Every manipulation on the button is carried out through the WndProc, though you can add utlity fucntions to grey the button out, set the lable, etc if you wish. These are just wrappers to messages for the Wndproc.

    Your initial button just displays a text and calls the parent when it is left-clicked. Then you can start getting a bit more ambitious - 3D effects, make it chnage colour when the mouse cursor enters, and so on.
  • Thanx guys, it is difficult but am still trying
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!