protected override void OnPaint(PaintEventArgs e) { if (_autoComplete != null && _autoMode != null) { AutoCompleteStringCollection acsc = new AutoCompleteStringCollection(); acsc.AddRange(_autoComplete); box.AutoCompleteCustomSource = acsc; box.AutoCompleteMode = _autoMode; box.AutoCompleteSource = AutoCompleteSource.CustomSource; } shape = new RoundedBorder(Width - 1, Height - 1, _radius).Path; innerRect = new RoundedBorder(Width - 1.5f, Height - 1.5f, _radius, 0.5f, 0.5f).Path; resizeTextBox(); e.Graphics.SmoothingMode = SmoothingMode.HighQuality; Bitmap bmp = new Bitmap(Width, Height); Graphics grp = Graphics.FromImage(bmp); e.Graphics.DrawPath(new Pen(_borderColor, 1), shape); using (SolidBrush brush = new SolidBrush(_bgColor)) e.Graphics.FillPath(brush, innerRect); Transparenter.MakeTransparent(this, e.Graphics); base.OnPaint(e); }
protected override void OnPaint(PaintEventArgs e) { shape = new RoundedRectangleF(Width, Height, radius).Path; innerRect = new RoundedRectangleF(Width - 0.5f, Height - 0.5f, radius, 0.5f, 0.5f).Path; if (box.Height >= Height - 4) { Height = box.Height + 4; } box.Location = new Point(radius - 5, Height / 2 - box.Font.Height / 2); box.Width = Width - (int)(radius * 1.5); e.Graphics.SmoothingMode = SmoothingMode.HighQuality; Bitmap bmp = new Bitmap(Width, Height); Graphics grp = Graphics.FromImage(bmp); e.Graphics.DrawPath(Pens.Gray, shape); using (SolidBrush brush = new SolidBrush(br)) e.Graphics.FillPath(brush, innerRect); Transparenter.MakeTransparent(this, e.Graphics); base.OnPaint(e); }