Select Categories Below
Advertisement
Start Your Own Q&A Site
Create your own Q&A site easily, allowing you to quickly grow a new community around any subject matter or generate new organic traffic for your existing website.
Status: Closed Points: 75 Time: 15:21 - Apr 14, 2009
yasernabai
I have a windows form with a button on it. I want that when I click the button, program waits until I clicked on a point on the form. It is important that the program must wait. Thanks
Categories:
Add Categories
When adding more than one category, separate them with commas.
Mason
Date:: Apr 16, 2009
Time:: 09:26
What Programming language ?
Date:: Apr 17, 2009
Time:: 09:08
Vsual Studio 2005 - C#
demausdauth
Date:: Jul 21, 2009
Time:: 18:19
so when you click the button you start some processing, and then immediately suspend the processing and at the same time you want to wait to see if the user clicks on the form someplace? to do what then? continue the processing or do something else?
Date:: Nov 19, 2009
Time:: 15:39
Excuse me for my late. Suppose that I want to receive some points by clicking on the form and after receiving all of them I want to show a polygon resulted from connecting them. I want that program waits until at least 3 points have been selected by user on the form.
vinagrito
Date:: Mar 15, 2010
Time:: 06:08
The whole "wait" is purely user perception.Just create a bool flag that activates after you press the button. namespace WindowsFormsApplication2 { public partial class Form1 : Form { List<Point[]> FinalPoints; List<Point> NeededPoints; public Form1() { InitializeComponent(); NeededPoints = new List<Point>(); FinalPoints = new List<Point[]>(); } bool StartFlag; Graphics grph; private void MainButton_Click(object sender, EventArgs e) { if (MainButton.Text == "Start") { StartFlag = true; MainButton.Text = "Stop"; } else { StartFlag = false; MainButton.Text = "Start"; } } private void Form1_MouseClick(object sender, MouseEventArgs e) { if (StartFlag) { NeededPoints.Add(new Point(e.X, e.Y)); this.Invalidate(new Rectangle(new Point(0, 0), new Size(this.Width, this.Height - MainButton.Height))); } } private void Form1_Paint(object sender, PaintEventArgs e) { Point[] SelPoints; if (NeededPoints.Count > 2) { grph = this.CreateGraphics(); SelPoints = NeededPoints.ToArray(); FinalPoints.Add(SelPoints); foreach (Point[] ThreePoints in FinalPoints) { grph.DrawPolygon(Pens.Tomato, ThreePoints); } NeededPoints.Clear(); } } } }
vinagrito1
Time:: 06:14
The "wait" thing is purely user perception.Create a bool flag that activates after you click the button....the drawing happens only if the flag is activated and you have the amount of needed points...namespace WindowsFormsApplication2 { public partial class Form1 : Form { List<Point[]> FinalPoints; List<Point> NeededPoints; public Form1() { InitializeComponent(); NeededPoints = new List<Point>(); FinalPoints = new List<Point[]>(); } bool StartFlag; Graphics grph; private void MainButton_Click(object sender, EventArgs e) { if (MainButton.Text == "Start") { StartFlag = true; MainButton.Text = "Stop"; } else { StartFlag = false; MainButton.Text = "Start"; } } private void Form1_MouseClick(object sender, MouseEventArgs e) { if (StartFlag) { NeededPoints.Add(new Point(e.X, e.Y)); this.Invalidate(new Rectangle(new Point(0, 0), new Size(this.Width, this.Height - MainButton.Height))); } } private void Form1_Paint(object sender, PaintEventArgs e) { Point[] SelPoints; if (NeededPoints.Count > 2) { grph = this.CreateGraphics(); SelPoints = NeededPoints.ToArray(); FinalPoints.Add(SelPoints); foreach (Point[] ThreePoints in FinalPoints) { grph.DrawPolygon(Pens.Tomato, ThreePoints); } NeededPoints.Clear(); } } } }
Date:: Mar 16, 2010
Time:: 06:15
Thanks, your program works excellent, but suppose that there are other buttons. What which I really mean from "wait" is that other buttons preforms no action before clicking all of the points. I can do this by making their Enable property to false. But it is not appropriate in my application. I want that all of the keys and menus be active and their enabled property be true but they perform no task during the entering points. Thanks again
Time:: 20:34
You got me all confused with what you're trying to achieve. " What which I really mean from "wait" is that other buttons preforms no action before clicking all of the points ".You have complete power on what should happen when any button is pressed.In the code I gave you, you could add any other button and still execute some other actions regardless of what's happening with the form redrawing.Please explain yourself with a concrete example,maybe that way I'll be able to provide some useful help.. Daniel
Date:: Apr 13, 2010
Time:: 15:17
Thanks Daniel, you are right using StartFlag in your code I can prevent other controls to do any action. For example if I have a button called FillButton its even handler is as below: private void FillButton_Click(object sender, EventArgs e) { if (!StartFlag) { // Do Something } } Thanks again
ainizi
Date:: Dec 28, 2010
Time:: 10:42
Well, I’m sorry I can't understand so complicated VB words, but if you have internet connection problems, you can try the software tuneup360, which is really helpful~~
Time:: 10:43
I’m not sure what you are talking about, but if you have computer problems or internet connection is very slow, you can try a software tuneup360, it's really helpful~~
Question Answered
This question has been closed, and points have been rewarded to the following experts:
You're welcome however to comment or give additional information or if you wish, you have the ability to write a Tutorial in the Tutorial Area.
Answer this Question
New User
Email:
Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address
Registered User
Username:
Password:
Forgot Your Password?
Enter your email address below and we will resend your login information to you.
Login Information Sent
Questions
whats the best food to eat during midnight?
How to identify the tiffany jewelry? www.tffanycheapmall.com.
Send an email alert to each user of the php application based on criteria
How I Increased My AdSense Earnings?
how to choose the lady dress ?
How can I fulfill the minimum requirement to make your computer support 3D?
You have 100 characters to use
Rank
Expert
Points
1.
10354
2.
6493
3.
5596
4.
4848
5.
3487
6.
2840
7.
2770
8.
2303
9.
1820
10.
917
Register today to share your knowledge with the community and be recognized and rewarded for your contributions.
Register Here
"Psst, Quomon is a great site. Pass it on." Tell a Friend | Link To Us | Save to Delicious | Digg it
Language Options
English:
Español:
Sponsors
Questions and Answers Software