Results 1 to 7 of 7

Thread: Transparent drawing layer

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2010
    Posts
    20

    Question Transparent drawing layer

    Okay, I'm making a fresh start and re-exploring my options.

    I'm trying to put a layer of transparency over a program that will act as a drawing layer.

    The cursor should be able to sniff to see whether it's sitting on transparency, or a drawn object. Transparency it will click through, while clicking on a drawn object will enable the user to edit said drawn object.

    I've been trying to do this using a user control I made from scratch, but this is starting to look more and more like a dead end the deeper I get into it. Currently the layer of transparency works, along with the cursor sniffing, but the user control refuses to be brought to the front.

    Any ideas on other ways to go about this / ways to make the user control work?

  2. #2
    PowerPoster cicatrix's Avatar
    Join Date
    Dec 2009
    Location
    Moscow, Russia
    Posts
    3,654

    Re: Transparent drawing layer

    Without knowing more details about what you are trying to achieve I wouldn't be of much help, but I get the strong feeling that you should explore the functionality of System.Drawing.Region class. It can hold complex shapes and check if any given point is inside it or not.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Nov 2010
    Posts
    20

    Re: Transparent drawing layer

    If you look at any of the other posts I've made, I talk about it in much more detail. All of the actual drawing tools and such are made. The primary issue I'm having is making my transparent drawing layer come to the front. (Me.Bringtofront did nothing for me)

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

    Re: Transparent drawing layer

    This may or may not be of use to you but you may like to follow the CodeBank link in my signature and check out my thread on Manipulating GDI+ Drawings.
    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

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Nov 2010
    Posts
    20

    Re: Transparent drawing layer

    I'm looking into what you suggested now, Edge. I really have no experience with either of those things but I'll be getting help from my boss / professor over the next few days with it.

  6. #6
    PowerPoster
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,070

    Re: Transparent drawing layer

    I think your best option is WPF. The transparency, clicking through it and such, that sounds like exactly what WPF has built in. In WPF a mouse click events travels throug the various layers of elements (once in the back to front direction as a preview event, and once in the front to back direction (or the other way around, but I think this is right)), unlike in winforms where only the actual clicked element receives the event. For example, in WPF if you have a button in a panel in a listboxitem in a listbox in a window, then when you click that button the Click event fires for ALL these elements (button, then panel, then listboxitem, then listbox, then window) and in each of these events you can see where it originated, you can see the location of the click relative to any of these elements, etc. It sounds exactly like what you need.

    You say that you start from scratch, so this might be a good time to make the switch.

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Nov 2010
    Posts
    20

    Re: Transparent drawing layer

    So I've decided to go with WPF. Problem is, a WPF user control doesn't seem compatable with OCX controls? Any solutions to this?

Tags for this Thread

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