[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Shapes in .NET windows forms

Posted on 2004-04-02
5
Medium Priority
?
729 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 400 total points
ID: 10739524
0
 
LVL 19

Accepted Solution

by:
Fahad Mukhtar earned 200 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 400 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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month20 days, 4 hours left to enroll

872 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