Custom forms design ??

  • Thread starter Thread starter Poppy
  • Start date Start date
P

Poppy

A client of mine has asked if I could create customr forms for him. He does
not want them to be the typical rectangular shape.

Has anyone come across any tools or methods which can achieve this?

I have come across one control which claims to do this but at a hell of a
price !

TIA
 
Poppy said:
A client of mine has asked if I could create customr forms for him.
He does not want them to be the typical rectangular shape.

Have a look at the Scissors class.

;-)

No, not really - but what you can do is...
Has anyone come across any tools or methods which can achieve
this?

....assign a region to the Form's region property:

Dim gp As New System.Drawing.Drawing2D.GraphicsPath
gp.AddEllipse(Me.ClientRectangle)
Me.Region = New Region(gp)
gp.Dispose()
 
This is possible using default .NET, so no other components are needed.
Check out following code:

Private Sub GDIPlus_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim myGraphicsPath As New Drawing.Drawing2D.GraphicsPath()

myGraphicsPath.AddString("Hello!", New Drawing.FontFamily("Trebuchet
MS"), _
Drawing.FontStyle.Bold, 100, New Drawing.PointF(10, 50),
Drawing.StringFormat.GenericDefault)
myGraphicsPath.AddRectangle(New Drawing.Rectangle(0, 0, 1000, 30))

Me.Region = New Drawing.[Region](myGraphicsPath)

End Sub

Protected Overrides Sub OnPaint(ByVal e As
System.Windows.Forms.PaintEventArgs)
Dim myGraphicsPath As New Drawing.Drawing2D.GraphicsPath()

Dim rect As Rectangle = New Rectangle(10, 30, 600, 100)
Dim linGrBrush As System.Drawing.Drawing2D.LinearGradientBrush = New
System.Drawing.Drawing2D.LinearGradientBrush( _
rect, Color.Red, Color.Blue,
System.Drawing.Drawing2D.LinearGradientMode.Horizontal)

e.Graphics.FillRectangle(linGrBrush, rect)

End Sub

Source:
http://www.dotnet247.com/247reference/msgs/22/113187.aspx



--
Greetz

Jan Tielens
________________________________
Read my weblog: http://weblogs.asp.net/jan
 
Hi Poppy,

Worked at by Herfried, Fergus and Cor

\\\
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim g As New System.Drawing.Drawing2D.GraphicsPath
g.AddString( _
"Poppy", _
System.Drawing.FontFamily.GenericSansSerif, _
System.Drawing.FontStyle.Bold, _
200, _
New Point(0, 0), _
System.Drawing.StringFormat.GenericDefault _
)
Me.BackColor = Color.Red
Me.Region = New System.Drawing.Region(g)
g.Dispose()
Me.AutoScaleBaseSize = New System.Drawing.Size(0, 0)
Me.ClientSize = New System.Drawing.Size(800, 800)
Button1.BackColor = System.Drawing.SystemColors.ActiveCaptionText
Button1.ForeColor = System.Drawing.Color.Red
Button1.Location = New System.Drawing.Point(50, 40)
Button1.Size = New System.Drawing.Size(20, 20)
Button1.Text = "X"
End Sub
Private Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Me.Close()
End Sub
///

I hope this helps a little bit?

Cor
 
* "Poppy said:
A client of mine has asked if I could create customr forms for him. He does
not want them to be the typical rectangular shape.

Has anyone come across any tools or methods which can achieve this?

I have come across one control which claims to do this but at a hell of a
price !

\\\
Me.FormBorderStyle = FormBorderStyle.None
Me.Height = 300
Me.Width = 400
Dim p As New Drawing2D.GraphicsPath()
p.StartFigure()
p.AddArc(New Rectangle(0, 0, 40, 40), 180, 90)
p.AddLine(40, 0, Me.Width - 40, 0)
p.AddArc(New Rectangle(Me.Width - 40, 0, 40, 40), -90, 90)
p.AddLine(Me.Width, 40, Me.Width, Me.Height - 40)
p.AddArc(New Rectangle(Me.Width - 40, Me.Height - 40, 40, 40), 0, 90)
p.AddLine(Me.Width - 40, Me.Height, 40, Me.Height)
p.AddArc(New Rectangle(0, Me.Height - 40, 40, 40), 90, 90)
p.CloseFigure()
Me.Region = New Region(p)
p.Dispose()
Me.BackColor = Color.Red
///
 
Back
Top