FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour help for Gdiplus Brush class
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM

help for Gdiplus Brush class

Posted: Wed Mar 22, 2023 12:03 PM
is it possible to draw with tGDIPlus a rectangle ( drawrect) with a gradient brush having a style like diagonal lines, around a Get or another control ?


I made a test but not work
Code (fw): Select all Collapse
Function test()
local oDlg
local oGet,oSay
local cGet:= space(10)
nColor1:= RGB( 245,245,235)
nColor2:=RGB(250,250,245)



DEFINE DIALOG oDlg SIZE 400,100

@ 12,10 SAY  oSay PROMPT "TEST SAY" SIZE 80,12 PIXEL of oDlg
@ 12,90 GET  oGet VAR cGEt SIZE 100,12 PIXEL of oDlg



  oDlg:bPainted := < |hDC|
  TestBrush(hDC,oGet,nColor1,nColor2,oSay:nLeft, oSay:nTop, oSAy:nWidth, oSay:nHeight)
  TestBrush(hDC,oSay,nColor1,nColor2,oGEt:nLeft, oGet:nTop, oGet:nWidth, oGet:nHeight)

 * DRAWBORDER ( hDC, oSay:nLeft, oSay:nTop, oSay:nWidth, oSay:nHeight,0 , 1, nColor1, .t. )

 *DRAWBORDER ( hDC, oGEt:nLeft, oGEt:nTop, oGEt:nWidth, oGet:nHeight,0 , 1, nColor1, .t. )

  RETURN NIL
>

ACTIVATE DIALOG oDlg ;
on init oGet:disable()
          return nil



Function TestBrush(hDC,oControl,nColor1,nColor2, nLeft, nTop, nWidth, nHeight )
local oGraphics := Graphics():New( hDC )

local nRed1 := nRGBRed( nColor1 )
local nGreen1 := nRGBGreen( nColor1 )
local nBlue1 := nRGBBlue( nColor1 )

local nRed2 := nRGBRed( nColor2 )
local nGreen2 := nRGBGreen( nColor2 )
local nBlue2 := nRGBBlue( nColor2 )


local oBrush

local oPen ,nPen:=1


oPen := Pen():New( 255, nRed1, nGreen1, nBlue1, nPen )

oBrush :=  Brush():NewGradientBrush( nTop, nLeft, nWidth, nHeight, 3,;
                         180, nRed1, nGreen1, nBlue1,;
                         180, nRed2, nGreen2, nBlue2)

oGraphics:DrawRect( , oBrush, nLeft, nTop, nWidth, nHeight )

return nil
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM

Re: help for Gdiplus Brush class

Posted: Wed Mar 22, 2023 03:40 PM
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM

Re: help for Gdiplus Brush class

Posted: Thu Mar 23, 2023 09:28 AM
cnavarro wrote:Look
https://bitbucket.org/fivetech/fivewin-contributions/downloads/TESTGDI.prg

Progetto: TESTGDI, Ambiente: bcc7Harbor:
[1]:Harbour.Exe TESTGDI.prg /m /n0 /gc1 /w0 /es2 /a /iC:\Work\fwh\include /iC:\work\HARBOUR\Include /jC:\Work\errori\BUTTON~1\I18n\Main.hil /iinclude;c:\work\fwh\include;C:\work\HARBOUR\include /oObj\TESTGDI.c
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
Compiling 'TESTGDI.prg'...
Lines 5658, Functions/Procedures 14
Generating C source output to 'Obj\TESTGDI.c'... Done.
[1]:Bcc32.Exe -M -c -DHB_OS_WIN_32 -DHB_FM_STATISTICS_OFF -DHB_NO_DEFAULT_API_MACROS -DHB_NO_DEFAULT_STACK_MACROS -IC:\Work\fwh\include -IC:\work\bcc7\Include\windows\sdk\;C:\work\HARBOUR\Include -nC:\Work\errori\BUTTON~1\Obj TESTGDI.c
Embarcadero C++ 7.30 for Win32 Copyright (c) 1993-2017 Embarcadero Technologies, Inc.
TESTGDI.c:
[1]:iLink32.Exe -Gn -aa -Tpe -s -v @TESTGDI.bcl
Turbo Incremental Link 6.80 Copyright (c) 1997-2017 Embarcadero Technologies, Inc.
Error: Unresolved external '_HB_FUN_TESTWRAPMODE' referenced from C:\WORK\ERRORI\BUTTON_PIENO_VUOTO\OBJ\TESTGDI.OBJ
Error: Unable to perform link
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 400
Joined: Tue Oct 16, 2007 05:51 PM

Re: help for Gdiplus Brush class

Posted: Thu Mar 30, 2023 04:23 AM

+1

Saludos,
Regards,

Albeiro Valencia
www.avcsistemas.com
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM

Re: help for Gdiplus Brush class

Posted: Thu Mar 30, 2023 12:12 PM

Dear Silvio, remove call to function TESTWRAPMODE

It was just a test function

Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces

Continue the discussion