Mikecrosoft
02-04-2004, 03:52 PM
Hi all
I'm trying to make my own irregular resisable window in .NET, but I getting the conclusion that Microsoft not give sufficent help about making irregular forms like MSN Messenger Instant Message Window or Media Player, so if someone knows a good tutorial please send me the link or post it here. I'm so frustrated because my form is very far to be like a MSN IM Window.
Thanks
MIKE
Machaira
02-05-2004, 10:00 AM
Drop a button in the middle of a form, set the form's BorderStyle to None and drop in the following code:
Dim pts(3) As PointF
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
pts(0).X = Me.Width / 2
pts(0).Y = 0
pts(1).X = 0
pts(1).Y = Me.Height / 2
pts(2).X = Me.Width / 2
pts(2).Y = Me.Height
pts(3).X = Me.Width
pts(3).Y = Me.Height / 2
Me.TransparencyKey = Drawing.Color.Magenta
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Close()
End Sub
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
Dim gr As Graphics = Me.CreateGraphics
gr.FillRectangle(Brushes.Magenta, Me.ClientRectangle)
gr.FillPolygon(Brushes.Blue, pts)
gr.DrawPolygon(Pens.Black, pts)
End Sub
To make anything complicated you might try create a graphic of the form as big as the form with the non-interface areas set to the color of the TransparencyKey and setting it as the BackgroundImage.
Mikecrosoft
02-06-2004, 07:40 AM
This post its my way of make my own form, but I have problems on Resizing (to slow and bad controls painting).
http://www.visualbasicforum.com/attachment.php?attachmentid=12813