FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour HELP FOR SHOW A LINE ON A DIALOG
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
HELP FOR SHOW A LINE ON A DIALOG
Posted: Tue Dec 01, 2015 09:55 AM

DrawLine( 0,300 )...

function DrawLine( x, y )
Local hdc:= oDlgMain:GetDc()
Local hPen := CreatePen( 0, 1, CLR_BLUE )
Local hOldPen := SelectObject( oDlgMain:hDc, hPen )

  MoveTo( oDlgMain:hDC, x, y)
  LineTo( oDlgMain:hDC, x, y )

  SelectObject( oDlgMain:hDc, hOldPen )
  DeleteObject( hPen )
  oDlgMain:ReleaseDc()

 return nil

WHY NOT RUN ?

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: HELP FOR SHOW A LINE ON A DIALOG
Posted: Tue Dec 01, 2015 10:40 AM
Try

Code (fw): Select all Collapse
DrawLine( 0,300, 10, 400 )


function DrawLine( x, y, x1, y1 )
Local hdc:= oDlgMain:GetDc()
Local hPen := CreatePen( 0, 1, CLR_BLUE )
Local hOldPen := SelectObject( oDlgMain:hDc, hPen )

MoveTo( oDlgMain:hDC, x, y)
LineTo( oDlgMain:hDC, x1, y1 )

SelectObject( oDlgMain:hDc, hOldPen )
DeleteObject( hPen )
oDlgMain: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
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: HELP FOR SHOW A LINE ON A DIALOG
Posted: Tue Dec 01, 2015 11:39 AM
OK THANKS

but How I can make to show a line when the button is pressed and hide the line when the button is released ?

sample :
Code (fw): Select all Collapse
#include "fivewin.ch"
#include "constant.ch"
#include "wcolors.ch"

STATIC oDlgMain

Function Test()


   Local  nBottom   := 22
   Local  nRight    := 55
   Local  nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
   Local  nHeight := nBottom * DLG_CHARPIX_H


DEFINE DIALOG oDlgMain     ;
  TITLE "Slot" ;
  SIZE nWidth, nHeight PIXEL          ;
  STYLE nOr( DS_MODALFRAME, WS_POPUP, WS_CAPTION,  4 )



ACTIVATE DIALOG oDlgMain CENTERED ;
ON INIT (ShowButtonLines())
return nil
//--------------------------------------------------------------------------//
Function ShowButtonLines()

   Local  ob[5]
   Local oFont
   local hsize:= 15
   local Vsize:= 15

 @ 150,10  BTNBMP ob[1] OF oDlgMain  ;
            SIZE hsize,Vsize   ;
            PROMPT "1"  2007 ;
            FONT oFont BOTTOM ;
            ACTION DRAWBOX( hDC, 160, 30, 160, 320, CLR_HRED,1 )

    ob[1]:lEllipse = .T.
return nil
//-------------------------------------------------------------------------------------------------//
 STATIC FUNCTION DRAWBOX( hDC, nTop, nLeft, nBottom, nRight, nColor,nTipo )
    LOCAL hPen := CREATEPEN( PS_SOLID, 4, nColor )
    LOCAL hOldPen := SELECTOBJECT( hDC, hPen )
    do case
        case nTipo = 1
               MOVETO( hDC, nLeft, nTop )
               LINETO( hDC, nRight, nTop )
        case nTipo = 2
               MOVETO( hDC, nRight, nBottom  )
               LINETO( hDC,nBottom, nRight )
            case nTipo = 3
               MOVETO( hDC,nLeft, nTop)
               LINETO( hDC, nBottom, nRight )
          endcase
    SELECTOBJECT( hDC, hOldPen )
    DELETEOBJECT( hPen )
    RETURN NIL
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: HELP FOR SHOW A LINE ON A DIALOG
Posted: Tue Dec 01, 2015 02:12 PM

Silvio
One possibility is:
To delete the selected line the pen like the background of the dialogue or control and repainting the line

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

Continue the discussion