Help me with that CrossThread?

前端 未结 3 1142
小鲜肉
小鲜肉 2020-12-22 06:49

This code is executed by many way. When it\'s executed by the form button it works (the button start a thread and in the loop it call this method = it works). BUT it doesn\'

3条回答
  •  我在风中等你
    2020-12-22 07:26

    You need write this:

    if ( this.form.InvokeRequired ) {
        this.form.Invoke( ...... );
        return;
    }
    this.form.Size = new Sizte( ... );
    

    OR

    if ( this.form.InvokeRequired ) {
        this.form.Invoke( ...... );
    }
    else {
        this.form.Size = new Sizte( ... );
    }
    

提交回复
热议问题