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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Transparent Image Over Control

Status
Not open for further replies.

KnowledgeSeeker

Programmer
Feb 19, 2002
5
US
I can't find recent info on this so I will see what idea's y'all have. I have many different command control "boxes" on a number of Access 2000 forms, each with different images on them. I would like to put an image with a transparent background on any of the controls as they are selected. For example, I could use a big red check mark as the overlay image. I would want the check mark to display on any of the controls that have been selected. The check mark would show with the original control image underneath it. If they de-select the control, the check mark would go away. I am at a loss as to how to do this. Thanks for your expertise.
 
There a couple ways you could do it.

1. Create a label with the BackStyle Property set to transparent. Find a character that displays a checkmark when displayed in the appropriate font (i.e. Wingdings). Now place the label on top of the command button and set the visible property of the label to false. On the OnClick event of the command button, toggle the visible property of the label (i.e. Label.Visible = Not Label.Visible). You would need to create a label for each command button (unless only one command button can receive the check mark at a time.)

2. Another way to do it is to use a package to create a gif with a transparent background. And then handle the control the same way the label is handled above.
 
Option 1 sounds like a great idea. And, in fact, I was able to toggle the label as listed. Unfortunately, I'm stupid when it comes to knowing how to get the label to display on top of my control and to not be "covered" by the control. And wouldn't I have a problem (and how would I get around it) when the user clicks on the control again (and actually clicks the label)? Thanks again!!
 
What you could do is cover your image and the text box, I discussed previously, with a transparent command button (make sure you "Bring To Front" the command button). So when the user clicked on the image, he/she would be actually clicking on the transparent command button.

What I have done in the past is call a function on the OnMouseDown and OnMouseUp properties of the command button. This function will change the SpecialEffect property of the image control to Lowered/Raised. This way it looks like the image control is the one actually being selected.

Example

Properties for transparent command button:

OnMouseDown =MySpecialEffect([imageControl],2)
OnMouseUp =MySpecialEffect([imageControl],1)

Function to be called:

Public Function MySpecialEffect(ctl As Control, intAction As Integer)

ctl.SpecialEffect = intAction

End Function
 
Another thought. You could have 2 images. One with a big red check mark embedded on the image and another image without the check mark. Then just toggle the images.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top