Dialogo con esquinas redondas

User avatar
Baxajaun
Posts: 853
Joined: Wed Oct 19, 2005 2:17 pm
Location: Gatika. Bizkaia

Re: Dialogo con esquinas redondas

Post by Baxajaun »

Buenas,

como dice Ronaldo se podría pulsar en la imagen y mover el diálogo ? Y que los bontones tuviesen los bordes redondeados ?

Muchas gracias.

Saludos,
Rochinha
Posts: 309
Joined: Sun Jan 08, 2006 10:09 pm
Location: Brasil - Sao Paulo
Contact:

Re: Dialogo con esquinas redondas

Post by Rochinha »

Friends,

With this change will move the window by clicking on the top corners.

Code: Select all

#include "FiveWin.ch"

function Main()

   local oDlg, oBrush, oFont
   local nVar  := 100
   
   public mover := .t.
   public nRounder := 20 // Change this value betwen 0 and 250 to see a results
   
   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE BRUSH oBrush FILENAME "\fwh\bitmaps\olga1.jpg"
   
   DEFINE DIALOG oDlg SIZE 300,400 PIXEL ;
          TITLE "Image Dialog" ; 
          STYLE WS_POPUP ;
          BRUSH oBrush FONT oFont TRANSPARENT
          
          @ 000,000 BITMAP resource "" NOBORDER OF oDlg PIXEL SIZE 80,21 ON LEFT CLICK Click(oDlg)
          
          @ 010,010 SAY "This is some Text" SIZE 80,12 PIXEL OF oDlg COLOR CLR_WHITE,CLR_BLACK TRANSPARENT
          @ 030,010 GET nVar PICTURE "999,999.99" SIZE 80,12 PIXEL OF oDlg RIGHT
          @ 180,100 BUTTON "Close" SIZE 40,14 PIXEL OF oDlg ACTION oDlg:End()
          
   ACTIVATE DIALOG oDlg CENTERED ON INIT RoundCorners( oDlg )
   
   RELEASE BRUSH oBrush
   RELEASE FONT  oFont
   
return nil

static function Click(yvent)

   If !mover
      return nil
   Endif
   
   Do while GetKeyState(VK_LBUTTON)
      nGCPos := GetCursorpos()
      MoveWindow( yvent:hWnd, nGCPos[1],nGCPos[2], yvent:nWidth,yvent:nHeight,.t. )
      Sysrefresh()
      If !GetKeyState(VK_LBUTTON)
         Exit
      Endif
   Enddo
   nGCPos := GetCursorpos()

return nil

static function RoundCorners( oDlg )

   local aRect, hRgn

   aRect       := GetClientRect( oDlg:hWnd )
   hRgn        := CreateRoundRectRgn( aRect, nRounder, nRounder )
   SetWindowRgn( oDlg:hWnd, hRgn )
   DeleteObject( hRgn )

return nil

#pragma BEGINDUMP

#include <Windows.h>
#include <ClipApi.h>


HB_FUNC( SETWINDOWRGN )
{
  hb_retnl( SetWindowRgn( ( HWND ) hb_parnl( 1 ), ( HRGN ) hb_parnl( 2 ), TRUE ) );
}

#pragma ENDDUMP
 
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Dialogo con esquinas redondas

Post by karinha »

Muy bueno, very good!
João Santos - São Paulo - Brasil
Post Reply