Creating a bmp from a draw...

Creating a bmp from a draw...

Postby Silvio » Tue Nov 20, 2007 8:59 am

Can I create a bmp or button from a arrow I created drawing it



Code: Select all  Expand view

#include "FiveWin.ch"



Function Main()

Local obtn,oWnd
Local oGrayBrush := CreateSolidBrush( GetSysColor(15) )
local hDC := GetDC()

DEFINE WINDOW oWnd TITLE "Testing button" ;
      FROM 3, 3 TO 20, 80 ;
      COLOR CLR_BLACK, GetSysColor( COLOR_BTNFACE )

     obtn:=Arrow_SX(hDC,11,   oWnd:nWidth - 25 + 2     , oGrayBrush)




   ACTIVATE WINDOW oWnd
Return nil





static Function DrawPolygon( hDC, aPoints, nColor )
local n
local nLen := len( aPoints )
local hPen, hOldPen

if nColor != nil
  hPen := CreatePen( PS_SOLID,1,nColor)
  hOldPen := SelectObject( hDC, hPen )
endif

Moveto( hDC, aPoints[1,1], aPoints[1,2])
for n := 2 to nLen
   Lineto( hDC, aPoints[n,1], aPoints[n,2])
next
Lineto( hDC, aPoints[1,1], aPoints[1,2])

if nColor != nil
  SelectObject(hDC,hOldPen)
  DeleteObject( hPen )
endif

return 0


Function Arrow_SX ( hDC,nTop,nLeft, nColor )

     DrawPolygon( hDC, { {nLeft+4,nTop   } ,;
                  {nLeft  ,nTop+4 } ,;
                  {nLeft+4,nTop+8 } ,;
                  {nLeft+4,nTop   } }, nColor )

return 0
Best Regards, Saludos

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

Postby Antonio Linares » Tue Nov 20, 2007 9:45 am

Silvio,

You have to create manually a TBtnBmp or a TButton.

There is no way to create them automatically from a drawing
regards, saludos

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

Postby Silvio » Tue Nov 20, 2007 10:33 am

But i remeber something..
someone from a draw created a compatiblebmp and then made an action on it
Best Regards, Saludos

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

Postby Antonio Linares » Tue Nov 20, 2007 12:26 pm

Silvio,

A bitmap has no action. A (Class) TBitmap object, yes
regards, saludos

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

Postby Marcelo Via Giglio » Tue Nov 20, 2007 1:58 pm

Hi,

if you start with a blank bmp, and draw on these, you can save this modification in other bmp file, try this

hBmp := WndBitmap( obmp:hWnd )
hDib := DibFromBitmap( hBmp )
DibWrite( "bak.bmp", hDib )

I don't know if it's what do you want

saludos

Marcelo
Marcelo Via Giglio
 
Posts: 1064
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 67 guests