Click here to Skip to main content
15,889,034 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to create a triangular shaped textbox in winforms using graphics path of Drawing2D
Posted
Comments
Zoltán Zörgő 8-Apr-13 5:14am    
"triangular shaped textbox"?! nice :) I am really curious...
yeshgowda 8-Apr-13 5:27am    
Yes actually iam trying out from morning how to do because as there is no method like addTriangle how to acheive this.as this was question asked in one interview place.as i couldn't able to answer this hence i was excited how to acheive this?

private void Form1_Load(object sender, EventArgs e)
{
System.Drawing.Drawing2D.GraphicsPath myGraphicsPath = new
System.Drawing.Drawing2D.GraphicsPath();
//myGraphicsPath.AddEllipse(new Rectangle(0, 0, 500, 700));
myGraphicsPath.AddLine(10,20,30,40);
//myGraphicsPath.AddEllipse(new Rectangle(75, 75, 20, 20));
//myGraphicsPath.AddEllipse(new Rectangle(120, 0, 125, 125));
//myGraphicsPath.AddEllipse(new Rectangle(145, 75, 20, 20));
//Change the button's background color so that it is easy
//to see.
textBox1.BackColor = Color.Chartreuse;
textBox1.Size = new System.Drawing.Size(256, 256);
textBox1.Region = new Region(myGraphicsPath);
}
Zoltán Zörgő 8-Apr-13 13:22pm    
This might be interesting: http://stackoverflow.com/questions/3483215/wpf-custom-shape-control (read comments too). But it is not looking how I have imagined it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900