9 Years
Discussion Span
Last Post by waynespangler

Ive seen a c# app where you can give the program wierd shaped skins (like you can with windows media player) so i know its possible.

No way to do it visually though, i dont think. They probably used GDI or DirectX


I've been wondering this same thing.

This could come in handy for many situations (creating splash screen, creating skinned interface, etc.).

I think it's a matter of hiding the titlebar, first of all, to get rid of default windows gui. Then if you want rounded or customized looking window, you have to set transparency and x and y of where the transparency will effect.

I remember messing with this a long time ago (VB3.0 long time ago). But haven't seen any code since then. I'm sure it's out there, just haven't looked for it.

to get rid of the titlebar: set FormBorderStyle to None

this one here is about the GDI i think: http://visualbasic.about.com/od/usingvbnet/l/aa080703a.htm

i just looked this site up: http://www.freevbcode.com/ShowCode.asp?ID=3725


You can use the Windows Region and GDI++ GraphicsPath to set your shape then paint the interior like you want.
I have code somewhere if I can find it.


Couldn't find old code so whipped up this. Gives you idea on what to do. Create a new project and add this code.

Imports System.Drawing
Imports System.Drawing.Drawing2D

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim gp As New GraphicsPath
        Dim reg As New Region
        Dim border As Integer = (Me.Width - Me.ClientRectangle.Width) / 2
        Dim title As Integer = Me.Height - Me.ClientRectangle.Height - border
        gp.AddLine(New Point(border, title), New Point(Me.Width - border - 50, title))
        gp.AddLine(New Point(Me.Width - border - 50, title), New Point(Me.Width - border - 50, (Me.Height - border) / 2))
        Dim rect As New Rectangle(Me.Width - border - 175, (Me.Height - border) / 2 - 20, 150, 150)
        gp.AddArc(rect, 320, 180)
        gp.AddLine(New Point(Me.Width - 165, Me.Height - 150), New Point(border, Me.Height - 150))
        reg = New Region(gp)
        Me.Region = reg
    End Sub

    Private Sub Form1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseClick
        If e.Button = Windows.Forms.MouseButtons.Right Then Me.Close()
    End Sub

    Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
        Dim rect = New Rectangle(0, 0, Me.Width, Me.Height)
        Dim lBrush As New LinearGradientBrush(rect, Color.Black, Color.Blue, LinearGradientMode.Vertical)
        Dim g As Graphics = Me.CreateGraphics
        g.FillRectangle(lBrush, rect)
        Dim myBrush = New SolidBrush(Color.LightGray)
        rect = New Rectangle(200, 200, 500, 500)
        g.FillRectangle(myBrush, rect)
        myBrush = New SolidBrush(Color.DarkGray)
        rect = New Rectangle(350, 200, 500, 500)
        g.FillRectangle(myBrush, rect)
        myBrush = New SolidBrush(Color.DimGray)
        rect = New Rectangle(490, 200, 500, 500)
        g.FillRectangle(myBrush, rect)

    End Sub
End Class
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.