System.Drawing.Drawing2D.GraphicsPath myGraphicsPath = new System.Drawing.Drawing2D.GraphicsPath();
//確定一個字符串,該字符串就是控件的形狀
string stringText = "Do you know who is xiaopeng?";
//確定字符串的字體
FontFamily family = new FontFamily("宋體");
//確定字符串的風格
int fontStyle = (int)FontStyle.Bold;
//確定字符串的高度
int emSize = 35;
//確定字符串的起始位置,它是從控件開始計算而非窗體
PointF origin = new PointF(0, 0);
//一個StringFormat對象來確定字符串的字間距以及對齊方式
StringFormat format = new StringFormat(StringFormat.GenericDefault);
//用AddString方法創建字符串
myGraphicsPath.AddString(stringText, family, fontStyle, emSize, origin, format);
//將控件的Region屬性設置爲上面創建的GraphicsPath對象
this.Region = new Region(myGraphicsPath);