Results 1 to 7 of 7

Thread: Transparent User Control

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2003
    Location
    UK, Wales
    Posts
    9

    Question Transparent User Control

    Hi all,

    My problem is this, is it possible to set the background colour of the form within a user control to transparent as there is on opacity property and the TransparentKey function doesn't work. Can anyone help.

    Thanks In Advance

    ICE32 - "Lee"

  2. #2
    Frenzied Member MrGTI's Avatar
    Join Date
    Oct 2000
    Location
    Ontario, Canada
    Posts
    1,277

    Smile

    Instead of trying to explain it, take a look at the comments i have in my sample app:
    VB Code:
    1. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    2.         'Set the Form.TransparencyKey property to the same as the colour you want to disappear.
    3.         'This tells the form not to paint any pixels that match the color of the TransparencyKey.
    4.  
    5.         'The BackgroundImage property of the form is set to a Bitmap with a colour you want removed.
    6.         'Then the TransparencyKey property is set to the same colour (ie: Color.Lime), then all the pixels in the bitmap
    7.         'that are Lime ( RGB(255,0,0)) will be transparent.
    8.     End Sub
    ~Peter


  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2003
    Location
    UK, Wales
    Posts
    9
    The thing is that this method doesn't work with a user control, there is not TransparentKey property.

    Any other solution would be great

    Thanks In Advance

    Lee

  4. #4
    Frenzied Member MrGTI's Avatar
    Join Date
    Oct 2000
    Location
    Ontario, Canada
    Posts
    1,277
    By user control do you mean a control such as a label?

    There is a transparentcy aspect with controls:

    VB Code:
    1. Private Sub btnMakeTransparent_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMakeTransparent.Click
    2.         'This can be set in the properties window by selecting the Web tab of the backColor property
    3.         lblMakeTransparent.BackColor = System.Drawing.Color.Transparent
    4.     End Sub
    ~Peter


  5. #5

    Thread Starter
    New Member
    Join Date
    Feb 2003
    Location
    UK, Wales
    Posts
    9
    No i mean a user control as in when you go to the project option on the menu and select Add User Control. The web transparence doesn't work either.

    the user control is

    system.windows.forms.usercontrol

    Hope this information helps

    lee

  6. #6
    Frenzied Member MrGTI's Avatar
    Join Date
    Oct 2000
    Location
    Ontario, Canada
    Posts
    1,277

    Unhappy

    ooooooh. That. Yeah,... my bad. You're trying to make a new control.

    I've never tried that. I suspect there must be a way, but i've never seen it. Maybe someone else has seen how to do this?

    Anyone? ...........
    ~Peter


  7. #7

    Thread Starter
    New Member
    Join Date
    Feb 2003
    Location
    UK, Wales
    Posts
    9
    Ok thanks for your attempt. If there is anyone out there that can help please do.

    thanks In Advance

    Lee

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