How to overlay white text on a white background in WPF so that it is viewable - wpf

My WPF VS 2008 application is working with many different images that are assembled and displayed at runtime. I would like to display some white text on top of those images. My problem is that some images contain a white or light color background.
My question is - is it possible to somehow specify a property or specify a setting in the image object, BitmapImage object (where the image is loaded from), or some other WPF object such that when white pixels from one image overlap white pixels from the other image - they turn a different color so the text will be viewable?

I think it depends on how you 'draw' your text on the images. If you use e.g. a Label, you can try out the 'DropShadowEffect', see: http://msdn.microsoft.com/en-us/library/ms748273.aspx
This effect should work with all WPF objects and you can try out some transparent black soft shadows surrounding the text (a little bit like a glow).
This will only be visible in bright environments if you adjust the opacity right.

Decided to use a dark background color for the text that is only partially (.35) opaque. This means that the background color of the image comes through for the most part, but for lighter colors it yields enough contrast so that the text is viewable.

Related

Need overlapping button in round cornered Winform

Need a quick suggestion for styling a WinForm. I made it with rounded corners even when re-sized. Now trying to add a close button with a image (ControlBox=false), overlapping or clipped to top right corner. This is what I could end with.
But I wish to make it more like in this example image.
How could I achieve this in WinForm.
Here's the trick : your window doesn't just end with the white part. It extends a little bit further. The close button comes under the 'extra' part. The other sides where the window appears to not be there is actually transparent...or in the case of the image, semi-transparent.
The glow effect is provided by the window. Set the TransparencyKey property of the window to Color.Magenta (its a convention as Magenta is the color least likely to be used in a window). Then set the background image to a white background with a little bit of Magenta in the edges. The Magenta will appear transparent when set as the background image.
Fiddle around with TransparencyKey and you'll understand what I mean
Winforms itself cannot provide this for you without outside manipulation of the windows,
because it still uses win32 windows classes in the background.
If you want transparancy in windows: see articles like:
Cool, Semi-transparent and Shaped Dialogs with Standard Controls
And the method in Win32 to do it:
SetLayeredWindowAttributes

Canvas background color not as white as I need

I am setting the background color of my Canvas as 'white'. However when I compare my canvas with a vendor application, their canvas is 'whiter', which is the color I want for my canvas too. I have looked at all the color choices available for canvas background color but nothing makes my canvas any whiter than it is. Any suggestions would be appreciated.
Simple solution:
Use one of the browser plugins to get the actual "white" color of their app.
One example of a color-picker is Chrome plus the ColorZilla extension:
https://chrome.google.com/webstore/detail/colorzilla/bhlhnicpbhignbdhedgjhgdocnmhomnp

how to Paint non-client area in winForms transparent? .Net 4

im developing a custom form and i want that the non-client area be transparent. im handling the non client area painting via message number "0x85" and this is what i have tried so far:
Paint using the color "Color.Transparent" -> the non-client area was painted black. If I had used an image of red or black or green, it works perfectly, but transparent = black
Created a transparent image of the size of the form and used the method "myGraphics.DrawImage("img.png")". the background remained black. If I had used an image of red or black or green, it works perfectly also...
Not paint anything (hoping that i just would stay transparent)... not worked
Getting parts of a window transparent requires hardware support, a video adapter feature called layering. Use the form's TransparencyKey property. Set it to an unusual color, like Color.Fuchsia. And draw with that color to get the video adapter to omit the pixels.

Create a GUI for Application

I have to create a program that starts with a splash screen and a transparent image, but in windows form not working there always the white background, how can I do?
You need to set a transparency key. If you set it to white, it will make everything that's white on the form transparent (doesn't work well with the picturebox control though).
So for instance, you create a panel, and give it the background image you want to be displayed, then set the transparency key to whatever color should be made transparent ;p

Transparent accent color

I want to fade some elements (rectangles and ellipses) from the accent color to transparent using a LinearGradientBrush. However - the transparent color is always a color and it seems like the color "Transparent" is #00FFFFFF - that is white with 0% opacity.
I would like to fade from PhoneAccentColor to PhoneTransparentAccentColor. So if my accent color is red I would like to fade to #00FF0000 and if it is green I would like to fade to #0000FF00.
I can't find any built in color resource for transparent accent so what are my options here? I've tried the options below but with no real success and I can't find much on this topic by normal search channels so I'm not really sure what I'm missing here.
Some suggestions I came up with (however with no real success as stated earlier):
Create a custom resource in code behind and push it into the application wide resource dictionary?
Can I expose a property on my ViewModels with the Color and bind to it?
I can't think of a way to specify a transparent accent color directly with xaml. I do have a couple of possible solutions.
If possible you could animate the opacity of the object rather than the color itself.
Of you could generate the color in code (probably during start up)
var accentColor = (Color)Application.Current.Resources["PhoneAccentColor"];
var transparentAccentColor = accentColor.A = 0;
You could then store the color as a resource and reference it in xaml.
Application.Current.Resources.Add("TransparentPhoneAccentColor", transparentAccentColor);
Hope this helps.
As a general guideline, avoid using gradients on the phone due to the colour support available.
You could try using an OpacityMask in your LinearGradientBrush to achieve your desired results though.
Although not applicable in your case as you're using the accent colour, if you were able to produce images including gradients you should see How can I correct color banding in windows phone 7? for detais on how to avoid banding.

Resources