Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Image Control Within a Custom UserContol

Status
Not open for further replies.

svagelis

Programmer
May 2, 2001
121
0
0
GR
What i m trying to do is to create a control (a button ) with transparent regions. Like the ones in Asymetrix toolbook. If i put a standard image control over my form and set a picture to it (transparent gif) i get the job done. Ok So far
Put the above into a new UserControl To extend image control's functions.
1. Create a UserControl
2. Set BackStyle of it (UserControl) to Transparent
3. Create a New Image Control
4. Set a Picture (transparent gif) to picture proprety of image control
Done and the new User control looks ok (transarency works fine)

when i add my UserControl on my form i observe the following
1. The region of the ImageControl inside the Usercontrol losses it transparency and it has the color of the backcolor property of the UserControl
2. The remaining region retains it transparency

Does anyone knows how to solve this or any alternative? Any king of help would be great.
 
svagelis,

In your user control code module, insert this code:

Put this line in the InitChanged event:
UserControl.BackColor = Ambient.BackColor

Put this code in the AmbientChanged event:
If PropertyName = "BackColor" Then
UserControl.BackColor = Ambient.BackColor
End If

Hope this helps!
Josh
 
Sorry, I meant the InitProperties event not InitChanged.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top