Solved

Shapes in .NET windows forms

Posted on 2004-04-02
5
720 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
Comment Utility
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
Comment Utility
0
 
LVL 19

Accepted Solution

by:
Desp earned 50 total points
Comment Utility
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
Comment Utility
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
Comment Utility
Thx a lot
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
This video discusses moving either the default database or any database to a new volume.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

743 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now