Click here to Skip to main content
15,879,096 members
Home / Discussions / Windows Forms
   

Windows Forms

 
AnswerRe: Get rid of WaitCursor Pin
BillWoodruff2-Sep-11 2:37
professionalBillWoodruff2-Sep-11 2:37 
AnswerRe: Get rid of WaitCursor PinPopular
Luc Pattyn2-Sep-11 3:18
sitebuilderLuc Pattyn2-Sep-11 3:18 
GeneralRe: Get rid of WaitCursor Pin
Dave Kreskowiak2-Sep-11 4:16
mveDave Kreskowiak2-Sep-11 4:16 
AnswerRe: Get rid of WaitCursor Pin
Luc Pattyn2-Sep-11 4:28
sitebuilderLuc Pattyn2-Sep-11 4:28 
GeneralRe: Get rid of WaitCursor Pin
BillWoodruff2-Sep-11 5:18
professionalBillWoodruff2-Sep-11 5:18 
AnswerRe: Get rid of WaitCursor Pin
Luc Pattyn2-Sep-11 5:39
sitebuilderLuc Pattyn2-Sep-11 5:39 
GeneralRe: Get rid of WaitCursor Pin
BillWoodruff2-Sep-11 19:08
professionalBillWoodruff2-Sep-11 19:08 
GeneralRe: Get rid of WaitCursor Pin
Luc Pattyn3-Sep-11 2:11
sitebuilderLuc Pattyn3-Sep-11 2:11 
Bill, everything has been said, I don't know what to add. Here is the entire class:
C#
using System;
using System.Windows.Forms;

namespace LP_Core {
    public class LP_WaitCursor : IDisposable {
        private Form form;
        public LP_WaitCursor(Form form) {
            this.form=form;
            form.Cursor=Cursors.WaitCursor;
        }
        public void Dispose() {
            form.Cursor=Cursors.Default;
        }
    }
}

It is independent of the actual WinForms application, and needs to be created only once as it belongs in a .NET programmer's toolbox IMO. I use it in every click handler (MenuItem, Button,...) that might take a noticeable amount of time. So there may be hundreds of using(new LP_WaitCursor(this)) statements in a single app, each one replacing a pair of Cursor=... statements.

Smile | :)
Luc Pattyn [My Articles] Nil Volentibus Arduum
modified on Saturday, September 3, 2011 2:34 PM

GeneralRe: Get rid of WaitCursor Pin
GParkings3-Sep-11 12:20
GParkings3-Sep-11 12:20 
GeneralRe: Get rid of WaitCursor Pin
Eddy Vluggen3-Sep-11 13:15
professionalEddy Vluggen3-Sep-11 13:15 
GeneralRe: Get rid of WaitCursor Pin
Luc Pattyn3-Sep-11 13:36
sitebuilderLuc Pattyn3-Sep-11 13:36 
GeneralRe: Get rid of WaitCursor Pin
Eddy Vluggen3-Sep-11 22:43
professionalEddy Vluggen3-Sep-11 22:43 
GeneralRe: Get rid of WaitCursor Pin
BillWoodruff3-Sep-11 19:19
professionalBillWoodruff3-Sep-11 19:19 
GeneralRe: Get rid of WaitCursor Pin
Luc Pattyn4-Sep-11 2:42
sitebuilderLuc Pattyn4-Sep-11 2:42 
GeneralRe: Get rid of WaitCursor Pin
BillWoodruff4-Sep-11 14:21
professionalBillWoodruff4-Sep-11 14:21 
GeneralRe: Get rid of WaitCursor Pin
Luc Pattyn4-Sep-11 14:42
sitebuilderLuc Pattyn4-Sep-11 14:42 
GeneralRe: Get rid of WaitCursor Pin
lukeer4-Sep-11 21:03
lukeer4-Sep-11 21:03 
AnswerRe: Get rid of WaitCursor Pin
Luc Pattyn5-Sep-11 1:29
sitebuilderLuc Pattyn5-Sep-11 1:29 
GeneralRe: Get rid of WaitCursor Pin
MicroVirus5-Sep-11 11:17
MicroVirus5-Sep-11 11:17 
QuestionDeploying Reports Pin
eddieangel30-Aug-11 6:40
eddieangel30-Aug-11 6:40 
AnswerRe: Deploying Reports Pin
army_man7165530-Aug-11 8:00
army_man7165530-Aug-11 8:00 
Questionwindows forms using active directory Pin
dcof24-Aug-11 5:50
dcof24-Aug-11 5:50 
AnswerRe: windows forms using active directory Pin
GenJerDan24-Aug-11 6:16
GenJerDan24-Aug-11 6:16 
GeneralRe: windows forms using active directory Pin
dcof24-Aug-11 11:42
dcof24-Aug-11 11:42 
GeneralRe: windows forms using active directory Pin
GenJerDan25-Aug-11 3:22
GenJerDan25-Aug-11 3:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.