why not show the bitmap ?

why not show the bitmap ?

Postby Silvio » Fri Jan 29, 2010 10:33 pm

Code: Select all  Expand view
#include "fivewin.ch"


Funcion test()

Local OwND,nspace:=0

 hBtnSeparator := BMPBTNDBAR()


DEFINE WINDOW OwND

 oBar :=TBar():New( OwND, 26, 26, .T., "TOP", , .T. )

for i=1 to 3

DrawMasked( oBar:hDC, hBtnSeparator, oBar:ntop()+4, nspace )
 
DeleteObject(hBtnSeparator)

ACTIVATE WINDOW OWND

retur nil



//-----------------------------------------------------------------//
#pragma BEGINDUMP
#include "Windows.h"
#include "hbapi.h"





DWORD btndbar [10][10]={
        {/*0,0*/0xff00ff,/*1,0*/0xff00ff,/*2,0*/0xff00ff,/*3,0*/0xff00ff,/*4,0*/0xff00ff,/*5,0*/0xff00ff,/*6,0*/0xff00ff,/*7,0*/0xff00ff,/*8,0*/0xff00ff,/*9,0*/0xff00ff},
        {/*0,1*/0xff00ff,/*1,1*/0x668eaf,/*2,1*/0x668eaf,/*3,1*/0x668eaf,/*4,1*/0x668eaf,/*5,1*/0x668eaf,/*6,1*/0x668eaf,/*7,1*/0xff00ff,/*8,1*/0xff00ff,/*9,1*/0xff00ff},
        {/*0,2*/0xff00ff,/*1,2*/0x668eaf,/*2,2*/0xfefeff,/*3,2*/0xfefeff,/*4,2*/0xfefeff,/*5,2*/0xfefeff,/*6,2*/0xfefeff,/*7,2*/0xff00ff,/*8,2*/0xff00ff,/*9,2*/0xff00ff},
        {/*0,3*/0xff00ff,/*1,3*/0x668eaf,/*2,3*/0xfefeff,/*3,3*/0xff00ff,/*4,3*/0xff00ff,/*5,3*/0xff00ff,/*6,3*/0xff00ff,/*7,3*/0xff00ff,/*8,3*/0xff00ff,/*9,3*/0xff00ff},
        {/*0,4*/0xff00ff,/*1,4*/0x668eaf,/*2,4*/0xfefeff,/*3,4*/0xff00ff,/*4,4*/0x668eaf,/*5,4*/0xfefeff,/*6,4*/0xff00ff,/*7,4*/0x668eaf,/*8,4*/0xfefeff,/*9,4*/0xff00ff},
        {/*0,5*/0xff00ff,/*1,5*/0x668eaf,/*2,5*/0xfefeff,/*3,5*/0xff00ff,/*4,5*/0xff00ff,/*5,5*/0x668eaf,/*6,5*/0x668eaf,/*7,5*/0x668eaf,/*8,5*/0xfefeff,/*9,5*/0xff00ff},
        {/*0,6*/0xff00ff,/*1,6*/0x668eaf,/*2,6*/0xfefeff,/*3,6*/0xff00ff,/*4,6*/0xff00ff,/*5,6*/0x668eaf,/*6,6*/0x668eaf,/*7,6*/0x668eaf,/*8,6*/0xfefeff,/*9,6*/0xff00ff},
        {/*0,7*/0xff00ff,/*1,7*/0xff00ff,/*2,7*/0xff00ff,/*3,7*/0xff00ff,/*4,7*/0x668eaf,/*5,7*/0x668eaf,/*6,7*/0x668eaf,/*7,7*/0x668eaf,/*8,7*/0xfefeff,/*9,7*/0xff00ff},
        {/*0,8*/0xff00ff,/*1,8*/0xff00ff,/*2,8*/0xff00ff,/*3,8*/0xff00ff,/*4,8*/0xff00ff,/*5,8*/0xfefeff,/*6,8*/0xfefeff,/*7,8*/0xfefeff,/*8,8*/0xfefeff,/*9,8*/0xff00ff},
        {/*0,9*/0xff00ff,/*1,9*/0xff00ff,/*2,9*/0xff00ff,/*3,9*/0xff00ff,/*4,9*/0xff00ff,/*5,9*/0xff00ff,/*6,9*/0xff00ff,/*7,9*/0xff00ff,/*8,9*/0xff00ff,/*9,9*/0xff00ff}
};


 HBITMAP BitmapFromCode( int iWidth, int iHeight, VOID* ImageBits )
{
        return CreateBitmap(iWidth,iHeight,1,sizeof(RGBQUAD)*8, ImageBits);
}


HB_FUNC( BMPBTNDBAR )
{
    hb_retnl( (long) BitmapFromCode( 10, 10, &btndbar ));
}



  #pragma ENDDUMP
Best Regards, Saludos

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

Re: why not show the bitmap ?

Postby Daniel Garcia-Gil » Sat Jan 30, 2010 1:40 pm

Hello Silvio.

1.- test error, FOR without NEXT
2.- IS NOT Funcion, is FUNCTION
3- there are not valid hDC in oBar control, you need one

test this example
Code: Select all  Expand view

#include "fivewin.ch"

Function test()

   Local oWnd, oBar

   DEFINE WINDOW oWnd

   oBar = TBar():New( oWnd, 26, 26, .T., "TOP", , .T. )
   oBar:bPainted = { | hDC | DrawOnBar( hDC ) }

   ACTIVATE WINDOW oWnd

return nil

FUNCTION DrawOnBar( hDC )
   local i,nspace:=0
   local hBtnSeparator
   
   hBtnSeparator = BMPBTNDBAR()
   
   for i=1 to 3
      DrawMasked( hDC, hBtnSeparator, 10, nspace )
      nspace += 100
   next
   
   DeleteObject( hBtnSeparator )
   
return nil


//-----------------------------------------------------------------//
#pragma BEGINDUMP
#include "Windows.h"
#include "hbapi.h"


DWORD btndbar [10][10]={
        {/*0,0*/0xff00ff,/*1,0*/0xff00ff,/*2,0*/0xff00ff,/*3,0*/0xff00ff,/*4,0*/0xff00ff,/*5,0*/0xff00ff,/*6,0*/0xff00ff,/*7,0*/0xff00ff,/*8,0*/0xff00ff,/*9,0*/0xff00ff},
        {/*0,1*/0xff00ff,/*1,1*/0x668eaf,/*2,1*/0x668eaf,/*3,1*/0x668eaf,/*4,1*/0x668eaf,/*5,1*/0x668eaf,/*6,1*/0x668eaf,/*7,1*/0xff00ff,/*8,1*/0xff00ff,/*9,1*/0xff00ff},
        {/*0,2*/0xff00ff,/*1,2*/0x668eaf,/*2,2*/0xfefeff,/*3,2*/0xfefeff,/*4,2*/0xfefeff,/*5,2*/0xfefeff,/*6,2*/0xfefeff,/*7,2*/0xff00ff,/*8,2*/0xff00ff,/*9,2*/0xff00ff},
        {/*0,3*/0xff00ff,/*1,3*/0x668eaf,/*2,3*/0xfefeff,/*3,3*/0xff00ff,/*4,3*/0xff00ff,/*5,3*/0xff00ff,/*6,3*/0xff00ff,/*7,3*/0xff00ff,/*8,3*/0xff00ff,/*9,3*/0xff00ff},
        {/*0,4*/0xff00ff,/*1,4*/0x668eaf,/*2,4*/0xfefeff,/*3,4*/0xff00ff,/*4,4*/0x668eaf,/*5,4*/0xfefeff,/*6,4*/0xff00ff,/*7,4*/0x668eaf,/*8,4*/0xfefeff,/*9,4*/0xff00ff},
        {/*0,5*/0xff00ff,/*1,5*/0x668eaf,/*2,5*/0xfefeff,/*3,5*/0xff00ff,/*4,5*/0xff00ff,/*5,5*/0x668eaf,/*6,5*/0x668eaf,/*7,5*/0x668eaf,/*8,5*/0xfefeff,/*9,5*/0xff00ff},
        {/*0,6*/0xff00ff,/*1,6*/0x668eaf,/*2,6*/0xfefeff,/*3,6*/0xff00ff,/*4,6*/0xff00ff,/*5,6*/0x668eaf,/*6,6*/0x668eaf,/*7,6*/0x668eaf,/*8,6*/0xfefeff,/*9,6*/0xff00ff},
        {/*0,7*/0xff00ff,/*1,7*/0xff00ff,/*2,7*/0xff00ff,/*3,7*/0xff00ff,/*4,7*/0x668eaf,/*5,7*/0x668eaf,/*6,7*/0x668eaf,/*7,7*/0x668eaf,/*8,7*/0xfefeff,/*9,7*/0xff00ff},
        {/*0,8*/0xff00ff,/*1,8*/0xff00ff,/*2,8*/0xff00ff,/*3,8*/0xff00ff,/*4,8*/0xff00ff,/*5,8*/0xfefeff,/*6,8*/0xfefeff,/*7,8*/0xfefeff,/*8,8*/0xfefeff,/*9,8*/0xff00ff},
        {/*0,9*/0xff00ff,/*1,9*/0xff00ff,/*2,9*/0xff00ff,/*3,9*/0xff00ff,/*4,9*/0xff00ff,/*5,9*/0xff00ff,/*6,9*/0xff00ff,/*7,9*/0xff00ff,/*8,9*/0xff00ff,/*9,9*/0xff00ff}
};

 HBITMAP BitmapFromCode( int iWidth, int iHeight, VOID* ImageBits )
{
        return CreateBitmap(iWidth,iHeight,1,sizeof(RGBQUAD)*8, ImageBits);
}

HB_FUNC( BMPBTNDBAR )
{
    hb_retnl( (long) BitmapFromCode( 10, 10, &btndbar ));
}

#pragma ENDDUMP
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: why not show the bitmap ?

Postby Silvio » Sun Jan 31, 2010 11:16 am

THANKS
Best Regards, Saludos

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 79 guests