custom dialog shapes

This is a discussion on custom dialog shapes within the Windows Programming forums, part of the Platform Specific Boards category; Is it possible to have custom dialog shapes such as a circle or a triangle?...

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    112

    custom dialog shapes

    Is it possible to have custom dialog shapes such as a circle or a triangle?

  2. #2
    Used Registerer jdinger's Avatar
    Join Date
    Feb 2002
    Posts
    1,065
    Your best bet would be to use a bitmap that represents the states of your button and blit it. Then when you get a WM_LBUTTONDOWN message check PtInRect (or a series of depending on how complicated your shape is) to see if the mouse was inside your custom shape.

  3. #3
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    You can use Regions to change the shape of any window. For example:

    Code:
    RECT rc;
    GetClientRect(hwnd,&rc);
    HRGN hrgn=CreateEllipticRgnIndirect(&rc);
    HDC hdc=GetDC(hwnd);
    SetWindowRgn(hwnd,hrgn,0);
    ReleaseDC(hwnd,hdc);
    DeleteObject(hrgn);
    Shove that chunklet into your WM_CREATE or WM_INITDIALOG and your window or dialog will be round (based on window/dialog dimensions). All Hit-testing for that wnd/dlg will occur only for that region.
    Last edited by Ken Fitlike; 05-09-2002 at 01:07 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 02-13-2008, 01:59 PM
  2. Replies: 2
    Last Post: 05-29-2005, 10:06 AM
  3. make Child Dialog not Popup?
    By Zeusbwr in forum Windows Programming
    Replies: 5
    Last Post: 04-08-2005, 02:42 PM
  4. Getting the position of a dialog without parent on the screen
    By stormbringer in forum Windows Programming
    Replies: 1
    Last Post: 08-27-2003, 02:59 AM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM

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