/// <summary> /// 清理所有正在使用的资源。 /// </summary> /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param> protected override void Dispose(bool disposing) { if (bmp != null) { bmp.Dispose(); bmp = null; } if (g != null) { g.Dispose(); g = null; } if (textBox1 != null) { textBox1.Dispose(); textBox1 = null; } try { base.Dispose(disposing); } catch (System.Exception) { } System.GC.Collect(); }
private void InitTextBox() { textBox1 = new DateTimePickerEx(); //textBox1.Handle; textBox1.Anchor = ((AnchorStyles)((((AnchorStyles.Top | AnchorStyles.Bottom) | AnchorStyles.Left) | AnchorStyles.Right))); textBox1.BackColor = Color.White; //textBox1.BorderStyle = BorderStyle.None; textBox1.Font = new Font("微软雅黑", 9F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(134))); textBox1.Location = new Point(4, 3); textBox1.Name = "textBox1"; //textBox1.ScrollBars = ScrollBars.Vertical; textBox1.Size = new Size(Width-6, 16); textBox1.TabIndex = 0; //textBox1.WordWrap = false; textBox1.MouseLeave += new EventHandler(textBox1_MouseLeave); textBox1.MouseEnter += new EventHandler(textBox1_MouseEnter); textBox1.KeyDown += new KeyEventHandler(textBox1_KeyDown); Controls.Add(textBox1); }