I am new to C# WPF and working on somebody else's code.
(WPF version 3.0.6920.5011, as read from HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0\Setup\Windows Presentation Foundation)
I already gave a look to various (quite old) Stackoverflow solutions, but they don't seem related to this problem: WPF Blurry fonts issue- Solutions, Text is blurred when transformed in WPF.
WPF: Why does text and elements blur if I use dropshadow effect on a parent item looks interesting, but there are no shadows applied to parents.
I observe this "blur" effect whenever an element is included in another one, and it is more and more visible as the inclusion goes deeper:
Device tab's text is perfectly readable
Global, Common and Inputs tabs' texts are lightly blurred
Pane inside Inputs is highly blurred.
Alas I cannot provide XAML files because of company rules, but there are no settings about ClearType, applied shadows nor to blur effects.
Is there anything else I could check?
Thank you in advance
Add this to your top-level <Window> tag:
TextOptions.TextFormattingMode="Display"
This was first announced 10 years ago in a Microsoft post, it's amazing how to this day so few people use it.
Related
I've been searching for a bit on how I can display scalable media on top of a WPF Bing Maps MapControl, but I cannot find any example code or a solid solution to my problem.
Here is the control documentation:
https://learn.microsoft.com/en-us/previous-versions/bing/wpf-control/hh750210(v=msdn.10)
I'm generating a grid that represents a density map, which then becomes a bitmap image. This is fine, I have the image. How can I overlay this image onto the map with some transparency such that the user is able to move and scale the map if necessary?
My initial thought is to create a tile layer and add it to the map control since I know the size of each square and its lat/long, but there doesn't seem to be many examples of anyone doing this online. The documentation is somewhat scattered as well, and more heavily focused on UWP:
This appears to be exactly what I need, but it is a UWP control - https://learn.microsoft.com/en-us/windows/uwp/maps-and-location/overlay-tiled-images#overlay-tiles-from-local-storage
This also appears to be useful but only has XAML code, no actual C# showing what the buttons do...
https://learn.microsoft.com/en-us/previous-versions/bing/wpf-control/hh868033(v=msdn.10)
Okay, the next thought was to make the image, then scale it appropriately and overlay the media onto the map using this documentation, but again, only XAML code is shown as an example. https://learn.microsoft.com/en-us/previous-versions/bing/wpf-control/hh868032(v=msdn.10)
Has anyone done something like this in WPF? I'm a bit lost.
Thank you.
In a legacy product we used Sheridan controls to produce buttons that looked like this:
Is this style of button available in C# using VS2005?
The way buttons looked over the history of GUI development was affected heavily by machine capabilities. It all started with simple rectangles back in the late eighties, back when operating systems were 16-bit and video adapters could display only 16 colors. The 3-D style became vogue in the nineties, Sheridan was an early pioneer and was widely copied. Threed.ocx was a Microsoft library to get this styling. Empowered by video adapters being capable of 256 colors and enough horse power to draw the beveled edges. Some remnants of it persist in Winforms through the BorderStyle property.
By the time Winforms started, early 2000's, video adapters could display 16 million colors and elaborate gradients became the vogue. Clearly visible in the default style of a Winforms button as well as controls like ToolStrip and StatusBar. And Windows visual style themes. A significant disadvantage of this styling is that it cannot easily be overridden. Winforms has four distinct button renderers (note the FlatStyle property), they are all private classes that cannot be overridden. They are too elaborate to easily expose.
This has gone full circle, we are now back to simple flat rectangles. Very noticeable in the default styling for WPF buttons and the Metro theme in Windows 8. No longer affected by machine capabilities but (possibly) the limitations of CSS, the language used to give web pages their styling. Winforms supports it too through the FlatStyle and FlatAppearance properties.
Trying to resurrect the 3-D style is not so easy, you'll have to create a custom button control from scratch with ButtonBase as the base class. And override OnPaint() to draw the button the way you want it. It is pretty questionable whether you should even try, the 3-D style is definitely out of vogue and too strongly associated with old programs that stopped being maintained. Not the kind of association you'll want in a new program.
If you want the buttons exactly like that have you considered using images for the buttons? That way you just simply take an image of that style and make it into a button. You get all the functionality of a button but you also get it to look like you want it to.
Is it possible to display an icon in the top left corner of a Windows Form that is a different shape than the standard 16X16 pixel icon?
It appears that Skype has an icon that is much wider than standard:
Is it possible in a Windows Forms app?
You can do this but it's probably more effort than it's worth just to have a larger icon.
Hans has posted an article that roughly points to the information needed to figure out an answer this question, but hasn't posted an answer itself and so I'll clarify.
The old (pre Vista) way to do this is to override the WndProc method on your form and handle the WM_NCPAINT message. Note that this means that you are now responsible for drawing the entire window frame (the window border, title, close / restore icons etc...), not just the icon - i.e. this is a lot of effort to do a relatively minor thing.
The newer (post Vista) way to do this is to use the DWM API - note that this API is not directly exposed through the .Net Framework and so you need to use P/Invoke for this in C#. The bit that you want to do is the section titled "Drawing in the Extended Frame Window", where you extend the area that you are responsible for drawing outside of the normal client area and into the window frame. This is less hassle than it used to be (you don't have to draw things like the close buttons), however still means that you take responsibility for a lot of things that you wouldn't normally, like hit-box testing for resizing and moving.
Basically its nowhere near as simple as providing a larger icon and for most applications its probably way more effort than its worth, however you can do this in C# and that article should get you started if you really want to give it a try.
I know your looking for a plain code way to do this, but I invite you to check out DevExpress manged (yes it's third party forgive me), just google it.. I seen this thread and I started asking questions at devexpress with support and got some impressive results that you might be interested in.
Here is the ticket I put in... http://www.devexpress.com/Support/Center/Issues/ViewIssue.aspx?issueid=Q399941
Here is the result... http://www.devexpress.com/Support/Center/GetSCAttachment.ashx?id=684270b5-faed-415e-9010-64338523f8cf
So Far I used this on Xp, Vista and Windows 7 without problems using winforms only.
I hope this helps or gives you another option if the windows API don't pan out like you want on different versions of windows.
Thanks,
David
Don't think it's an icon, if you mean precisely the ICO image format.
Considering the Skype window is definitely ownerdraw window, that image can potentially be whatever you want format.
The trick is, basically, render an image skipping the pixels of some color (background color) of the "icon", so render it in "transparency".
This article can give you a hint:
Drawing Transparent Images and Shapes using Alpha Blending
It's old, but always a good one.
Yes. Override WndProc and implement WM_NCPAINT.
This is my first question on stack-overflow so don't kick it))
I have a problem trying to create a Mac-style slider control. I have found this solution and I have implemented it in my solution, but it still doesn't satisfy me cause I need a more universal solution.
Basically I need to create this slider control with the help of four pictures - right, left and center(the rest of) pictures of track bar and one picture for thumb. These are PNG files.
Could I style default WPF slider to support such resource-oriented behavior?
I'm really astonished that all samples includes templates for style but no one supports something like
<TrackBarLeft>
<Image for left>
</TrackBarLeft>
....
Could any one give me a solution for this problem?
Thank you very much
Sams "WPF Control Development Unleashed" has some guidelines on this. Check out Chapter 5: Using Existing Controls - it has an example based on a scrollbar - it might be useful.
I'm writing an app in C# WPF and I'm hoping to implement a similar kind of touch-based horizontal scrolling that's featured prominently in Windows 8.
At the moment I'm using ScrollViewer with content inside it. This works fine as far as the scrolling is concerned, but it creates problems when interacting with controls inside of it (for example, sliders).
With my limited programming knowledge (a month ago the most I'd done was create a mockup in Photoshop :P), I'd assume this was because the touch hits the ScrollViewer first? Is there some way of flipping this around? I would be happy even if you had to hit a white space to be able to scroll, I just need the user to be able to interact with the controls inside easily without accidentally scrolling all over the place ^_^
Unfortunately, I can't just code for Windows 8 as this is specifically for a bunch of touch-enabled Windows 7 machines.
Look for the Metro theme here you might find some usful style here that you can modify and use..
Also you can check this website for information and guidelines on Metro UI on WPF