Page 1 of 2

Dialogo con esquinas redondas

PostPosted: Tue May 03, 2011 5:40 pm
by softruz
Muy buenas foro, estoy siempre intentando hacer un dialgo con una imagen de fondo, cuyas esquinas están redondeadas, entonces quiero que se vea la imagen como si fuera el dialogo.

¿Me podeis decir como hacer esto?

Un Saludo.

Re: Dialogo con esquinas redondas

PostPosted: Wed May 04, 2011 12:33 am
by Bayron

Re: Dialogo con esquinas redondas

PostPosted: Wed May 04, 2011 3:56 am
by nageswaragunupudi
Code: Select all  Expand view
#include "FiveWin.ch"

function Main()

   local oDlg, oBrush, oFont
   local nVar  := 100

   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" ;
      BRUSH oBrush FONT oFont TRANSPARENT

   @ 10,10 SAY "This is some Text" SIZE 80,12 PIXEL OF oDlg ;
      COLOR CLR_WHITE,CLR_BLACK TRANSPARENT

   @ 30,10 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

   RELEASE BRUSH oBrush
   RELEASE FONT  oFont

return nil
 


Result:
Image

Re: Dialogo con esquinas redondas

PostPosted: Wed May 04, 2011 6:05 am
by nageswaragunupudi
Image only with round corners, without title and sysmenu.
Code: Select all  Expand view
#include "FiveWin.ch"

function Main()

   local oDlg, oBrush, oFont
   local nVar  := 100

   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

   @ 10,10 SAY "This is some Text" SIZE 80,12 PIXEL OF oDlg ;
      COLOR CLR_WHITE,CLR_BLACK TRANSPARENT

   @ 30,10 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 RoundCorners( oDlg )

   local aRect, hRgn

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

return nil
 


Result
Image

These two samples are simpler and easier to use.

Re: Dialogo con esquinas redondas

PostPosted: Wed May 04, 2011 7:23 am
by Carles
N,

Nice example -> Thanks !!! :D

Re: Dialogo con esquinas redondas

PostPosted: Wed May 04, 2011 5:42 pm
by cuatecatl82
Saludos a Todos:

Se ve interesante, la curiosidad me mato y quise probarlo pero me faltaban 2 funciones CreateRoundRectRgn() que ya encontre, pero me falta esta otra SetWindowRgn(), :oops: :oops: Si fuera posible publicar el codigo de ésta funcion se los agradeceria.

Gracias... :wink:

Re: Dialogo con esquinas redondas

PostPosted: Wed May 04, 2011 5:57 pm
by Daniel Garcia-Gil
Saludos

Code: Select all  Expand view
#pragma BEGINDUMP

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

#pragma ENDDUMP

Re: Dialogo con esquinas redondas

PostPosted: Wed May 04, 2011 6:17 pm
by cuatecatl82
Hola Daniel:

Gracias por responder pronto a mi solicitud, pero creo que estoy bastante desactualizado, Compila sin problemas pero al lanzar el EXE me lanza un MsgStop de error con el Titulo:

Unrecoverable error 9009.

Ni modos.. no pude probarlo..

Gracias de todas maneras.. :roll: :oops:

Re: Dialogo con esquinas redondas

PostPosted: Sat May 07, 2011 6:15 pm
by ronaldo
es pssivel, haga clic en la imagen y arrastre la pantalla

Re: Dialogo con esquinas redondas

PostPosted: Fri May 13, 2011 10:24 am
by Baxajaun
Hi nageswaragunupudi, Daniel,

compiling the sample:

┌────────────────────────────────────────────────────────────────────────────┐
│ FiveWin for Harbour 11.03 - Mar. 2011 Harbour development power │▄
│ (c) FiveTech, 1993-2011 for Microsoft Windows 9X/NT/200X/ME/XP/Vista/7 │█
└────────────────────────────────────────────────────────────────────────────┘█
  ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
Compiling...
Harbour 2.1.0beta1 (Rev. 14559)
Copyright (c) 1999-2010, http://www.harbour-project.org/
Compiling 'prueba.prg' and generating preprocessed output to 'prueba.ppo'...
Lines 3837, Functions/Procedures 2
Generating C source output to 'prueba.c'... Done.
Embarcadero C++ 6.30 for Win32 Copyright (c) 1993-2010 Embarcadero Technologies,
Inc.
prueba.c:
Error E2451 prueba.prg 47: Undefined symbol 'HWND' in function HB_FUN_SETWINDOWR
GN
Error E2121 prueba.prg 47: Function call missing ) in function HB_FUN_SETWINDOWR
GN
*** 2 errors in Compile ***
* Linking errors *

Thanks a lot !!!

Best regards,

Felix

Re: Dialogo con esquinas redondas

PostPosted: Fri May 13, 2011 10:36 am
by Daniel Garcia-Gil
Hello

in your C code, do you have
#include <windows.h> ??

Re: Dialogo con esquinas redondas

PostPosted: Fri May 13, 2011 10:55 am
by Baxajaun
Daniel,

sólo he utilizado el ejemplo que está publicado en el post:

Code: Select all  Expand view

#include "FiveWin.ch"

function Main()

   local oDlg, oBrush, oFont
   local nVar  := 100

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE BRUSH oBrush FILENAME "Anboto.bmp"

   DEFINE DIALOG oDlg SIZE 300,400 PIXEL ;
      TITLE "Image Dialog" ;
      STYLE WS_POPUP ;
      BRUSH oBrush FONT oFont TRANSPARENT

   @ 10,10 SAY "This is some Text" SIZE 80,12 PIXEL OF oDlg ;
      COLOR CLR_WHITE,CLR_BLACK TRANSPARENT

   @ 30,10 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 RoundCorners( oDlg )

   local aRect, hWnd, hRgn

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

return nil

#pragma BEGINDUMP

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

#pragma ENDDUMP
 


Muchas gracias.

Saludos,

Re: Dialogo con esquinas redondas

PostPosted: Fri May 13, 2011 11:15 am
by Carles
B,

Añade los includes...

Code: Select all  Expand view
#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

Re: Dialogo con esquinas redondas

PostPosted: Fri May 13, 2011 11:21 am
by Baxajaun
Carles,

moltes gracies !!!

Code: Select all  Expand view

┌────────────────────────────────────────────────────────────────────────────┐
│ FiveWin for Harbour 11.03 - Mar. 2011           Harbour development power  │▄
(c) FiveTech, 1993-2011     for Microsoft Windows 9X/NT/200X/ME/XP/Vista/7 │█
└────────────────────────────────────────────────────────────────────────────┘█
  ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
Compiling...
Harbour 2.1.0beta1 (Rev. 14559)
Copyright (c) 1999-2010, http://www.harbour-project.org/
Compiling 'prueba.prg' and generating preprocessed output to 'prueba.ppo'...
Lines 3839, Functions/Procedures 2
Generating C source output to 'prueba.c'... Done.
Embarcadero C++ 6.30 for Win32 Copyright (c) 1993-2010 Embarcadero Technologies,
 Inc.
prueba.c:
Warning W8065 prueba.prg 49: Call to function 'hb_parnl' with no prototype in fu
nction HB_FUN_SETWINDOWRGN
Warning W8065 prueba.prg 49: Call to function 'hb_parnl' with no prototype in fu
nction HB_FUN_SETWINDOWRGN
Warning W8065 prueba.prg 49: Call to function 'hb_retnl' with no prototype in fu
nction HB_FUN_SETWINDOWRGN
Turbo Incremental Link 6.10 Copyright (c) 1997-2010 Embarcadero Technologies, In
c.
* Application successfully built *
 


Saludos,

Re: Dialogo con esquinas redondas

PostPosted: Fri May 13, 2011 11:22 am
by Baxajaun
Carles,

el resultado anterior sin

Code: Select all  Expand view

#include <ClipApi.h>
 


Saludos,