draw with poligon

draw with poligon

Postby Silvio » Tue Dec 26, 2006 11:03 pm

Image
I must create this bitmap with poligon function so that it is divided in four various pieces so that I can move them with the mouse : the three bars and the small triangle (with drag and drop)
it' is possible ?
Best Regards, Saludos

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

Postby Antonio Linares » Sat Dec 30, 2006 5:25 pm

Silvio,

You may check where the mouse is clicked and change the mouse cursor to a one that also paints the portion that you want to move. When the mouse is released then you check where it is and change the drawing accordingly.
regards, saludos

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

Postby Silvio » Sat Dec 30, 2006 11:52 pm

thanks but i not know how make it
can you create a small test to work on ?
Best Regards, Saludos

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

Postby Antonio Linares » Sun Dec 31, 2006 6:08 am

Silvio,

Please implement the PolyPoligon() calls to draw the different parts of your drawing first, thanks

Then I will show you how to move them,
regards, saludos

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

Postby Silvio » Mon Jan 01, 2007 11:33 pm

i not know how make it
Best Regards, Saludos

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

Postby Silvio » Tue Nov 20, 2007 9:19 am

Antonio,
this is the code
#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


How I can move 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 9:48 am

Silvio,

You have to find the area where the mouse is clicked and then select a mouse cursor based on the underlying drawing
regards, saludos

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 27 guests