CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Apr 2009
    Posts
    1,355

    [VB2010] - the big question: can i put the usercontrol realy transparent?

    i have code for put the usercontrol transparent. but stills be a false transparent. because the control is 'hided'(without an image) and you see what is on back, but you can't click on back controls
    can anyone advice me, please?
    (i can share the code... but isn't a real transparency)

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: [VB2010] - the big question: can i put the usercontrol realy transparent?

    You have to show us a code sample, which is not hard. Copy/Paste into the reply and hit the # (code) tags. Or else add CODE \tags
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: [VB2010] - the big question: can i put the usercontrol realy transparent?

    Transparent means that you can see through it, not that you can click through it. Sounds like it may be working the way it should. It the control has nothing to display then you could move it to the background and bring the control you want to be clickable to the foreground.

    If this is not what you are talking about then please explain in a bit more detail.
    Always use [code][/code] tags when posting code.

  4. #4
    Join Date
    Apr 2009
    Posts
    1,355

    Re: [VB2010] - the big question: can i put the usercontrol realy transparent?

    Quote Originally Posted by DataMiser View Post
    Transparent means that you can see through it, not that you can click through it. Sounds like it may be working the way it should. It the control has nothing to display then you could move it to the background and bring the control you want to be clickable to the foreground.

    If this is not what you are talking about then please explain in a bit more detail.
    i'm sorry... for me Transparent is what you see thro(is right writed?) control and you can 'play' with other controls that are back
    is what i needdglienna: heres my code(but doesn't work for what i need
    Code:
    Private Const WS_EX_TRANSPARENT As Int32 = &H20
    
        Public Sub New()
            MyBase.New()
    
            InitializeComponent()
    
            Me.SetStyle(ControlStyles.SupportsTransparentBackColor, True)
            Me.UpdateStyles()
            Me.BackColor = Color.Transparent
        End Sub
    
        Protected Overrides ReadOnly Property CreateParams() As CreateParams
            Get
                Dim cp As CreateParams = MyBase.CreateParams
                cp.ExStyle = cp.ExStyle Or WS_EX_TRANSPARENT
                Return cp
            End Get
        End Property
    
        Protected Overrides Sub OnPaintBackground(ByVal e As PaintEventArgs)
            'put the code here for draw an image(transparent or not)
        End Sub
    you can see thro the control, but it's a parent copy image
    you can't use the controls that are on back
    i need advice please
    Last edited by Cambalinho; January 29th, 2013 at 05:49 AM.

  5. #5
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: [VB2010] - the big question: can i put the usercontrol realy transparent?

    As I said Transparent means see through. You other assumption about being able to click controls that are behind it is just incorrect and has nothing to do with transparency.

    You can shift the zorder of the controls to bring the one you want to use to the foreground or you can set the control in question to not be visible and then you can click on the control behind it but so long as your control is in front and has a visible setting of true then you can not click on anything that is behind it unless of course the control behind it is larger and you click on an area that is not covered up by the front control
    Always use [code][/code] tags when posting code.

  6. #6
    Join Date
    Apr 2009
    Posts
    1,355

    Re: [VB2010] - the big question: can i put the usercontrol realy transparent?

    Quote Originally Posted by DataMiser View Post
    As I said Transparent means see through. You other assumption about being able to click controls that are behind it is just incorrect and has nothing to do with transparency.

    You can shift the zorder of the controls to bring the one you want to use to the foreground or you can set the control in question to not be visible and then you can click on the control behind it but so long as your control is in front and has a visible setting of true then you can not click on anything that is behind it unless of course the control behind it is larger and you click on an area that is not covered up by the front control
    so you mean that VB2010 Transparency is only for see through(thanks for the word... i'm portuguese) and not use the controls.
    "You other assumption about being able to click controls that are behind it is just incorrect and has nothing to do with transparency." then tell me something for work. if isn't transparency, then what is?(in VB6 is more easy lol)

  7. #7
    Join Date
    Feb 2013
    Location
    Canada
    Posts
    52

    Re: [VB2010] - the big question: can i put the usercontrol realy transparent?

    Quote Originally Posted by DataMiser View Post
    As I said Transparent means see through. You other assumption about being able to click controls that are behind it is just incorrect and has nothing to do with transparency.
    Actually this is wrong. Take this code for example:
    Code:
    Me.TransparencyKey = Color.Fuchsia
    Me.BackColor = Color.Fuchsia
    Inside the main Form class, assign this code to a button click or something. Then while you can see through the form as the control's container, you can definitely click things "behind" this "transparent" object.

  8. #8
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: [VB2010] - the big question: can i put the usercontrol realy transparent?

    I did tell you already. You can change the order so that the control you want to click is the one in front or you can set the visible property to false on the control in front so it will not be blocking the one behind. It is the same in VB6 so not sure what you mean about it being easier in VB6.
    you can always only click on the control that is in the front in either language.
    Always use [code][/code] tags when posting code.

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