| |

VerySource

 Forgot password?
 Register
Search
View: 627|Reply: 4

Trouble, please help me.

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-1-22 22:40:01
| Show all posts |Read mode
Want to use c # to display a new application window under .net and hide the previous window

Previously doing this under vc
CDialogDlg dlg = new CDialogDlg;
this-> ShowWindow (SW_HIDE);
dlg.DoModal ();

I just learned to use .net and would like to know how to do the same in Form1 to create an existing class Form2 and hide the former Form1

Troublesome prawns pointing
Reply

Use magic Report

0

Threads

46

Posts

23.00

Credits

Newbie

Rank: 1

Credits
23.00

 United States

Post time: 2020-2-5 22:15:01
| Show all posts
Form2.ShowDialog ();
Reply

Use magic Report

0

Threads

56

Posts

21.00

Credits

Newbie

Rank: 1

Credits
21.00

 China

Post time: 2020-2-5 23:45:01
| Show all posts
Form2 frm = new Form2 ();
frm.Show ();
Form1.Hide ();
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2020-2-6 14:00:01
| Show all posts
There is a doubt. .Net has a garbage collection mechanism. I generated form2 under the btn event, so after I clicked btn, form2 disappeared after a flash. . . . . . . .
Reply

Use magic Report

0

Threads

15

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

Post time: 2020-2-14 17:45:02
| Show all posts
this.Hide (); // hide itself first
Form2 frm = new Form2 ();
frm.ShowDialog (); // Show Form2
this.Show () // After Form2 is off, show yourself again

The garbage collection mechanism works according to the remaining amount of your system memory. If the memory is large enough, it basically does not collect anything.
People who have seen the MS VB.NET development team said before: If you really want to see the GC work, you can feel it by inserting 128M
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list