GDI problem

GDI problem

Postby Silvio.Falconi » Fri Dec 09, 2016 12:30 pm

when I use the function

oImage1:= GDIBmp():new(,"hotdog" )

and move the WINDOW or size the WINDOW where I show the bitmap or I put another application window on the window where I show the bitmap
it erased the bitmap
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: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: GDI problem

Postby Antonio Linares » Fri Dec 09, 2016 6:31 pm

Silvio,

Please provide a small PRG to test it, thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42093
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: GDI problem

Postby Silvio.Falconi » Sat Dec 10, 2016 11:16 am

Code: Select all  Expand view

    #include "FiveWin.ch"
    #include "constant.ch"

    static oWnd,oBmp



    Function Main()



      DEFINE BITMAP oBmp FILENAME "C:\fwh\bitmaps\pngs\Logo.png"
      DEFINE WINDOW oWnd  FROM 10, 10 TO 48,110 TITLE "test"  

      DrawImage(oBmp)


      ACTIVATE WINDOW oWnd ;
        on init DrawImage(oWnd)  
    return nil

     function DrawImage(ownd)
    local hdc:= oWnd:getdc()
    local oGraphics := Graphics():New( ownd:hDC )
    local oImage:= GDIBmp():new(,"cuoco" )

    oGraphics:DrawImage( oImage , 60 ,60 )

    oGraphics:destroy()
    oWnd:releasedc()

    Return nil
       


if you resize the window or put another window over the image ...pouff !!!
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: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: GDI problem

Postby nageswaragunupudi » Sat Dec 10, 2016 1:20 pm

Obvious.
You should draw image in ON PAINT.
Not ON INIT.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: GDI problem

Postby Silvio.Falconi » Sat Dec 10, 2016 4:16 pm

Sorry,
this was only a sample
I cannot pubblish all sources
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: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: GDI problem

Postby nageswaragunupudi » Sat Dec 10, 2016 4:21 pm

I do not want your sources. I do not have any use with them.

I pointed out the error in your sample and explained why your image is vanishing.

If you want to learn or not it is upto you.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: GDI problem

Postby Silvio.Falconi » Sat Dec 10, 2016 4:33 pm

some have changed the function DrawImage on gdiplus because

I had

oGraphics:DrawImage( aImages[i] , 1 ,aPos[i])

and it run ok

Now ( I have also the fwh March 2016)

oGraphics:DrawImage( aImages[i] , aPos[i],1 )

I have this

METHOD DrawImage( oImage, nTop, nleft, nWidth, nHeight ) CLASS Graphics

if Empty(nWidth ) .or. Empty( nHeight )
GdiPlusDrawImage( ::hGraphics, oImage:hBmp, nTop, nLeft )
else
GdiPlusDrawImage( ::hGraphics, oImage:hBmp,nTop,nLeft, nWidth, nHeight )
endif

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: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: GDI problem

Postby Silvio.Falconi » Sat Dec 10, 2016 4:39 pm

nageswaragunupudi wrote:I do not want your sources. I do not have any use with them.

I pointed out the error in your sample and explained why your image is vanishing.

If you want to learn or not it is upto you.


the sources not is the problem for me I just only say to you I use the clausole ON INIT on my application it was only a test because
I not found a solution

my problem not is "on init " but is another
I tried also with On Paint ( on my app) the error is the same

I sent you my test
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: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: GDI problem

Postby cnavarro » Sat Dec 10, 2016 6:50 pm

Silvio, try
I hope i understood you

Code: Select all  Expand view


#include "FiveWin.ch"

Static oWnd
Static oBmp
Static oImage

Function Main()

   DEFINE WINDOW oWnd  FROM 1, 1 TO 38,80 TITLE "Test"  

      DrawImage1()
      DrawImage2()
   
   ACTIVATE WINDOW oWnd ON PAINT ( DrawImage1(), DrawImage2() ) //  ON INIT ( DrawImage1(), DrawImage2() )

   oBmp:Destroy()
   oImage:Destroy()

return nil
   
Function DrawImage1()

   local hdc
   local oGraphics

   hdc       := oWnd:GetDC()
   oGraphics := Graphics():New( hDC )
   
   if Empty( oBmp )
       oBmp      := GDIBmp():new("..\bitmaps\pngs\pan_setting.png" )
   endif
   oGraphics:DrawImage( oBmp , 10 ,10 )

   oGraphics:Destroy()
   oWnd:ReleaseDC()

Return nil

//----------------------------------------------------------------------------//

function DrawImage2()

   local hdc
   local oGraphics
   
   hdc       := oWnd:GetDC()
   oGraphics := Graphics():New( hdc )

   if Empty( oImage )
      oImage:= GDIBmp():new("D:\fwh\fwhteam\bitmaps\sms.bmp" )
   endif
   oGraphics:DrawImage( oImage ,100 ,100 )

   oGraphics:destroy()
   oWnd:releasedc()

Return nil
 
//----------------------------------------------------------------------------//

 
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: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: GDI problem

Postby ukoenig » Sat Dec 10, 2016 6:54 pm

Another complete GDI-test

1. draw a image ON PAINT ( windows )
2. draw a image on button-action
3. testing window on move ( image stays visible )
4. testing window on resize ( image stays visible )
5. testing different backgrounds

http://www.pflegeplus.com/DOWNLOADS/GDITest1.zip

Image

best regards
Uwe :D
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: GDI problem

Postby Silvio.Falconi » Tue Dec 13, 2016 10:43 am

Uwe, do u remeber roller test
when I change the size of the window the image make with gdi vanish
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: 7056
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 82 guests

cron