I created a new UserControl
in the designer I added a richTextBox. Then I did in the UserControl
constructor:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ScrollLabelTest
{
public partial class ScrollText : UserControl
{
Font drawFonts1 = new Font("Arial", 20, FontStyle.Bold, GraphicsUnit.Pixel);
Point pt = new Point(50, 50);
public ScrollText()
{
InitializeComponent();
System.Drawing.Font f = new System.Drawing.Font("hi",5);
Graphics e = richTextBox1.CreateGraphics();
e.DrawString("hello",drawFonts1,new SolidBrush(Color.Red),pt);
this.Invalidate();
}
}
}
Then I dragged the new UserControl
into the form1
designer but it's empty. I don't see the word "hello".