• 0

[C#] Non-Rectangular Forms with soft edges


Question

I've been searching on Google about borderless forms and non-rectangular forms and I've found lots of examples on how to achieve this. However, every single example has one little issue, all the edges of the form are pretty rough and I'm looking for soft edges. I don't want my form to look all pixelated but I can't find a way to achieve this.

Is this possible at all in .NET? How?

Recommended Posts

  • 0

Yes, I know how to use Photoshop and make the shape I want with soft edges, that's not the Issue. The only way I know to create a form the shape I want is to make my image with the shape I want and a background color like 255, 0, 255 (magenta). Then, on the form, set this image as background image and set the transparent key color to magenta. But this won't produce soft edges. I want to do something like Photoshop splash screen for instance. Rounded square with a shadow...

  • 0
  Menge said:
save the image in photoshop as PNG without the magenta backgroudn... just NO background, so it's fully transparent where it should be... then in the form, add it to the background. that's it.

I just tried it, that doesn't work... I still have the background from the form.

  • 0

Yeah, I've already found that article on the code project and was going to take a deeper look later. We'll see if it helps but if anyone has any other solution, more easy to implement, let us know...

WPF crossed my mind actually but I'm waiting for VS2008 final version and also for it to be available through MSDNAA which could take a while.

  • 0

Looking at Layered Windows but I don't think it will help me.

My idea is to designed my own form borders and caption and if Menge suggestion did work, it was the simplest way. I know I can pain the non-client area, but that is a bit harder than I thought and also doesn't support alpha transparency as far as I know.

  • 0

Layered Windows is the type of route you want to take,

Another article - http://www.codeproject.com/useritems/Translucent_Windows.asp

When you come across a development problem (you seem to have many), do you search first, or come straight to Neowin?

  • 0

I always search first. But I never find what I want everytime... If I had posted every development problem I've had since I started learning C#. I would have 5 times more the posts I have. Belive me, I always search first, sometimes I just don't know exactly the words to search for. For instance, I would never search for "layered windows"...

I'll take a look at that project. Thanks.

  • 0

I just took a look at that Translucent Windows article but I found the code too confusing with all those Forms and pieces of the code here and there. I've been reading a lot about these "layered windows" and I don't know if it's exactly possible to do what I want using layered windows. I mean, I want a form that is non-rectangular of course (in fact it's rectangular, but with round soft corners) that is able to:

1) Be resizeable just like any other form. Dragging the corners or the sides, top or bottom.

2) I can add controls (textboxes, labels, etc...) just like any other form.

After everything I read, I'm not sure Layered Windows helps me achieve what I want. Can anyone confirm if these 2 things are even possible using this technique?

Now, if it is, can someone provide me an example but less confusing? If that's too much work, don't bother if you don't want. Or, if you know of another example about layered windows that's easier and simple to understand, let me know. I'll do another search about layered windows later on though.

  • 0

If you have to put controls on the form, and users will be using it, odds are you shouldn't be doing what you're trying to do. (I recall your last asking for UI tips thread.)

For something like a splash screen, which is mostly decorative, of course something like this can look cool. But 99.99% of the time, you should be letting the OS draw its own window borders. They generally look better, and they always follow the user's theme settings. (For instance, what if a user hikes up his border padding?)

And let's face it. They're easier to work with most of the time, rather than trying to reimplement every last little detail that Windows handles automatically for you. (And let's face it, you won't remember to implement every little detail, no one can. Or you'll get something like the area that triggers resize cursor off by a few pixels, and cause general frustration for your users.)

  • 0

Why shouldn't I? Because many people say that? I'm sorry but I don't agree with that... There are applications and applications. Some might look horrible skinned, for instance, ATi CCC, everyone knows that. But there are other applications that it just fits and looks good. Besides, I don't want to skin the application, just the borders and caption, that's it.

I've already done a mock up of the UI and I really like it and I think it's pretty cool, although it's not finished and it can take a while. And trust me, most people that use or would like to use this application would probably like it. They may not like it but it's going to be because they don't like the design itself and not cause it doesn't fit their theme settings. Like I said, there are applications and applications and I'm doing something that just looks good and looks better than windows default theme for it's purpose. It's like winamp: Forget for a couple of seconds that Winamp is not skinable, and now look at the default skin of version 5. Do you think people would like winamp if it just had a border and a caption like all windows applications? I don't think so and that's all I'm trying to say.

I agree with you for a part. Most of time, we should just use the default stuff and let windows do the job so everything looks consistent and just fits, but there are some applications that they will look much better if they are different. And I believe that my application fits that category. That's my opinion and I respect yours but I won't going to change my mind because I don't agree that every single application has to look "default" and not have "it's touch".

It's like, look at WPF. Why did Microsoft develop it? Why did they offer all that functionality with WPF? Everyone can really customize the look of their applications with WPF easier than ever. Why did they do that if it's not for people to make their applications look the way they want? I just want my application to look more like a gadget or something that to a real application. It's a simple application that in fact as functionality looking more like a gadget than anything else. Like I said, there are applications and applications...

About handling every little detail, you might be right. But the truth is, I might not need every functionality windows provides and the functionality I need, I may be able to reimplement it. If not, well, that's a problem and I'll deal with that when and if the time comes.

You have the right to your opinion has I have the right to mine and I think your thinking about the UI design and the whole thing about just going standard for every application just doesn't make any sense. Looks like there is a rule or something and everyone should follow it otherwise they are wrong. Well, I don't like to think like that, I like to understand the rule and see if the rule makes any sense and then break it or live by it. That's how I am. I wanted to explain this a little better but cause English is not my main language and I don't know the words I want to use, not even in my own language so I can't translate me. I just don't know exactly how to explain this so you understand what I'm saying.

If I sounded harsh or offensive, sorry, it wasn't my intention. I'm just trying to explain my point of view.

  • 0
  Quote
It's like, look at WPF. Why did Microsoft develop it? Why did they offer all that functionality with WPF? Everyone can really customize the look of their applications with WPF easier than ever.

Just because they give you the power, doesn't mean they intend for you to use it like that.

  Quote
I think your thinking about the UI design and the whole thing about just going standard for every application just doesn't make any sense

It's not even just about the looks (They're a big deal too. But we'll ignore that for the next few sentances.) You're going to have to reimplement a relatively non-trivial thing that the user interacts with and is going to expect to behave exactly like everything else in the system. You'll have to test at various DPIs, and probably find problems that you'll have to code around, and you should probably be polling some settings from the user's "Advanced" Appearance settings, too. My point is that with something like this, it's best to just let the OS handle it. That's why we have it.

  Quote
But there are other applications that it just fits and looks good

Very, very few. I won't try to convince you anymore -- this deviates too far from the point of your topic, but I thought it'd just be a good idea to point out one of the largest annoyances with non-standard UIs: The window frame.

Edited by MioTheGreat
  • 0

If you look at the majority of a Windows applications you can see that they try to conform to the standard Windows UI. The reasons aren't just for the sake of being lazy, it's for usability. If you have two applications, which perform the same function, one looks like an eyesore (I'm not saying yours will), and then other fits in with the user's theme, which one are they likely to use. People like conformance, they like everything to fit in well (heck, look the Customisation forum to see that; they more than often produce a Winamp skin, a dock skin, etc. just to make sure everything looks the same), IMO it's human nature.

I'm not saying that you shouldn't skin your form, but I truly think that it is an unecessary evil. The basics of the Windows UI hasn't changed since Windows 95, just the vibrance and fidelity has increased, the reasons for this is because that it is easy to approach and use. Microsoft spend billions each year reasearching and developing their UIs, and thus far they haven't really gone wrong (Bob doesn't count :p).

Remember, sometimes better to be useable, than to look good.

  • 0

About implementing the functionality, I don't think that will be a problem but I'm not sure yet. If I can do what I want, if I follow and understand every little detail of the article I just found, I don't think I'll have to reimplement everything. Everything will just work as it should. I think... I'm not going to have smooth borders as I wanted but that's the price to pay. I'm also going to look more to WPF to see if it's possible/easier to implement this without any bigger problems. Like I said, this is a problem (reimplementing the functionality), I agree with you, but for now, I just don't care. I'll try to implement it and go from there, if I'm not able to produce it right, I'll do it differently...

About the looks, it's like I already said many times. There are applications and applications. My applications is not the average type of windows applications it's more like a gadget that could have been developed for Windows Sidebar or any program like that. I just didn't develop it like for a few reason: 1) I started this project long ago when these applications were not well developed. 2) I don't really like any of the existing applications that do this kind of stuff. 3) I don't want to learn how to code a gadget.

I think that Windows UI guidelines are overrated, I said this before. I like conformity and consistency through out the system but doesn't mean that every single application needs to conform with one another and the system. What if the application looks good and is usable at the same time? I prefer that...

  • 0

I'm sorry I revived such an old topic but I just found something weird that I can't understand. Maybe you guys can make any sense out of this, cause I cant...

Do you see the project attached by Menge? This project has code and pre-compiled exe. The code is basically a form without borders and with a alpha transparent (png) background image and that's it.

I took the compiled splash.exe and tried in Vista and XP (VMware). As you can see in my post #11, the background is drawn. Then I tested the same exe on the XP machine and wow, it worked, the background was fully alpha-blended. Conclusion: it worked on XP but not on Vista.

Now, I opened Menge's solution which was on VS2003 and converted it to VS2008 solution, recompiled and guess what? Both XP and Vista show the fom background instead of alpha blend it as it happened with the pre-compiled exe on XP.

What does this mean? Two questions:

1) How come it works on XP and not on Vista?

2) How come it doesn't work if I do no changes at all to the code and just recompile it?

Something's weird going on...

  • 0

maybe the conversion process changed it into a .Net 2.0/3.0 applcation, which might have different configurations for the behavior of PNGs as form backgrounds?

have you tried deleting the picture and then re-setting the picture in VS.Net 2008?

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • In my experience I have used a paid programme I can recommend people try the full featured trial version of . It is Ez Cd Extractor . It is so complete when it came to burning cds and I loved the simplicity of importing a saved playlist file to make any kind of CD audio to share with family and friends to mail out . Piece of cake . and the intergrated CD Text editor is kind of amazing to see the edited text on a car cd player actually read . amazing . I missed thinking about this topic an ancient version of Roxio suite that had all these soft-wares built in I loved the functionality of it . I had a complete box with full key. too bad I threw all that away lol Another software to check out is DB power amps free Cd Writer progamme if you want to try a professional solution . You'll have to find out how to install it properly with the codecs you have your files music for . You can always opt out for Windows Media Player legacy to burn audio discs . G'day everyone ! I bought on ebay a week or two ago a brand new HP slot loading drive DVD writer it is amazing . Make sure you look at ebay for a portable slot loading HP dvd writer hopefullly if you spot one brand new like i did BUY IT and enjoy your dvd movies , cd burning remotely . I highly recommend ! So nice in black and slot loading ! Cheers !
    • "What's that? Microsoft recommends Intel CPUs? My next computer must have Intel then." - Nobody
    • Apple warns Australia against joining EU in mandating iPhone app sideloading by David Uzondu Apple has issued a warning to Australia, essentially telling the country not to follow the European Union's lead in making iPhone app sideloading a requirement. This communication comes as the Australian federal government considers new rules that could force Apple to open up its iOS ecosystem, much like what happened in Europe with recent legislation. Since iOS 17.4 and iPadOS 18, users in the EU have been able to get apps from outside the official App Store, a direct consequence of the DMA designating Apple as a "gatekeeper". The Australian government floated a proposal in a paper released late last year. The paper suggested "designating" digital platforms like Apple's App Store. Being designated this way means these platforms would have to follow new rules intended to keep them from limiting competition. The government pointed to Apple's in-app payment system, which usually comes with a commission, and the lack of sideloading as likely targets for regulation. Right now, apps like Netflix and Spotify can't let users subscribe through their iOS apps without giving Apple a big cut, and they're not even allowed to tell users where to find a better deal. Apple, in its response to this Australian paper, stated that Australia should not use the EU's Digital Markets Act "as a blueprint". The company's core argument is that the changes mandated by the EU's DMA, which came into full effect in March 2024, introduce serious security and privacy risks for users. Apple claims that allowing sideloading and alternative app stores effectively opens the door for malware, fraud, scams, and other harmful content. The tech company also highlighted specific concerns from its European experience, alleging that its compliance there has led to users being able to install pornography apps and apps that facilitate copyright infringement, things its curated App Store aims to prevent. Apple maintains that its current review process is vital for user protection, and that its often criticized 30% commission applies mainly to the highest earning apps, with most developers paying a lower 15% rate or nothing. It is worth noting that Apple's implementation of DMA requirements in the EU, which includes a "Core Technology Fee" for apps distributed outside its store, has already drawn scrutiny from European Commission officials who question if these measures truly comply with the DMA's idea of keeping the market fair. The Australian government has not yet detailed its next steps in this process, and the Treasury still needs to publish the full submissions to its proposal paper, including Apple's complete arguments. Source: The Guardian
    • Oh the Chinese crybabies who couldn't accept the fact that they lost GOTY to Astro Bot? Not interested
    • Download this SQL Essentials For Dummies eBook (worth $10) for free by Steven Parker FOR DUMMIES is a trademark of John Wiley & Sons, Inc. A right-to-the-point guide on all the key topics of SQL programming SQL Essentials For Dummies is your quick reference to all the core concepts of SQL—a valuable common standard language used in relational databases. This useful guide is straightforward—with no excess review, wordy explanations, or fluff—so you get what you need, fast. Great for a brush-up on the basics or as an everyday desk reference, this book is one you can rely on. Strengthen your understanding of the basics of SQL Review what you've already learned or pick up key skills Use SQL to create, manipulate, and control relational databases Jog your memory on the essentials as you work and get clear answers to your questions Perfect for supplementing classroom learning, reviewing for a certification, and staying knowledgeable on the job, SQL Essentials For Dummies is the convenient, direct, and digestible reference you've been looking for. Claim your complimentary eBook worth $10 for free, before the offer ends on June 17. How to get it Please ensure you read the terms and conditions to claim this offer. Complete and verifiable information is required in order to receive this free offer. If you have previously made use of these free offers, you will not need to re-register. While supplies last! Download the SQL Essentials For Dummies eBook (worth $10) for free Offered by Wiley, view other free resources The below offers are also available for free for a limited time: Winxvideo AI V3.0 Lifetime License for PC ($69.95 Value) FREE – Expires 6/8 Aiarty Image Enhancer for PC/Mac ($85 Value) FREE – Expires 6/8 Solutions Architect's Handbook, Third Edition ($42.99 Value) FREE – Expires 6/10 AI and Innovation ($21 Value) FREE – Expires 6/11 Unruly: Fighting Back when Politics, AI, and Law Upend [...] ($18 Value) FREE - Expires 6/17 SQL Essentials For Dummies ($10 Value) FREE – Expires 6/17 Continuous Testing, Quality, Security, and Feedback ($27.99 Value) FREE – Expires 6/18 VideoProc Converter AI v7.5 for FREE (worth $78.90) – Expires 6/18 Macxvideo AI ($39.95 Value) Free for a Limited Time – Expires 6/22 The Ultimate Linux Newbie Guide – Featured Free content Python Notes for Professionals – Featured Free content Learn Linux in 5 Days – Featured Free content Quick Reference Guide for Cybersecurity – Featured Free content We post these because we earn commission on each lead so as not to rely solely on advertising, which many of our readers block. It all helps toward paying staff reporters, servers and hosting costs. Other ways to support Neowin The above deal not doing it for you, but still want to help? Check out the links below. Check out our partner software in the Neowin Store Buy a T-shirt at Neowin's Threadsquad Subscribe to Neowin - for $14 a year, or $28 a year for an ad-free experience Disclosure: An account at Neowin Deals is required to participate in any deals powered by our affiliate, StackCommerce. For a full description of StackCommerce's privacy guidelines, go here. Neowin benefits from shared revenue of each sale made through the branded deals site.
  • Recent Achievements

    • One Month Later
      EdwardFranciscoVilla earned a badge
      One Month Later
    • One Month Later
      MoyaM earned a badge
      One Month Later
    • One Month Later
      qology earned a badge
      One Month Later
    • One Year In
      Frinco90 earned a badge
      One Year In
    • Apprentice
      Frinco90 went up a rank
      Apprentice
  • Popular Contributors

    1. 1
      +primortal
      449
    2. 2
      +FloatingFatMan
      247
    3. 3
      snowy owl
      235
    4. 4
      ATLien_0
      199
    5. 5
      Xenon
      145
  • Tell a friend

    Love Neowin? Tell a friend!