Custom painting Windows Forms Scrollbar? - winforms

I know how to do custom drawing of a standalone Windows Forms ScrollBar because there are plenty of examples at places like codeproject.com. But how do you custom draw the scrollbars in controls you do not create yourself? For example a Panel can show scrollbars but how would I ensure that the scrollbars it shows are custom drawn?
Or maybe this is not possible and I would need to create my own version of a Panel so that they use my own custom drawing scrollbars?

The scrollbars you see most often, including those built into most winforms controls, are rendered by Windows and there is no way to override their appearance in WinForms short of implementing an entirely custom solution which completely takes over the rendering and behavior of the common scrollbar control. There are some commercial packagages which claim to do this (google winforms skinning).

Related

Beast way for create WPF application layout

I know how to working layout controls (Grid, StackPanel, DockPanel, etc), but even so, I don't know how to can I combine their for create a good layout.
Has any resource or article talking about this?
You need to look this link for a great place to learn layout techniques.
WPF & Silverlight Layout Controls.
Layout Techniques.
It takes an example WinForm dialog and then goes on to making same for WPF.
Make layouts for all windows programs like Explorer, Control Panel, Picture viewer, etc. Making more and more common layouts will make you more and more comfortable.

WPF WindowsFormsHost creates fuzzy text

I am hosting a winforms DataGridView inside a WindowsFormsHost on a WPF Window. Functionality is fine, but the text in the grid cells looks a little more fuzzy. Normally WinForms text has very little antialiasing.
How can I get the DataGridView text to look as it normally would on a Windows Form, or at least be sharper? I have tried playing with the TextOptions.TextFormattingModeand SnapsToDevicePixelssettings of the WindowsFormsHost, but don't see any difference.
As an example of what I mean here are two screenshots:
Datagridview inside a WPF WindowsFormsHost:
DataGridView in Windows Forms:
The appearance of hosted WinForms/Win32 content should not be affected by WPF. There is an "airspace" limitation that dictates that a single window pixel can only be owned by a single graphics API, and it can only be drawn by that API. Hence, WinForms content is drawn by WinForms/GDI+, even when hosted by WPF. This explains why hosted content will be drawn on top of any WPF content in the same window, even if the WPF content is positioned in front of it.
Changing WPF rendering properties like TextFormattingMode cannot affect the appearance of interop content. You should be looking at the layout/rendering properties of the hosted WinForms content.
Update
Presumably the fuzzy effect is do to WPF defaulting to grayscale AA for the DataGridView. In the Paint and/or CellPainting events of the DataGridView, setting the graphics text hint to cleartype:
e.Graphics.TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
eliminated most of the fuzziness.

Can I use a WPF control in WinForms to achieve transparency effects?

Is it possible to use WPF in WinForms, to implement the idea used in this question. I am trying to create a semi-transparent panel.
Technically yes - there are ways of hosting WPF in WinForms using ElementHost.
However, you're likely to run into problems with the transparency. WPF's rendering is different to WinForms and, while you can make the WPF control transparent, the WinForms underneath aren't going to respect that.
You can use Opacity property of your WinForm to make it semitransparent.

What is the best menu metaphor for silverlight line-of-business apps?

So I'm porting an application from WPF to Silverlight and I have realized that there is no standard Menu control.
So I look around and find some third-party controls that emulate the menu control, like this one at codeplex:
alt text http://www.deviantsart.com/upload/1adt6b3.png
But then I decided to take advantage of this situation and think of some new metaphors besides the standard menu we have been using since Windows 3.0, e.g. I like the following enabled/disabled buttons for a small number of choices, which also work well as a vertical stack, and will try to integrate a drop-down button idea to allow it to hold the number of nested choices that a standard menu control could hold:
alt text http://www.deviantsart.com/upload/1bbtg9l.png
What is the best application navigation menu metaphor you have seen or used in a Silverlight line-of-business application?
How about the Office Ribbon?
http://timheuer.com/blog/archive/2009/01/20/ribbon-control-for-silverlight.aspx
http://www.divelements.co.uk/net/controls/sandribbonsl/
http://msdn.microsoft.com/en-us/office/aa973809.aspx
Personally, I like the style of Apple's CoverFlow.
You can load various screens in each of the CoverFlow "panels", show the Active panel in the center, and tightly pack the other panels to the left and right.
You gain the ability to allow the user to see their other panels while working on the active one...and you can add a little flair when the user switches between the panels.

Intuitive scroll for embedded browser in WPF

I am working on a project built in WPF, which includes an embedded WebBrowser. The Browser that comes with WPF did not meet our needs, so we are using a WinForms WebBrowser in a WindowsFormsHost element.
This all works fine, except the application is to be used on a touch screen, and the users are having a hard time using the tiny standard scrollbar supplied by IE.
I know how to scroll programmatically, but how would you supply a more user-friendly scrolling mechanism? Only constraint is that I cannot overlay anything over the WebBrowser, and there is no room beside it.
There's a old Code Project article that shows a way to modify scroll bar size. The article is in C++, I think it might be possible to adapt the technique by subclassing the browser window using winAPI, but I don't think it's going to be easy.
ResizeScrollbar - How to change width of built-in scroll bars
Also there's the possibility to modify the scrollbar size at system level ...

Resources