Solved

Shapes in .NET windows forms

Posted on 2004-04-02
5
724 Views
Last Modified: 2009-12-16
Instead of default windows form how can I get the shape of the form to oval,circle etc .Is there any property I have to set? How can we achieve it?
0
Comment
Question by:sainavya1215
5 Comments
 
LVL 25

Expert Comment

by:RonaldBiemans
ID: 10739511
Here are some good examples

http://www.a1vbcode.com/code.asp?type=forms
0
 
LVL 25

Assisted Solution

by:RonaldBiemans
RonaldBiemans earned 100 total points
ID: 10739524
0
 
LVL 19

Accepted Solution

by:
Desp earned 50 total points
ID: 10739527
Check these:

Easily create custom shaped forms without using any complicated code, it’s a simplest example how to do that.
https://www.exhedra.com/vb/scripts/ShowCode.asp?txtCodeId=1414&lngWId=10

Irregularly Shaped Forms in VB.NET
http://www.freevbcode.com/ShowCode.asp?ID=3723
0
 
LVL 28

Assisted Solution

by:iboutchkine
iboutchkine earned 100 total points
ID: 10740489
Ellipse form
when added to the Form's New method, will cause the form to
have an elliptical shape:

      Imports System.Drawing.Drawing2D
      
      Public Sub New()
            MyBase.New()
            InitializeComponent()
            

'add this part
            'Create the elliptical form
            Dim gPath As GraphicsPath = New GraphicsPath()
            gPath.AddEllipse(0, 0, Me.ClientSize.Width, Me.ClientSize.Height)
            Me.Region = New Region(gPath)
      End Sub
=============================
Round form
 'Place this in your form's initlialization procedure:

       'after the line
       'Add any initialization after the InitializeComponent() call


        Dim intDiameter As Integer = 300
        Me.Height = intDiameter
        Me.Width = intDiameter
        Dim p As New Drawing2D.GraphicsPath()
        p.AddEllipse(0, 0, intDiameter, intDiameter)
        Me.Region = New Region(p)
        Me.BackColor = Color.Red
=================================
donut shape
To change the region of a form, create a region from a set of graphics paths and apply this to the form’s
Region property. The following code shows how to do this:


      Imports System.Drawing.Drawing2D
      
      Public Sub New()
            MyBase.New()
            InitializeComponent()
            

'add this part

Dim myPath As New Drawing2D.GraphicsPath()
Dim bigDiameter As Integer = Me.ClientSize.Height
Dim donutWidth As Integer = 80
myPath.AddEllipse(0, 0, bigDiameter, bigDiameter)
myPath.AddEllipse(donutWidth, donutWidth, _
   bigDiameter - (donutWidth * 2), _
   bigDiameter - (donutWidth * 2))
Me.Region = New Region(myPath)

etc etc etc
0
 

Author Comment

by:sainavya1215
ID: 10743012
Thx a lot
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question