make a hole in a form??

how do I creat a hole in a form??
Micki-WeaverAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

marklorenzCommented:
Not sure what you're asking - do you mean an "empty" spot when rendered?
0
Micki-WeaverAuthor Commented:
.Net, C# if you would but VB is ok

a hole in a form
0
Bob LearnedCommented:
If you set the TransparencyKey, and have a region that is a that color, there will be a hole bored through the form.

Bob
0
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

Micki-WeaverAuthor Commented:
I can't allways count on having control of the TransparencyKey, or form backcolor, any other ways??
0
Mike TomlinsonHigh School Computer Science, Computer Applications, and Mathematics TeachersCommented:
"but VB is ok"

Here is a hard coded "hole" in a form...

Public Class Form1

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

        ' start with a rectangle that represents the whole form
        gp.AddRectangle(New Rectangle(0, 0, Me.Width, Me.Height))

        ' add an ellipse...which is removed from the rectangle above
        Dim w As Integer = Me.Width / 4
        Dim h As Integer = Me.Height / 4
        gp.AddEllipse(New Rectangle(w, h, w * 2, h * 2))

        ' create a Region from the GraphicsPath and set it...
        Me.Region = New Region(gp)
    End Sub

End Class
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Micki-WeaverAuthor Commented:
a upgrade and in C#

        public static void MakeHole(System.Windows.Forms.Form FormIN, System.Drawing.Rectangle RectangleIN)
        {
            System.Drawing.Size SizeIN = FormIN.Size;
            System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath();

            // start with a rectangle that represents the whole form
            gp.AddRectangle(new Rectangle(0, 0, SizeIN.Width, SizeIN.Height));

            // add an ellipse...which is removed from the rectangle above
            int w = FormIN.Width / 4;
            int h = FormIN.Height / 4;
            gp.AddEllipse(RectangleIN);

            // create a Region from the GraphicsPath and set it...
            FormIN.Region = new Region(gp);
        }
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.