Sign in to follow this  
Menace2Society

C# Windows Forms Help

Recommended Posts

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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this