Custom buttons

This is a discussion on Custom buttons within the Windows Programming forums, part of the Platform Specific Boards category; Is it possible to display customized buttons that perform as normal buttons? As an example: A standard "Ok" type button ...

  1. #1
    Registered User
    Join Date
    May 2005
    Posts
    207

    Custom buttons

    Is it possible to display customized buttons that perform as normal buttons?

    As an example:

    A standard "Ok" type button that looks like a stone brick (rough textured) instead of being smooth.

    I'm just checking feasibility right now...

    mw
    Blucast Corporation

  2. #2
    Registered User
    Join Date
    Mar 2005
    Location
    Juneda
    Posts
    287
    You can assign an image to the button control:

    Code:
    CreateWindowEx(0,"BUTTON","Text",WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON|BS_BITMAP,20,132,50,50,hwnd,(HMENU)identificator,hInstance,NULL);
    
    HBITMAP texture=(HBITMAP)LoadImage(hInstance,MAKEINTRESOURCE(resource_identificator),IMAGE_BITMAP,0,0,0);
    
    SendMessage((HWND)button_handler,(UINT)BM_SETIMAGE,(WPARAM)IMAGE_BITMAP,(LPARAM)texture);
    on the rc file you should add a 'resource_identificator BITMAP "valid_file.bmp"'
    Niara

  3. #3
    Registered User
    Join Date
    Oct 2005
    Posts
    9
    Adding an image would be the easiest way to make your button look the way you want. Another way would be to set an image on the application, designed with the exact look you want and then Code the MouseClick() event to work the same way as you would want the ButtonClick() to. It's more complicated and depending on your image and what language you might choose, you may have to check the mouse's current cooridinates to make sure that it is within the border you intend... to have someone click on a ball within a picture for example.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 04-09-2009, 03:31 AM
  2. Custom Allocation
    By SevenThunders in forum C Programming
    Replies: 17
    Last Post: 04-09-2007, 05:10 PM
  3. Custom Buttons in a MessageBox?
    By Queatrix in forum C++ Programming
    Replies: 2
    Last Post: 04-15-2005, 08:03 PM
  4. Replies: 1
    Last Post: 05-24-2002, 12:19 AM
  5. Grouping radio buttons
    By Bazz in forum Windows Programming
    Replies: 1
    Last Post: 08-28-2001, 08:15 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21