There is a method that creates text fields with specified parameters.
private void SetTextBox(int positionX, int positionY, string txtText) { TextBox txt = new TextBox(); txt.Location = new Point(positionX, positionY); txt.Size = new Size(200, 15); txt.BorderStyle = BorderStyle.None; txt.ForeColor = Color.FromArgb(176, 178, 183); txt.BackColor = Color.FromArgb(240, 240, 240); FontFamily fontFamaly = new FontFamily(System.Drawing.Text.GenericFontFamilies.SansSerif); txt.Font = new Font("Verdana", 16.5f, FontStyle.Italic); Pen pen = new Pen(Color.FromArgb(57,54,56)); txt.CreateGraphics().DrawLine(pen, Convert.ToSingle(positionX), Convert.ToSingle(positionY + txt.Size.Height), Convert.ToSingle(positionX + txt.Size.Width), Convert.ToSingle(positionY + txt.Size.Height)); txt.Text = txtText; Controls.Add(txt); } In simple words, it is a text field that coincides in color with the color of the form window and contains an informational text on it. You need to draw a line on the lower border of the Textbox, above which will be this information text. I tried to draw immediately using
txt.CreateGraphics().DrawLinе... but nothing comes out (the line does not appear).
Can anyone give good advice?