tuape Posted July 14, 2004 Share Posted July 14, 2004 Hi, Maybe a simple question for you Win32 gurus: how can I create a transparent button in plain C? I have a dialog that has a background image. I want to add couple of buttons to that dialog which would not be seen but would still work as normal buttons. How can I do that? Better yet, if someone nows how to achieve this in AutoItGUI please let me know. Link to comment Share on other sites More sharing options...
CyberSlug Posted July 14, 2004 Share Posted July 14, 2004 (edited) Although it is best to avoid overlapping controls, you can use labels to simulate buttons. The example creates one "button" in the North-West corner of the background image and another one in the South-East corner. 1) Make sure to create all the labels before you create the background 2) Make sure to set the labels to notify when clicked 3) If you want to be able to cycle-through the psuedo-buttons with the tab key and press a psuedo-button, then you would need to code that your self using the HotKeySet function.... $background = "C:\WINDOWS\Prairie Wind.bmp" ;example image 256 x 256 Opt("GUINotifyMode", 1) GuiCreate("Example") $one = GuiSetControl("label", "", 20, 20, 50, 50) $two = GuiSetControl("label", "", 226, 226, 50, 50) GuiSetControl("pic", $background, 20, 20) GuiShow() While 1 $msg = GuiMsg(0) If $msg = -3 Then Exit If $msg = $one Then MsgBox(4096,"", "upper-left corner clicked") If $msg = $two Then MsgBox(4096,"", "lower-right corner clicked") WEnd Edited July 14, 2004 by CyberSlug Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
tuape Posted July 14, 2004 Author Share Posted July 14, 2004 Cool, just what I was after. Is this as simple with C (probably not!). I have a fully working application done with Win32 API but I can't make buttons 'invisible' and still working... I knew I should have done this project with AutoIt Link to comment Share on other sites More sharing options...
tuape Posted July 14, 2004 Author Share Posted July 14, 2004 I guess I could forget about buttons and draw rectangles to the background bitmap. Then I think I could use PtInRect to find out if user clicks somewhere inside rect area. Does this sound reasonable? I would appreciate any help / pointers to the right direction. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now