Click here to Skip to main content
15,906,106 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I want to make any object(picturebox,panel...) in c# invisible,but I also want to get when that same object is clicked.
Posted
Comments
Shahin Khorshidnia 18-Mar-12 19:42pm    
The question is, how can you click on an invisible control?!
Sergey Alexandrovich Kryukov 18-Mar-12 23:41pm    
Right,
--SA
vikas 928 23-Oct-12 1:27am    
This is not right because u can't click on a invisible object....

AFAIK, it can't be done. If you make the object invisible then it can't be clicked by definition.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 18-Mar-12 23:41pm    
Of course. A 5.
--SA
As others already said, it is not possible, but you can bypass it by making the button with a good camouflage:
using a user-defined control and setting no text, no rands and the background to the same color of the application
using a button with a bmp of the same color as the application
and things like that.

But if you use the setting visible = false, then... forget about clicking on it.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 18-Mar-12 23:44pm    
Not that it's wrong, it's pretty much excessive and practically useless: if OP fails to understand such simple thing as inability to click an invisible control, how can you say it's really needed? One could be even less sure what's your workaround for?
--SA
Nelek 19-Mar-12 19:20pm    
I didn't say that was needed. I understand your point, but one can not be sure what the OP wants.
About my workaround... is the one of the ways used to do "not visible but clickable" buttons on SCADA systems. I.e. it is quite usual to find such things in HMI-Panels of an industry line, some not visible but clickable buttons that pressed in a concrete order brings up the programmer-settings page, or things like that (no mouse and not multi-touch, you can only press at one place at once)

Edit: Just in case... many times are customer desires, so that the maintenance people still have, what they are used to from older technologies.
Sergey Alexandrovich Kryukov 20-Mar-12 1:49am    
I also don't think is a good design. If some element is invisible, there is always some visible element immediately under the mouse cursor, it should take the events.

I actually avoid to answer when it's not clear what OP wants. I don't think it worth wasting time on it. I would rather prefer to advise on something OP did not think at all but what could be useful in my opinion. In other words, just giving not directly related advice would be more useful then answering the a question which may make no sense. After all, the final goal is the help, not answer, isn't it?

--SA
Nelek 21-Mar-12 5:10am    
You are right, but that something is not optimal or a good design, doesn't mean is not possible. As I said, I don't like it, but sometimes is the only way I can achieve it or the customer want it just like that.
Sergey Alexandrovich Kryukov 21-Mar-12 21:11pm    
I prefer not doing evil... :-)
Often the customers admit right thing, they just need careful explanation...
--SA
How we return a sql table object through web services using j query.....
(table directly giving to grid view data source)
 
Share this answer
 
I've found a way,I needed to create a transparent panel,if you want take a look on how to do it:
http://stackoverflow.com/questions/1234999/transparency-problem-by-overlapped-pictureboxs-at-c-sharp[^]
 
Share this answer
 
Comments
Shahin Khorshidnia 19-Mar-12 6:03am    
Good for ye :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900