C # WinFrom cross-thread access control,
1. Cross-thread access control delegation and Class Definition
Using System; using System. windows. forms; namespace ahwildlife. utils {// <summary> /// delegate to the Cross-thread access control /// </summary> public delegate void InvokeDelegate (); /// <summary> /// cross-thread access control class /// </summary> public class InvokeUtil {/// <summary> // cross-thread access control // /</summary> /// <param name = "ctrl"> Form object </param> /// <param name = "de"> DeleGate </param> public static void Invoke (Control ctrl, delegate de) {if (ctrl. isHandleCreated) {ctrl. beginInvoke (de );}}}}View Code
2. How to Use
In the thread method of the Form1.cs file:
InvokeDelegate finished = delegate () {button4.Enabled = false; button5.Enabled = false; button6.Enabled = false; button7.Enabled = false; button8.Enabled = false;}; InvokeUtil. Invoke (this, callback );View Code
In the C language, what is the symbol (->) and how to use it?
This is a symbol in the struct pointer. Write a program to explain it, for example:
# Include <stdio. h>
Struct STU // define a struct
{
Int num;
} Stu;
Int main ()
{
Struct STU * p; // defines a struct pointer.
P = stu; // p points to the struct variable stu.
Stu. num = 100; // attaches an initial value to the struct member num.
Printf ("% d", p-> num); // output the num value in stu
Return;
}
As you can see, the-> method is to reference the variable in the struct !!
Format: p-> struct member (such as p-> num)
The function is equivalent to stu. num or (* p). num.
I don't know. You don't understand, and don't understand call me. O (∩ _ ∩) O ~
Hope to adopt it.
In the C language, what is the symbol (->) and how to use it?
This is a symbol in the struct pointer. Write a program to explain it, for example:
# Include <stdio. h>
Struct STU // define a struct
{
Int num;
} Stu;
Int main ()
{
Struct STU * p; // defines a struct pointer.
P = stu; // p points to the struct variable stu.
Stu. num = 100; // attaches an initial value to the struct member num.
Printf ("% d", p-> num); // output the num value in stu
Return;
}
As you can see, the-> method is to reference the variable in the struct !!
Format: p-> struct member (such as p-> num)
The function is equivalent to stu. num or (* p). num.
I don't know. You don't understand, and don't understand call me. O (∩ _ ∩) O ~
Hope to adopt it.