Round Button

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
AUGE_OHR
Posts: 2093
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Round Button

Post by AUGE_OHR »

hi,

under Xbase++ i can use API SetWindowRgn(() to make a round Button

Code: Select all

   hHwnd := oObj:GetHwnd()
   aTmp  := oObj:Currentsize()

   nLeftRect   := 0       +nFrame
   nTopRect    := aTmp[2] -nFrame
   nRightRect  := aTmp[1] -nFrame
   nBottomRect := 0       +nFrame

   // now construct a Region and call its API function
   //
   hRgn := CreateEllipticRgn(nLeftRect,nTopRect,nRightRect,nBottomRect)
   SetWindowRgn(hHwnd,hRgn,.t.)
now it try it under harbour but work only on Form, not on Control :o

Code: Select all

#pragma BEGINDUMP
#define WINVER 0x0501  // minimum requirements: Windows XP
#include <mgdefs.h>

HB_FUNC ( MAKEROUND )
{
   HWND hWnd = ( HWND ) hb_parnl( 1 );
   HRGN hrgn;
   if ( hb_parni(6)==0)
          SetWindowRgn(GetActiveWindow(),NULL,TRUE);
   else
     {
     if ( hb_parni(6)==1 )
        hrgn=CreateRectRgn(hb_parni(2),hb_parni(3),hb_parni(4),hb_parni(5));
     else
        hrgn=CreateEllipticRgn(hb_parni(2),hb_parni(3),hb_parni(4),hb_parni(5));
     SetWindowRgn(hWnd,hrgn,TRUE);
     // Should be hb_parnl(1) instead of GetActiveWindow()
     }
}
#pragma ENDDUMP
who can help me please
KREIS.ZIP
(2.44 KiB) Downloaded 152 times
have fun
Jimmy
Post Reply