Results 1 to 6 of 6

Thread: How to draw 'inverted' line in a transparent form ?

  1. #1

    Thread Starter
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Arrow How to draw 'inverted' line in a transparent form ?

    The attatched project uses snippet from Bushmobile's 'Glass Form' to create a transparent form. I want to draw lines in this form with inverted color. I tried DrawMode=Invert. But it didn't work in this case.
    Any more idea ?

    Currently I'm drawing black & white lines. But I want this:
    Attached Images Attached Images  
    Attached Files Attached Files
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  2. #2
    Cumbrian Milk's Avatar
    Join Date
    Jan 2007
    Location
    0xDEADBEEF
    Posts
    2,448

    Re: How to draw 'inverted' line in a transparent form ?

    I can think of a way you could do this but it requires a fair bit of messing.
    As far as I understand if you want the inverted lines you will have to capture the DC of the desktop under the form and then blit the inverted desktop onto the form. Anything working with the DC of the form will just see the forms transparent colour.
    If you subclass then I guess it would be possible to just do this at the right times, eg forms been moved or a form under the form has moved. Otherwise you would have to redraw constantly just in case the desktop changes or form moves.

    More hassle than it's worth IMHO.

    There might be other options but I don't know them.

  3. #3
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    Re: How to draw 'inverted' line in a transparent form ?

    Have you tried setting the drawmode with an API? Then using MoveTo/LineTo ?

    More specifically.. the SetROP2 API using R2_NOT, which draws it inverted.

    chem
    Last edited by chemicalNova; Mar 3rd, 2008 at 11:42 PM.

    Visual Studio 6, Visual Studio.NET 2005, MASM

  4. #4

    Thread Starter
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: How to draw 'inverted' line in a transparent form ?

    @Milk:
    Thanks for posting. I've already experimented your idea in another project. And yes, as you have said, it is a messy way and the result is not very good.

    @Chem:
    I didn't know about the API. Thanks. Let me see what happens...
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  5. #5

    Thread Starter
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: How to draw 'inverted' line in a transparent form ?

    No. That didn't work.

    I've modified this line in APIGuide code:
    Code:
       Me.AutoRedraw = True
        'check the current mix mode
        If GetROP2(Me.hdc) <> R2_NOT Then
            'set the current foreground mix mode to R2_WHITE (Pixel is always 1)
            SetROP2 Me.hdc, R2_NOT
        End If
        'Draw a line from (0,0)-(200,200)
        LineTo Me.hdc, 200, 200
    But it behaves same as DrawMode=Invert (The line becomes red).
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  6. #6
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    Re: How to draw 'inverted' line in a transparent form ?

    Have a look at MSDN.. more specifically here: http://msdn2.microsoft.com/en-us/lib...12(VS.85).aspx

    There is a list of all the possible values for SetROP2. Try a few others until you get what you want.

    chem

    Visual Studio 6, Visual Studio.NET 2005, MASM

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