CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2005
    Posts
    200

    How to make a bitmap image cover part of a picturebox?

    I created a bitmap object and used it to draw a 2D terrain programatically. Then I also added a picturebox control to display an image near the terrain.

    However, the picturebox control is blocking out part of the bitmap.

    How do I make the bitmap "cover" part of the picturebox control instead?
    Is there a "layers" method which the form can use to draw one bitmap over another control?

  2. #2
    Join Date
    Dec 2003
    Posts
    112

    Re: How to make a bitmap image cover part of a picturebox?

    Correct me if I am confused on the exact issue.

    As I read it, you have a control of some type which you are using to display a terrain (Control1). You then have a second control(Control2). Your problem is that Control1 is being partially obscured by Control2.

    It would seem to me this is a simple layout problem. You have two options:

    A) Resize and/or move Control2 so that it no longer conflicts with Control1

    B) Use some combination of SendToBack()/BringToFront() to adjust the draw order of the controls. Likely doing Control1.BringToFront() would be enough. However the question is why would you want Control1 to partially obscure Control2? It seems like Option A) would make more sense.
    Eggman
    Using: VS 2008 w. Net 3.5

  3. #3
    Join Date
    Jan 2002
    Location
    Scaro, UK
    Posts
    5,940

    Re: How to make a bitmap image cover part of a picturebox?

    Or, draw the image directly onto the bitmap of the terrain.

    This to my mind is the best solution as it'll prevent 'flickering' you might see if you have one control covering another.

    Darwen.
    www.pinvoker.com - PInvoker - the .NET PInvoke Interface Exporter for C++ Dlls.

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

Featured