Results 1 to 3 of 3

Thread: [RESOLVED] Draw inside a frame

  1. #1

    Thread Starter
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573

    Resolved [RESOLVED] Draw inside a frame

    I have a frame with various option buttons whereby the user selects the drawing line style of a picturebox: PS_SOLID, PS_DASH, PS_DOT and so on. And I want to display a short line with the corresponding style next each button. Do I have to place tiny pictureboxes -and plot the lines on them- inside the frame or is there a preferable way?
    Lottery is a tax on people who are bad at maths
    If only mosquitoes sucked fat instead of blood...
    To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Draw inside a frame

    You can draw directly to the frame, but what you draw is not preserved if the window is minimized or another window is dragged over it. You get no Paint events for the frame either, so you don't know when to update what was erased by those types of actions; short of subclassing.

    A picturebox is probably the best solution here. If you really wanted to draw on the frame, you can get its DC via the GetDC and/or GetWindowDC APIs, then use other APIs to draw to it or BitBlt to it.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3

    Thread Starter
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573

    Re: Draw inside a frame

    Quote Originally Posted by LaVolpe View Post
    ...
    A picturebox is probably the best solution here...
    A borderless picturebox with same background color as the frame works nicely, thanks.
    Lottery is a tax on people who are bad at maths
    If only mosquitoes sucked fat instead of blood...
    To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)

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