Is there any way that this could be adapted to make circular buttons? There are ellipse functions in Tic's Gdip library so I'm guessing it may be possible, but adding it to your class is way over my head. Thanks in advance for the help you may be able to provide.
You should be able to take the code for FillRectangle and modify it to use a DllCall for Ellipse instead of for Rectangle. It looks like it takes all the same parameters as Rectangle, so it should be as simple as copying that class method and changing the name Rectangle to Ellipse. I'd probably also remove that 1x1 pixel check, since it doesn't really apply to an ellipse in the same way it might a rectangle.
Thanks a lot for the quick reply and for the info, much appreciated.
I'm willing to work on it but this is quite new to me. So before I invest some time into this, maybe I should ask if you think it would be possible to reach my objective. What I am trying to do is to have individual floating circle buttons that react as you showed in your test script. So I would make the Gui background transparent in order to only see the circle buttons (and have some free space between the buttons). If I can come up with the Ellipse code, I'm not sure what to expect: since the Fill functions seem to act by changing the color of the progress control, would I be stuck with the corner of the rectangular progress control sticking out of the ellipse shape?
It was necessary to use 0x000000 for Transcolor (and for the Gui background color) because the corners of the progress control that are outside of the ellipse are black. Is there any way to control the color of these corners outside of the ellipse?
2) As you can see, the edges of the circle and of the text are a bit jagged. In Tic's Gdip library, it's possible to adjust the antialiasing using the Quality functions. Would it be possible to do the same here? I have no clue how I could include this function in your code.
Default()
{
global LasthWnd
global hwnd
if (hWnd == MyButton.hWnd)
this.Draw("Hover1", 0x000000, 0x00000F)
Else if (hWnd == MyButton2.hWnd)
this.Draw("Hover2", 0x000000, 0x00000F)
}
But I'm running in some issues when I combine this with the function to reset the buttons when the cursor leaves the buttons. When the cursor leaves the the buttons, I use the following to reset the buttons:
If you hover on and off over button 1 (or button 2), the text is updated correctly. But if you hover over button 1, then go over button 2, the first time you hover over button 2 the hover text is not updated correctly. Can you see where the mistake is?
Thanks a lot for all your help. This is really challenging for me as I'm not used to working with functions and classes (so for example, I'm not really sure the WM_NCMOUSELEAVE and CheckIfMouseIsOutsideGui are deployed correctly) but I'm learning a whole lot. So thanks in advance for any support you may be able to offer.
I'm running into some issues with multiple buttons too...
It seems they get switched around for some reason. Can't pinpoint why yet.
There seems to be some HWND weirdness going on.
Could you provide an example of using more than one button Geekdude? Thanks.
Like this it seems kinda confusing to get things right. (I usually don't work with HWNDS to get things done)
Sorry for the late replies. Here's some code with multiple round buttons. I took advantage of some newer AHK features that let me handle the messages for each button individually instead of having a single message handler that handles all the buttons. Also, I fixed WM_MOUSELEAVE (had to do some research for this one, and modified it to be both 32 and 64 bit compatible). See the original post for the updated GDI.ahk with FillEllipse.
As for making things smoother/less pixelated, it's not really possible. My class strictly uses GDI (not plus) functions, which don't have such features. That kind of functionality is only present in GDI+. If you want good transparency and aliasing (smoothing), you'll need to use either tic's gdip or his gdip2 beta (also class based). https://github.com/tariqporter/Gdip/blo ... /Gdip2.ahk
Sorry for the late reply as I just got back into this. Thanks a lot for modifying the GDI.ahk and for modifying my script. I really appreciate it. I'll look into what you wrote and will write back here if I encounter any issues. Thanks a lot!