i have this non rectangular window (spline-shaped) :
using System;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Drawing2D;
namespace Guitar
{
class GuitarForm : Form
{
Bitmap bmp;
GuitarForm()
{
bmp = new Bitmap("C:\\ok.jpg");
GraphicsPath gp = new GraphicsPath();
Point[] curves = new Point[]{
new Point(93,99), new Point(200, 55),
new Point(328, 128),new Point(450,100),new Point(560,200),
};
gp.AddCurve(curves);
gp.AddLine(560,200, 560, 500);
gp.AddLine(560, 500, 93, 500);
gp.AddLine(93, 500, 93, 99);
gp.CloseFigure();
this.Region = new Region(gp);
}
protected override void OnPaint(PaintEventArgs ea)
{
base.OnPaint(ea);
Graphics g = ea.Graphics;
g.DrawImage(bmp, new Point(0, 0));
Rectangle scaled = new Rectangle(20, 20, 60, 60);
g.DrawImage(bmp,scaled);
g.DrawRectangle(Pens.Red, scaled);
Point[] pGram = new Point[]{
new Point(50, 10),
new Point(100, 30),
new Point(20, 100),
};
g.DrawImage(bmp, pGram);
}
public static void Main()
{
Application.Run(new GuitarForm());
}
private void InitializeComponent()
{
this.SuspendLayout();
this.ClientSize = new System.Drawing.Size(560, 560);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "GuitarForm";
this.ResumeLayout(false);
}
}}
the problem is that when i run it, only one part of the window appears and i have to drag to brders in order to see the whole shape . Is there any way it can run all-ready sized the way i want it ?