7 Replies - 450 Views - Last Post: 12 June 2013 - 07:23 AM Rate Topic: -----

#1 oyyou  Icon User is offline

  • D.I.C Head

Reputation: 27
  • View blog
  • Posts: 182
  • Joined: 26-April 10

Custom Shaped Windows

Posted 12 June 2013 - 05:08 AM

I believe the title will give away what I want to do, but yeah.. I don't need to do this for anything specific, I just think it would be fun to know.

Ya know where you use WPF, or Forms and all you can have are square and rectangles? Well I don't want that, surely there is a way to get other shapes too?

I was recently using an app I downloaded and it was really cool, it was kinda like a line of bubbles, so that intrigued me to learn how that is done.

To paraphrase, how on earth do I go around creating apps with different shaped windows?

Thank you.

Is This A Good Question/Topic? 0
  • +

Replies To: Custom Shaped Windows

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8957
  • View blog
  • Posts: 33,581
  • Joined: 12-June 08

Re: Custom Shaped Windows

Posted 12 June 2013 - 05:19 AM

I know this is VB.NET - but you should get an idea where to go:

http://www.dreaminco...an-application/
Was This Post Helpful? 0
  • +
  • -

#3 oyyou  Icon User is offline

  • D.I.C Head

Reputation: 27
  • View blog
  • Posts: 182
  • Joined: 26-April 10

Re: Custom Shaped Windows

Posted 12 June 2013 - 05:22 AM

View Postmodi123_1, on 12 June 2013 - 05:19 AM, said:

I know this is VB.NET - but you should get an idea where to go:


Why do you hate me, Modi! You can't just expect somebody to look through Vb and not die!
So mean.
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8957
  • View blog
  • Posts: 33,581
  • Joined: 12-June 08

Re: Custom Shaped Windows

Posted 12 June 2013 - 05:23 AM

Suck it up.. it's .NET and outside of minor formatting the code translates fine to C#. I work in both all day, every day so it'll be alright.
Was This Post Helpful? 1
  • +
  • -

#5 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2241
  • View blog
  • Posts: 9,412
  • Joined: 29-May 08

Re: Custom Shaped Windows

Posted 12 June 2013 - 06:28 AM

Why the disgust at vb.net?

If you were smart enough to realize it a .net language, thus if you were anything like me I just compile it into a DLL and use it from C#.
Since it now compiled into IL it hardly makes a difference, from which .net language you reference it from.

I wrote a library in Nemerle and used it in C# and VB.net languages.
In modern win8 app, there is even interplay between languages. C++ , C#, VB.net, F# even Javascript (Video)

Use the langauge best suit for that particular job. If you're doing a stuff with XML use vb.net, since it has XML Literal built-in the language.
If you're planning to do pointer stuff with memory use C# and Unsafe Code
Doing Physics and Financial stuff use F#
Was This Post Helpful? 2
  • +
  • -

#6 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8957
  • View blog
  • Posts: 33,581
  • Joined: 12-June 08

Re: Custom Shaped Windows

Posted 12 June 2013 - 06:42 AM

@adam - sometimes people just live by The Offspring's song "Cool to Hate" even though all of the Fortune 300 companies I have worked for use VB.NET on core, mission critical, apps and they roll just fine. :D
Was This Post Helpful? 1
  • +
  • -

#7 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2241
  • View blog
  • Posts: 9,412
  • Joined: 29-May 08

Re: Custom Shaped Windows

Posted 12 June 2013 - 07:13 AM

VB.net example.
  Public Sub New()
    
    ' This call is required by the designer.
    InitializeComponent()
     Dim gp As new Drawing.Drawing2D.GraphicsPath (  )
    gp.AddRectangle(New Rectangle(0,0,Me.Width,Me.Height)  )
    gp.AddEllipse(New Rectangle(Me.Left-10,(Me.Height/2)-100,200,200))
    gp.AddEllipse( New Rectangle(Me.Right-190,(Me.Height/2)-100,200,200))
    gp.AddString("Dream.In.Code", New Font("Consolas",80).FontFamily,0,100, New Rectangle(0,100,Me.Width,Me.Height),Drawing.StringFormat.GenericDefault )
    gp.AddEllipse(New Rectangle((Me.Width/2)-100,Me.Height-100,200,200))
    Dim surface As New Region(gp) 
    Me.Region=surface
  End Sub



Attached Image

Another technique is with an image and use the transparency key and set it to particular color in the image, you want to be see-through.

This post has been edited by AdamSpeight2008: 12 June 2013 - 07:15 AM

Was This Post Helpful? 0
  • +
  • -

#8 Curtis Rutland  Icon User is offline

  • (╯□)╯︵ (~ .o.)~
  • member icon


Reputation: 4437
  • View blog
  • Posts: 7,713
  • Joined: 08-June 10

Re: Custom Shaped Windows

Posted 12 June 2013 - 07:23 AM

VB.NET aside, the question comes to "how do I make a chromeless form?" Our question is, what are you using? Windows Forms or WPF? Modi's tutorial seems to be for Windows Forms, but the same effect is achievable in WPF.

I'd caution you against using it though, unless you really need to. It looks cool at first, but it's a usability nightmare. Windows provides a common visual interface that people are all familiar with. Windows with borders that you drag to resize, three buttons at the top right, and an application menu on the top left. Even applications like Chrome that use custom forms still keep some of these elements.

By overriding the default styling and replacing it with something unfamiliar, you've instantly lowered your user-friendliness. Your design has to be that much better to make it worth that. Plus, then you have to write the code for dragging the window, for resizing it, etc...

It's completely doable, but you should make sure you actually want to do it.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1