Solved

Shapes in .NET windows forms

Posted on 2004-04-02
5
725 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
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…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

726 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