How to get this style of buttons in C#? - c#

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.

Related

C# WPF: Blurred Text

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.

Give application the same visual appearance as Visual Studio

This might be an easy one to answer as I'm probably just Googling for the incorrect search terms.
I'd like to change the visual appearance of my application to look more like the interface of Visual Studio 2013. Now with VS you can choose between three color themes (blue, dark and light). I'm trying to Google for ways that I can give my application that sort of look but any search for "theme" or "color theme" results in plenty of hits for how to choose a different color theme for VS.
I'm not so much interested in the colors as such but more the "flat" appearance for lack of a better word. Notice how my application has the standard Windows frame, standard minimize, maximize and close buttons at the top right and how the form's title bar, menu strip and tool strip are all different colors. On the Visual Studio UI, these are all one color and so appears to form a single unit. I also like how the form doesn't have any more border around it than is really necessary. The form basically consists of a "header" at the top (combined title bar, menu strip and tool strip) and a status strip at the bottom. Between those there is nothing but usable real estate, no silly border around the edge.
Is there an easy way to achieve this for my own applications?
This isn't possible with WinForms.
It's possible, but really really hard to achieve and not recommendable.
You need Windows Presentation Foundation.
Why?
First of all you need hardware acceleration. The UI in WPF is DirectX rather than GDI+ (WinForms) so it can make use of the acceleration and processing available in DirectX, and work in 3D.
Visual Studio it self is build with WPF.
If you want a fresh modern Look for your WinForms Application i would recommend Metro for WinForms (WinForms on steroids).
You also should look at ComponentOne Studio WinForms Edition. Maybe one of the 25 designed themes for WinForms suits you.
You need to use WPF for the same
https://msdn.microsoft.com/en-us/library/ms754130%28v=vs.110%29.aspx
https://visualstudiogallery.msdn.microsoft.com/7a4362a7-fe5d-4f9d-bc7b-0c0dc272fe31
For Screenshots:
https://github.com/firstfloorsoftware/mui/wiki/Screenshots

Embed button control into existing Direct3D application

I would like to overlay own content above a Direct3D v9 game (made by a third party).
Overlay Interactive Button
Specifically, I would like to overlay a clickable button control, like Steam does, for instance, though I'm attempting a much simpler interface.
Ideally, I would be able to overlay a WPF button or a Windows Form button or whole UserControl, but if that is not possible then creating a functioning button from primitives would suffice as well.
Text Overlay Working with SharpDX
I have a working sample of overlaying text based on the work of Justin Stenning
Namely with the help of SharpDX.Direct3D9.Font DrawText method
How to Overlay a Button or UserControl with SharpDX
I looked through relevant samples in https://github.com/sharpdx/SharpDX-Samples but was not able to find a way to include or draw native controls with SharpDX
Is it possible?
If not, are there any samples of drawing a clickable button from scratch?
Please bear in mind I'm a novice in the DirectX world :)
Your biggest problem isn't going to be getting the controls to render on top of a DX scene; it's going to be getting them to respond to input afterwards. You can probably rig up a way to get the visuals copied to a DX surface, but I have no idea how you would capture input, translate it, and deliver it back to the WPF components. If it's even possible, it's almost certainly more trouble than it's worth.
There are a couple game-oriented Xaml solutions out there that you may want to check out. WPF for Games is a partial C++ implementation of WPF based on Direct3D, and there's also the proprietary Noesis GUI.

Windows Phone/Windows 8-style horizontal scrolling in WPF?

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

How to select, display and save regions of a graphic?

So here's the situation: I need to take a (user-specified) graphic, and allow the user to define and label regions within that graphic. For example, if you uploaded a picture of a face, you might want to define "right eye", "left eye", "nose" etc. Also, having defined the regions, if I select a previously defined region, it should be highlighted on the image somehow. These regions are (obviously) not necessarily rectangular, and they cannot overlap. And if you click within a defined region in the graphic, I would be able to identify which region was clicked on.
There are a couple ways I can think of for doing this, none of which are quite satisfactory. Another developer before me tried doing it with a transparent grid overlaid on the original graphic, fiddling with the background alpha/color for highlighting regions, but I think they rather kludged it. I could either get my hands really dirty trying to clean up their code, or try a completely new approach.
What would you suggest for maximum speed and user-friendliness?
Bounty added: for the best solution that will get me up and running in the minimum time.
The GraphicsPath class is made to do this. Keep a list of them along with the image. Draw the image first, then Graphics.DrawPath() to draw the regions on top of the image.
Hit testing is simple with GraphicsPath.IsVisible(). Iterate the list in reverse order so overlaps work.
Assuming you haven't decided yet on the technology you'll use, I'd suggest WPF; I find most graphics-related tasks easier with WPF (at least in version 4) and it's specifically geared for interactivity, so creating non-rectangular regions using mouse clicks and hit-testing clicks to select shapes would be pretty easy. Loading images is also easy.
However, if you haven't used WPF or Silverlight until now, there is some overhead in learning the basic concepts and APIs; so I'm afraid there's no real way I can recommend it as a maximum speed solution without knowing your (or whoever's will be working on it) competencies. That said, using MVVM and WPF would be definitely the maximum speed solution for me. Also the maximum user-friendliness since WPF enables quite interesting interaction models out-of-the-box, like multi-touch support (that's the trendy one that should be mentioned, right?) and easy non-standard layout and placement of controls.
You need polygons, saved as list of points. And you need hit testing for them. See the link:
http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/40ebadc1-6154-4c7c-9cb1-d608a426b29c

Categories

Resources