help for Gdiplus Brush class

help for Gdiplus Brush class

Postby Silvio.Falconi » 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: Select all  Expand view  RUN


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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7075
Joined: Thu Oct 18, 2012 7:17 pm

Re: help for Gdiplus Brush class

Postby cnavarro » Wed Mar 22, 2023 3: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
User avatar
cnavarro
 
Posts: 6549
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: help for Gdiplus Brush class

Postby Silvio.Falconi » Thu Mar 23, 2023 9:28 am




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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7075
Joined: Thu Oct 18, 2012 7:17 pm

Re: help for Gdiplus Brush class

Postby albeiroval » Thu Mar 30, 2023 4:23 am

+1
Saludos,
Regards,

Albeiro Valencia
www.avcsistemas.com
User avatar
albeiroval
 
Posts: 379
Joined: Tue Oct 16, 2007 5:51 pm
Location: Barquisimeto - Venezuela

Re: help for Gdiplus Brush class

Postby cnavarro » 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
User avatar
cnavarro
 
Posts: 6549
Joined: Wed Feb 15, 2012 8:25 pm
Location: España


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 91 guests