How to Add Image Background on MetroFrameWork C# Winform - c#

I use metroframework GUI on Winform. I imported the files correctly. Other controls and properties are fine, but I found a problem, I couldn't change the background of a form to an Image file. I can see a small picture already imported at "Background Image" properties of a form. But the background is still white. Could someone please help? Thanks!

MetroForm I believe only has a Light and Dark Theme (White and Black). This can be changed under "Metro Appearance" > "Theme".
Then you can set a background image under "Metro Appearance" > "BackImage".
To have the image change with the Theme you would set "Metro Appearance" > "ApplyImageInvert" to true.
I don't think there's any option other than the Light or Dark Theme.
Hope this helps
EDIT:
To prove that you CAN add an image to the background using MetroFramwork and to negate the downvote.
Here are some screenshots:
Light:
Dark:
Settings:

In the properties menu set:
1. ApplyImageInvert to true
2. BackImage with your path
2. BackMaxSize to the size of your background image

Unfortunately, MetroForm doesn't support a background image. I suppose it's because that doesn't really fit into the Microsoft Design Language (Modern, Metro, whatever it officially is called).
The reason you're seeing BackgroundImage in the PropertyGrid, is because MetroForm is based on the Windows Forms Form control that supports background images. If you take a look at the MetroForm and MetroFormBase code, you can see that all the painting is overriden and there's not a single place where a background is drawn.
If you really want to have a background in your form, you can fork the project and implement it yourself. It's quite a small addition and shouldn't be much of a trouble.
Edit: To be clear, the original project, or one of the forks of the project don't have a capability to show background pictures on the form. It however seems that at least one of the forked projects do support Form background images using the BackImage property, as mentioned in ryantpayton's answer.

Related

Is there a way to use/create a simple colorslider in a windows form?

I need to include a colorpicker in a form in a powerpoint custom task pane. I want to be able to show a colorslider which shows the gradient going from 0 to highest saturation of a given color, with a draggable control to select the saturation from the slider (like the one in the ColorDialog form). Is there an existing implementation in the api/easily available alternative?
Check the below links
http://msdn.microsoft.com/en-us/library/ms996423.aspx
http://msdn.microsoft.com/en-us/library/ms996423.aspx#colorpicker_topic3
You can try to create color slider with the help of above links.
http://msdn.microsoft.com/en-us/library/ms996423.aspx
http://msdn.microsoft.com/en-us/library/system.windows.forms.colordialog(v=vs.110).aspx
Also codeplex has probably hundreds of similar controls

How to get image control color using C# or Coded UI?

I have one green checkmark (an image control). I have to verify that the checkmark is green. I am not able to get the color. Can you help me?
Coded UI is about checking the functionality of an application. It is not so good at checking the aesthetics (ie colour, size or fonts).
Rather than check the colour can you check some other feature of the UI control for the image? If the green image is not shown then what is shown instead? Try using the crosshairs tool to inspect the green image and also to inspect any other images shown in the same place. Hope to find some properties to distinguish the green image from the others.
You could request the developers to add some distinguishing features. If they do not want to then ask them how a screen reading program for sight impaired people would be able to tell the difference between the images.
For checking colours of UI controls you could capture and image of the controls and then examine the colours used in the image. To get the image use code based on
Image img = this.UIMap.UIYourApplicationsWindow.UISubWindow.UISubSub.CaptureImage();
When testing an application with a page save message, we had an error message that was always there, but was either colored red or not to make it visible or not. I found that the filter property controldefinition had reference to the color of the control. Could you look to see if the color is mention in any of the properties? If not AdrianHHH's answer is your best bet with coded ui.
Sikuli could compare the image if you want to run a little sikuli script from your coded ui test.

Windows aero glass form text problem

I use windows form with GlassForm(using Microsoft.WindowsAPICodePack.Shell;). my problem when I change form to GlassForm my textbox texts doesnt
Place a panel on the form set the dock style to fill, set the panel's BackColor to color X and then set the form's TransparencyKey to the same color X.
Yes, that's how it works. With the Aero Glass effect applied, anything drawn in the color black will be rendered as transparent. That includes text in a textbox control. This general theme has been the subject of many other questions here. When well-written, they gather lots of upvotes, but few answers.
There just aren't a lot of good solutions here. All of them that I've come across qualify as both "ugly" and "hackish". Owner-drawing is a reasonable approach when you're using something like a label control, but I wouldn't recommend trying to draw your own textbox—it's just too hard to get right. Someone tried to do that here; like I said, the result is both ugly and hackish. I wasn't satisfied with it for my own use, but it may work for you, depending on how high your standards are.
The goal with owner-drawing, of course, is either to do all of the drawing using GDI+ (which natively supports transparency) instead of GDI (which all of the built-in controls use by default), or calling functions like DrawThemeTextEx, which is specifically designed for rendering text with a shadow that is [somewhat] readable over glass.
As well, the usual tricks like enabling compatible text rendering (which causes the built-in controls to draw using GDI+ routines, as they did in the early versions of .NET) don't work for a textbox.
Honestly, your best bet is to place the textbox over a region of your form that is not rendered as glass. Use the DwmEnableBlurBehindWindow function to selectively enable the glass effect behind certain areas of your form, rather than the entire thing. I provide a complete, ready-to-use .NET implementation in my answer here.
Check this sample out:
http://www.danielmoth.com/Blog/Glass-In-C-An-Alternative-Approach.aspx
I was not studying it any further but putting a TextBox or Button or other components over this Aero glass area worked - the rendered component didn't have the transparency problem. The labels aren't perfect but these can be easily drawn with GDI+
The direct link to the sample project is here: http://www.danielmoth.com/Blog/MothGlass.zip
It looks like he puts a panel behind the control and setting the TransparencyKey for the panel.

Background color of VS Package Addin?

this may be a pretty simple question.
I've created a VS Package and it has a nice little GUI. The background of the GUI should be System.Colors.ControlBrush:
<Grid Background="{x:Static SystemColors.ControlBrush}">
Now I have the problem, that it changes the color of the Grid, but not of the rest of the window. -> Screenshot
I thought I could change the background of the UserControl the same way, but somehow it doesn't work. Now it doesn't really look that great, if a part of the window is grey and the rest is white.
Any idea?
Your UserControl is probably not covering the entire window.
Remove any Width or Height attributes and make sure that the Horizontal/Vertical Alignments are both Stretch.

WP7 Trouble customizing DatePicker control

I'm using the DatePicker control from the WP7 SL toolkit. It navigates to DatePickerPage.xaml, which has the scrollers for date picking. I want to keep all the functionality, but change the colors. I'm messing around with DatePickerPage.xaml and updating colors to fit my needs.
I've been able to update the text colors on the scrollers and header, but I can't figure out how to update the background color on the selected item in each or the square outline while the scroller is active. Based on tests I have done with changing the background color of the DatePickerPage.xaml, it appears that the selected item and square outlines are an opaque version of the background color. Unfortunately, this wont work for me, since I want the background to the be white and the outlines aren't visible. Is there a way to explicitly set those colors?
If you get the control into Blend and right click on it and select Edit Tempate --> Edit a Copy, you'll get the template for the control so that you can edit it.
What you'll be looking for is the resources keys that are used for the background, foreground, etc. You can replace them with your own resources, or hardcode them, or the best option is to override the resource.
Additional Advice
Be careful though, don't forget that a user can have either a dark or light background to the phone, so unless your app is taking control of the background color of the whole page, you need to consider what might happen when picking colors

Categories