C# Windows Forms Help

Started by
4 comments, last by jpetrie 16 years, 1 month ago
Well hopefully the title got you guys in here, but this isn't the blatant cheating that it looks like. Basically, I'm making some relatively simple games in Windows Forms for a philosophy assignment. The problem is that while I can figure out the basics, I'm really not familiar with WF and this assignment is due tomorow so my procrastinating ass does not have too much time to do research. So when I encounter something I don't know I'll search google if I can but if I can't find it I'll post it here and hopefully you guys have some answers. So my first question is: Is it possible setoff a button's click event when it's visibility is set to hidden? And if so how? Thanks! [Edited by - Menace2Society on March 4, 2008 1:02:23 PM]
Advertisement
You'll actually find the title probably keeps people away. The Forum FAQ says
Quote:
Do not ask homework related questions. The Gamedev.net members are not here to answer your homework questions, its against the forum rules and few people take kindly to it. Besides, we shouldn't need to tell you that figuring it out for yourself will be way more beneficial to you in the long run. Still not sure how to get your question across? Then read this.
Yes. It's possible if you make a class derived from Button so that you can get access to the protected OnClick method.

But why do you want to click when the visibility changes? That seems really strange to me. Why can't you just hook the VisibileChanged event?
Quote:Original post by Nypyren
Yes. It's possible if you make a class derived from Button so that you can get access to the protected OnClick method.

But why do you want to click when the visibility changes? That seems really strange to me. Why can't you just hook the VisibileChanged event?


What I meant is if it's possible, when a button's visibility is set to Hidden, to still click the spot where the button is so that it executes whatever code I have in the Click event.
Quote:Original post by namingway
You'll actually find the title probably keeps people away. The Forum FAQ says
Quote:
Do not ask homework related questions. The Gamedev.net members are not here to answer your homework questions, its against the forum rules and few people take kindly to it. Besides, we shouldn't need to tell you that figuring it out for yourself will be way more beneficial to you in the long run. Still not sure how to get your question across? Then read this.


Oh
Quote:
What I meant is if it's possible, when a button's visibility is set to Hidden, to still click the spot where the button is so that it executes whatever code I have in the Click event.

No.

You will need to perform this from the container of the button (e.g., the form). Attach a method to the form's click event, obtain the mouse position, and see if that mouse position is inside the button's bounding rectangle.

I would advise you to examine the MSDN pages for Form and Button members, which will help get you moving in the proper direction regarding which specific properties and methods you'll want to look at to implement this.

This question is specific and directed enought to be permissable so long as nobody provides him code that solves the problem completely for him.

This topic is closed to new replies.

Advertisement