MSGItem 2007

User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

if we use a brush ?

Code: Select all

#include "fivewin.ch"

CLASS TBrushNew FROM TBrush

      METHOD New( nColor, nColor2, lVGrad ) CONSTRUCTOR

ENDCLASS


  METHOD New( nWidth, nHeight, nColor, nColor2, lGradient ) CLASS TBrushNew

    ::hBitmap := CreaBitmap2Color(nWidth, nHeight, nColor, nColor2, lGradient )
    ::hBrush = If( ::hBitmap != 0, CreatePatternBrush( ::hBitmap ), )
    ::nCount := 1
     AAdd( ::aBrushes, Self )

return Self



function CreaBitmap2Color( nWidth, nHeight, nColor, nColor2, lGradient )

local hDC     := CreateDC( "DISPLAY",0,0,0 )
local hDCMem  := CreateCompatibleDC( hDC )
local hBmpMem := CreateCompatibleBitmap( hDC, nWidth, nHeight )
local hOldBmp := SelectObject( hDCMem, hBmpMem )
local rc      := {0,0,nHeight,nWidth}

if lGradient == nil; lGradient := .t.; endif
if nColor2 == nil; nColor2 := nColor; endif

if lGradient
 
   Gradient( hDCMem, {rc[1],rc[2],rc[3]+2,rc[4]}, nColor, nColor2, .t. )
else
   Gradient( hDCMem, {rc[1],rc[2],rc[3]+2,rc[4]}, nColor, nColor2, .F. )
endif

SelectObject( hDCMem, hOldBmp )
DeleteDC( hDCMem )
DeleteDC( hDC )

return hBmpMem
Can run it ?
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

Code: Select all


DLL32 STATIC FUNCTION CREATEDIBITMAP( hDC AS LONG, hInfoH AS LONG,nFlags AS LONG, hBits AS LONG, hInfo AS LONG, nUsage AS LONG ) AS LONG;
PASCAL FROM "CreateDIBitmap" LIB "gdi32.dll"

Best Regards, Saludos

Falconi Silvio
Post Reply