I'm new here and I'm trying to find out a way to create my own custom shape in button.
Should I create a class for it? Or an xml file? I need to create a button which it will look like a table. I found this code but its difficult to create it.
Button dynamicButton = new Button();
// Define the points in the polygonal path.
Point[] pts = {
new Point( 20, 60),
new Point(140, 60),
new Point(140, 20),
new Point(220, 100),
new Point(140, 180),
new Point(140, 140),
new Point( 20, 140)
};
// Make the GraphicsPath.
GraphicsPath polygon_path = new GraphicsPath(FillMode.Winding);
polygon_path.AddPolygon(pts);
// Convert the GraphicsPath into a Region.
Region polygon_region = new Region(polygon_path);
// Constrain the button to the region.
dynamicButton.Region = polygon_region;
// Make the button big enough to hold the whole region.
dynamicButton.SetBounds(
dynamicButton.Location.X,
dynamicButton.Location.Y,
pts[3].X + 5, pts[4].Y + 5);
Controls.Add(dynamicButton);