Thread: Custom-shaped controls

  1. #1
    Registered User
    Join Date
    Jan 2006
    Location
    Latvia
    Posts
    102

    Custom-shaped controls

    Hi, I want to create a control with a custom shape (not a rectangle) and use it as a button. I could just draw a bitmap with a mask, but it would still be rectangular technically and I wouldn't be able to find if the user has really clicked on the bitmap. What I actually want is to detect if the user has clicked on the control or on the background.

    Links to tutorials or any other resources will be greatly appreciated, thanks in advance.

  2. #2
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    I think you must use region clipping. There are lots of functions, though, both for Windows and GDI, I think, so I can't be any more helpful than since I don't know, sorry.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    Owner-draw button with a custom region.

    Check out CreatePolyPolygonRgn() and SetWindowRgn().

    A good tutorial on using regions: http://www.flipcode.com/archives/Win...Skinning.shtml
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  4. #4
    Just a Human Anuradh_a's Avatar
    Join Date
    Jan 2008
    Posts
    50
    hey
    try this. might help you . good luck.
    http://www.codeproject.com/KB/library/SkinCtrl.aspx

  5. #5
    Registered User
    Join Date
    Jan 2006
    Location
    Latvia
    Posts
    102
    Thanks, I will definitely check these links out.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. custom controls
    By eXistenZ in forum Windows Programming
    Replies: 5
    Last Post: 04-18-2005, 06:09 AM
  2. Creating Custom shaped windows
    By cfrost in forum C++ Programming
    Replies: 2
    Last Post: 07-10-2004, 04:10 AM
  3. Custom shaped windows
    By cfrost in forum C++ Programming
    Replies: 1
    Last Post: 07-10-2004, 02:04 AM
  4. Creating Custom Controls
    By Grayson_Peddie in forum C# Programming
    Replies: 1
    Last Post: 12-29-2003, 01:41 PM
  5. Custom Controls
    By Mithoric in forum Windows Programming
    Replies: 6
    Last Post: 12-21-2003, 10:09 PM