Click here to Skip to main content
15,911,360 members
Home / Discussions / C#
   

C#

 
AnswerRe: hourglass mouse still clicking Pin
Nader Elshehabi12-Jul-06 22:43
Nader Elshehabi12-Jul-06 22:43 
GeneralRe: hourglass mouse still clicking [modified] Pin
lushgrass13-Jul-06 0:51
lushgrass13-Jul-06 0:51 
AnswerRe: hourglass mouse still clicking [modified] Pin
Nader Elshehabi13-Jul-06 3:08
Nader Elshehabi13-Jul-06 3:08 
GeneralRe: hourglass mouse still clicking Pin
lushgrass13-Jul-06 4:02
lushgrass13-Jul-06 4:02 
GeneralRe: hourglass mouse still clicking Pin
Nader Elshehabi13-Jul-06 10:45
Nader Elshehabi13-Jul-06 10:45 
GeneralRe: hourglass mouse still clicking Pin
lushgrass13-Jul-06 23:44
lushgrass13-Jul-06 23:44 
QuestionRe: hourglass mouse still clicking [modified] Pin
lushgrass16-Jul-06 21:24
lushgrass16-Jul-06 21:24 
AnswerRe: hourglass mouse still clicking Pin
Nader Elshehabi19-Jul-06 21:14
Nader Elshehabi19-Jul-06 21:14 
Hello

In another post you said:

lushgrass wrote:
however this doesnt work either.


What's wrong with it?


lushgrass wrote:
how is your Control solution different from Form.Controls?


What do you mean?? Different in what exactly?


lushgrass wrote:
i'm not able to add MainMenu items to Form.Controls


What does this have to do with your isuue?

lushgrass wrote:
however, there is a this.Capture field. can i use that somehow?


It doesn't matter. Just set the capture of the mouse somewhere.


If you still can't get it to work, try this:

public partial class Form1 : Form
    {
        private delegate void React();

        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Thread MyThread = new Thread(new ThreadStart(MySearchMethod));

            foreach (Control C in this.Controls)
                C.Enabled = false;

            MyThread.Start();
            //Code would fall here before the thread finish, so reactivate in anthoer method
        }

        private void Reactivate()
        {
            foreach (Control C in this.Controls)
                C.Enabled = true;
        }

        private void MySearchMethod()
        {
            int temp = 0;
            while(temp < long.MaxValue)
                temp++;

            Invoke(new React(Reactivate));
            //We have to call this method by Invoke to avoid Cross thread access
        }
    }


I had to reactivate using another method because the code falls directly after the thread start, and it would reactivate everything even if the thread hasn't finished yet -and maybe that was one of your mistakes in the previous approach-.
Also you have to cal the reactivation method by Invoke(), because cross thread access to form controls is denied.

RegardsRose | [Rose]
QuestionDetecting CTL+M Pin
picasso26-Jul-06 19:09
picasso26-Jul-06 19:09 
AnswerRe: Detecting CTL+M Pin
stancrm6-Jul-06 20:17
stancrm6-Jul-06 20:17 
QuestionHow can I populate a treeView from a database? Pin
AngryC6-Jul-06 18:59
AngryC6-Jul-06 18:59 
AnswerRe: How can I populate a treeView from a database? Pin
Nader Elshehabi6-Jul-06 21:41
Nader Elshehabi6-Jul-06 21:41 
QuestionGraphics Display Pin
ah_jiang_96-Jul-06 15:30
ah_jiang_96-Jul-06 15:30 
AnswerRe: Graphics Display Pin
Nader Elshehabi6-Jul-06 21:08
Nader Elshehabi6-Jul-06 21:08 
QuestionGraphic display for Tilt Sensor [modified] Pin
ckoehler6-Jul-06 15:03
ckoehler6-Jul-06 15:03 
AnswerRe: Graphic display for Tilt Sensor Pin
Nader Elshehabi6-Jul-06 21:32
Nader Elshehabi6-Jul-06 21:32 
QuestionUsing msbuild for publishing a ClickOnce app... Pin
Raffi NYC6-Jul-06 12:42
Raffi NYC6-Jul-06 12:42 
QuestionHow to prevent encoding in Soap Body Pin
acvishy6-Jul-06 12:19
acvishy6-Jul-06 12:19 
Questionshutdown Pin
erfi6-Jul-06 11:24
erfi6-Jul-06 11:24 
AnswerRe: shutdown Pin
Dan Neely6-Jul-06 11:50
Dan Neely6-Jul-06 11:50 
AnswerRe: shutdown Pin
engsrini6-Jul-06 20:33
engsrini6-Jul-06 20:33 
Questionhow to execute windows mediaplyer Pin
erfi6-Jul-06 11:19
erfi6-Jul-06 11:19 
AnswerRe: how to execute windows mediaplyer Pin
Wjousts6-Jul-06 11:58
Wjousts6-Jul-06 11:58 
QuestionSqlRowUpdatedEventHandler question Pin
leckey6-Jul-06 11:03
leckey6-Jul-06 11:03 
AnswerRe: SqlRowUpdatedEventHandler question Pin
led mike6-Jul-06 11:10
led mike6-Jul-06 11:10 

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.