How do I mimic the windows 7 UI? - c#

I want to try and get the same look as Windows 7, with the aero glass dropping down just a little bit so that there can be a back button/address bar/ search box. Are there any tutorials on how to do this? I really need something simple, as I tried looking at a few other tutorials that try to explain how to use DWM with c# and I get totally lost.

Done as an answer :)
Absolutely use WPF, WinForms is a nightmare for this sort of thing. Combine it with http://code.msdn.microsoft.com/WindowsAPICodePack and you're on to a winner.

Ive been using the glass_full class from the site below on WinForms and and it works great.
http://www.dreamincode.net/forums/topic/146813-glass-form-dwmapidll-api/
I found a workaround for the black text issue with WinForms is to simply set backcolor and transparencyKey to a unused color.
(To prevent clickthrough, make sure the red and blue values are different, I use 221,222,223 as my color values so it gracefully fallsback to grey without Aero)

Related

How to layer one window on top of another with transparency(Overlay) or how to do aplha-blending on two windows using directx?

I am trying to achieve alpha blending of two windows Like I have one window that contains an image and another window that contains webpage. I want to alpha blend these two windows so that it gives an overlay effect and I want the top window to be transparent so that window underneath it could be seen. Later I want to save this in to the video(Preferably using direct x). I have read several tutorials over the internet regarding the direct x alpha blending but have not been able to find what I want to achieve. Any example/source code to achieve this or any pointer towards the right direction would be really appreciated.
Finally I found an answer myself. Further research lead me to This,This thread which was exactly what i was looking for. This might be useful to someone else and might save a lot of head banging on research.

Apply stroke to a TextBlock (Windows 8)

How do you apply stroke (outline around text) to a TextBlock in XAML in a Windows 8 store app (not WPF)?
A very similar question was asked in 2008, but the suggested solution from Apply stroke to a textblock in WPF and the referenced https://msdn.microsoft.com/en-us/library/ms745816.aspx only work on Windows Presentation Foundation (WPF) applications. The effect I am looking for is the same.
Thanks for your help!
I have successfully done it with Win2D effect http://expediteapps.com/blog/textblock-with-win2d-effects/
The idea is to apply two effects that create the outline effect. You can experiment with different ways and find the best combination you need. To add Win2D you can get it by nuget and is really easy to use.
and you do not need to convert the font to any strange glyphs.

Windows 8 Metro app, how to create this selected box style

How is this style created or where can i find it?. (so that i only have to change the colors)
I mean the style in this picture of how the maps app is selected with the check mark in the corner.
I would really like to use this in an app, and I've seen it done in a few others too, but after hours of searching i havent fount anyway to do it. i cant seem to find how to create it.
If anyone can help me with this i would be very thankfull :)

Custom look of Textbox

I need to write a complete diffrent looking textbox than the original winforms textbox. In fact I need a different background, how can I achieve this? I tried owner drawing with SetStyle(ControlStyles.UserPaint, true); but this caused a lot of flickers and the text was completly wrong drawn, wrong font, size etc.
Wrtiting a textbox from scratch would be overkill, I think.
This is not possible. The TextBox class is a wrapper around a native Windows control that has been around since Windows version 2. It had to run on some seriously sucky hardware, they had to break a few rules to make this work. One of which is that it draws parts of itself without using the standard Windows paint cycle. Invalidate() and OnPaint() in Winforms terms. Fixing this behavior wasn't possible due to app-compat problems. Way too much code out there that hacked the control in creative but unpredictable ways.
Accordingly, it isn't possible to intercept the drawing to prevent it from erasing parts of your background image. There is no workaround for this, creating your own is a lot of work. Consider WPF.
If you specifically need a different background on a text box, one work-around is offered here.

Set Screen.WorkingArea.Width?

Sorry if this is a fundamental question and I'm just stupid :)
I am building a sidebar application, it uses System.Windows.Forms.Screen.PrimaryScreen.WorkingArea to set the appropriate widths and heights and locations.
I want to now reduce the working area of the desktop so that when forms maximise, the sidebar is still shown (in the same way that the Vista or Google sidebars do)... but trying to set the Width on the WorkingArea.Width property gives me an error about the WorkingArea (a System.Drawing.Rectangle) not being a property.
What can I do to change the width of the WorkingArea to prevent forms overlapping my sidebar?
Thanks in advance!
Actually looking at this in more detail, it looks like it is much more involved and requires Win32 API calls to get the job done and get the exact same behavior.
This link contains some sample code on how to get it done. (Sorry, its ExpertsExchange, so scroll down, but it is a full sample.)

Categories