Results 1 to 7 of 7

Thread: Bringing colored rectangle to the front

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2010
    Posts
    4

    Bringing colored rectangle to the front

    I am working with graphic methods. I am trying to create a piano using brushes, pens, and rectangles. I have 14 white keys and started making the black keys. For some reason I cant get the black keys to overlap the white ones. Is there a command to send the black rectangles to the front? Thanks


    Drew

  2. #2
    Wait... what? weirddemon's Avatar
    Join Date
    Jan 2009
    Location
    USA
    Posts
    3,826

    Re: Bringing colored rectangle to the front

    You mean in the designer? I think that should reflect on its position during runtime...

    Right click the component and you'll find the option you're looking for.
    CodeBank contributions: Process Manager, Temp File Cleaner

    Quote Originally Posted by SJWhiteley
    "game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Bringing colored rectangle to the front

    If you were drawing on a piece of paper, how would you do this? If you drew the black keys first and then the white ones, the black ones would be covered by the white ones and you wouldn't see them, right? You'd have to draw the white ones first, then the black ones over the top.

    The same goes for GDI+. Each pixel only displays the last thing that was drawn on it, so you need to draw the black rectangles last if you want to be able to see them over the white ones.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4

    Thread Starter
    New Member
    Join Date
    Apr 2010
    Posts
    4

    Re: Bringing colored rectangle to the front

    Name:  piano..JPG
Views: 144
Size:  167.1 KB

    This is the code I used to create that image. How do i get the black rectangle over the white?

  5. #5
    Fanatic Member
    Join Date
    Dec 2009
    Posts
    595

    Re: Bringing colored rectangle to the front

    instead of giving such a huge screenshot,just copy your code and paste it in the CODE tag

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Bringing colored rectangle to the front

    You may have posted without seeing my post but, as I said, you need to draw the black rectangles AFTER drawing the white rectangles if you don't want the white to cover the black. It's just like two coats of paint. Each coat hides whatever is underneath it.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  7. #7

    Thread Starter
    New Member
    Join Date
    Apr 2010
    Posts
    4

    Re: Bringing colored rectangle to the front

    Quote Originally Posted by jmcilhinney View Post
    If you were drawing on a piece of paper, how would you do this? If you drew the black keys first and then the white ones, the black ones would be covered by the white ones and you wouldn't see them, right? You'd have to draw the white ones first, then the black ones over the top.

    The same goes for GDI+. Each pixel only displays the last thing that was drawn on it, so you need to draw the black rectangles last if you want to be able to see them over the white ones.

    Thanks, that makes sense I just switched the black and white around and it works. Sorry about the huge picture, thought it would be smaller. Thanks for the help guys.


    Drew

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