HELP FOR SHOW A LINE ON A DIALOG

HELP FOR SHOW A LINE ON A DIALOG

Postby Silvio.Falconi » Tue Dec 01, 2015 9: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 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: 7048
Joined: Thu Oct 18, 2012 7:17 pm

Re: HELP FOR SHOW A LINE ON A DIALOG

Postby cnavarro » Tue Dec 01, 2015 10:40 am

Try

Code: Select all  Expand view


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

Re: HELP FOR SHOW A LINE ON A DIALOG

Postby Silvio.Falconi » 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: Select all  Expand view


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

Re: HELP FOR SHOW A LINE ON A DIALOG

Postby cnavarro » Tue Dec 01, 2015 2: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
User avatar
cnavarro
 
Posts: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 61 guests

cron