Form2.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. namespace XqMainFrame
  11. {
  12. public partial class Form2 : Form
  13. {
  14. public Form2()
  15. {
  16. InitializeComponent();
  17. }
  18. private void Form2_Load(object sender, EventArgs e)
  19. {
  20. }
  21. private void button1_Click(object sender, EventArgs e)
  22. {
  23. panel2.Controls.Clear();
  24. int l = 30;
  25. int l1 = l + 1;
  26. long stime = DateTime.Now.Ticks;
  27. for (int i = 0; i < 30; i++)
  28. {
  29. for (int j = 0; j < 30; j++)
  30. {
  31. UserControl1 aa = new UserControl1();
  32. aa.Size = new Size(l, l);
  33. aa.Location = new Point(i * l1, j * l1);
  34. panel2.Controls.Add(aa);
  35. }
  36. }
  37. long etime = DateTime.Now.Ticks;
  38. long diff = etime - stime;
  39. textBox1.Text = diff.ToString();
  40. }
  41. private void button2_Click(object sender, EventArgs e)
  42. {
  43. panel2.Controls.Clear();
  44. int l = 30;
  45. int l1 = l + 1;
  46. long stime = DateTime.Now.Ticks;
  47. for (int i = 0; i < 30; i++)
  48. {
  49. for (int j = 0; j < 30; j++)
  50. {
  51. TEntityControl aa = new TEntityControl();
  52. aa.BackColor = Color.Blue;
  53. aa.Size = new Size(l, l);
  54. aa.Location = new Point(i * l1, j * l1);
  55. panel2.Controls.Add(aa);
  56. }
  57. }
  58. long etime = DateTime.Now.Ticks;
  59. long diff = etime - stime;
  60. textBox1.Text = diff.ToString();
  61. }
  62. }
  63. }