Announcement

Collapse
No announcement yet.

How to draw a line

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to draw a line

    I'm now trying to draw a line on top of a dialog.
    The following code does not work, and in any case I don't
    see how it would RESIZE as the dialog chnaged sizes.

    Could someone help point me in the right direction to
    draw one simple straight line correctly?
    ----------------------------------------------------------
    Code:
    #COMPILE EXE
    #REGISTER NONE
    $INCLUDE "WIN32API.INC"
    $INCLUDE "MA.INC"
    
    FUNCTION PBMAIN() AS LONG
    LOCAL hDlg AS LONG
    
    DIALOG NEW 0,"Draw Line",,,320,240,_
      %WS_CAPTION OR %WS_SYSMENU OR %WS_THICKFRAME OR %WS_MAXIMIZEBOX OR _
      %WS_MINIMIZEBOX OR %DS_CONTEXTHELP,0 TO hDlg
    
    SelectObject(hDlg,GetStockObject(%Black_Pen))
    MoveToEx hDlg,5, 5,BYVAL %NULL
    LineTo   hDlg,5,200
    
    DIALOG SHOW MODAL hDlg
    END FUNCTION

  • #2
    You can not "draw" a line inside of a dialog, unless you want to handle all painting in the WM_PAINT event.

    Why not use a label with a %SS_ETCHEDVER or %SS_ETCHEDHORZ style?

    --Dave


    ------------------
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Home of the BASIC Gurus
    www.basicguru.com

    Comment


    • #3
      Use CONTROL ADD LINE instead... it is the easiest way, IMHO.

      PS, The MoveToEx() and LineTo() API functions require a Device Context, not a window Handle.

      Time to buy an API book, Joe! Check out the FAQ forum for some suggestions.


      ------------------
      Lance
      PowerBASIC Support
      mailto:[email protected]sic.com[email protected]</A>
      Lance
      mailto:[email protected]

      Comment


      • #4
        Can I ask, why occurs permanent problems with refreshing text in PbEdit and CCEdit ?

        ------------------

        Comment


        • #5
          Semen, can you accurately describe the problem you are experiencing?

          PS, as this seems to have nothing to do with the above messages, can we start tangent discussions in a separate (new) thread? Thanks!


          ------------------
          Lance
          PowerBASIC Support
          mailto:[email protected][email protected]</A>
          Lance
          mailto:[email protected]

          Comment

          Working...
          X