Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Does any body knows how can a make a custom shape button
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00453018
Message ID:
00454781
Vues:
42
>>>*snip*
>>>>Just a follow up here. I've used an MS Forms 2.0 command button, gotten its window handle, used CreateEllipticRgn() and then SetWindowRgn() to create an elliptical button. Doesn't look much like a command button. In fact, in order to make the thing visible, I had to change the back color. Just looks like an ellipse on the form.
>>>
>>>To clarify in my mind, there was no 3-D outline like we expect with a button. It just looked like a flat elliptical shape?
>>
>>Yep. If you're interested, I'll post some code to emulate it.
>
>If you've got it handy, sure. I'd like to play with it.

Here ya go
LOCAL lnhwnd, lnbtnhwnd, lcclass, lnresult
DECLARE INTEGER FindWindowEx IN Win32API;
  INTEGER hWnd, integer hWnd2, STRING @lpclass, String @lnpname
DECLARE INTEGER SetWindowRgn in Win32API;
  INTEGER hwnd, INTEGER hrgn, INTEGER redraw
DECLARE INTEGER CreateEllipticRgn in Win32API;
  INTEGER lnleft, INTEGER lntop, INTEGER lnright, INTEGER lnbottom
* Give it a red background
ThisForm.Olecontrol1.Backcolor = 255
lnhwnd = _WhTohWnd(_WFindTitl(This.Caption))
lcclass = "F3 Server 60000000"
lnbtnhwnd = FindWindowEx(lnhwnd, 0, @lcclass, 0)
lnresult = CreateEllipticRgn(1, 1, This.Olecontrol1.Width / 2, This.Olecontrol1.Height / 2)
= SetWindowRgn(lnbtnhwnd, lnresult, 1)
This is from the form's Init method. Just be sure that Foxtools is loaded if you're using 5.0/6.0. If using 7.0 use the hWnd property of the form. Just drop a Microsoft Forms 2.0 command button on it, and you should be good to go.
George

Ubi caritas et amor, deus ibi est
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform