Results 1 to 3 of 3

Thread: ScreenDC and Setting Object Color

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jul 2001
    Location
    Tucson, AZ
    Posts
    2,166

    ScreenDC and Setting Object Color

    When drawing a line in the ScreenDC (eg. API MoveTo LineTo)
    is there anyway to set the color?

    There is no forecolor property for the Screen object.
    API CreatePen also doesn't appear to work.

    Thanks
    David

  2. #2
    Fanatic Member Kaverin's Avatar
    Join Date
    Oct 2000
    Posts
    930
    Did you do something like this?
    VB Code:
    1. Dim DC As Long, hPen As Long, hOldPen As Long
    2.    DC = GetDC(0)
    3.    hPen = CreatePen(PS_SOLID, 1, vbRed)
    4.    hOldPen = SelectObject(DC, hPen)
    5.    MoveToEx DC, 200, 150, 0
    6.    LineTo DC, 600, 450
    7.    DeleteObject SelectObject(DC, hOldPen)
    8.    ReleaseDC 0, DC
    I tried that myself, and it drew a red line on my screen like I expected.
    I'm baaaack...
    VB5 Professional Edition, VC++ 6
    Using a 1 gHz Thunderbird, 256 mb RAM, 40 gb HD system with Win98se

    I feel special because I finally figured out how to loop midis: Post link
    I'm a fanatic too

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Jul 2001
    Location
    Tucson, AZ
    Posts
    2,166
    Lookes like my code, but mine just draws a black line.
    Tried changing colors and still black.

    I have a picbox showing on top of the screen, draw in picboxdc OK, then change to screendc and draw another line still on top of picbox. Only getting black lines - - color won't change so something else must be wrong.

    Thanks for quick feedback.

    David

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width