C # methods for loading the interface,
1.
Event Delegate Method
Object: Main form: FrmMain loading form: FrmLoading
Ideas:
Display the form FrmLoading before loading the main form. When the main form is loaded (the first time displayed), disable FrmLoading.
C # The Code is as follows:
Using System;
Using System. Collections. Generic;
Using System. ComponentModel;
Using System. Data;
Using System. Drawing;
Using System. Linq;
Using System. Text;
Using System. Windows. Forms;
Using System. Threading;
Namespace CDemoTest
{
Public partial class FrmMain: Form
{
Private FrmLoading loadForm;
Public FrmMain ()
{
// Create a loading form loadForm = new FrmLoading ();
// Specify the event when the form is loaded
This. Shown + = FrmLoading_Close;
LoadForm. Show ();
// Main form Initialization Method
InitializeComponent ();
}
// Declare and close the method for loading the form
Private void FrmLoading_Close (object sender, EventArgs e)
{
LoadForm. Close ();
}
Private void FrmMain_Load (object sender, EventArgs e)
{
Thread. Sleep (3000 );
}
}
}
2.
1. In the Main method, the startup screen is displayed first. Use Show instead of ShowDialog.
2. Then follow the normal method, Application. Run (mainForm );
3. Start the loading thread in the mainForm constructor.
4. Set a flag in mainForm. If loading is complete, set the flag to a value.
5. Use the form as the startup screen. Check the flag in mainForm. If the main form is loaded, close it by yourself.
I think the method is better. record 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.
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.