Microsoft guidelines for creating WPF "gel" buttons - button

Anyone know where I can find the Microsoft guidelines for creating WPF gel-type buttons? I'm not sure if "gel" is the correct name for this effect but I have heard many people use the term. If MS doesn't have a guideline, do you have some other standards or guidelines for creating these buttons?

Have a look at the glass button.
There are a number of XAML elements
which go into making up the button.
They are clearly commented in the XAML
but the list is as follows:
Drop-shadow: an ellipse with a radial gradient of black fading to
tranparent
Button surround: a white ellipse slightly bigger than the green one
Black button background: only visible round the edges of the green
when the button is pressed
Main button colour: the green (or whatever color you want) of the
button. This ellipse is clipped to
its initial outline, thus allowing us
to move the ellipse slightly for the
button press without it overlapping
the button surround
Top glow: an ellipse with a linear gradient background of white (at the
top) fading to transparent. Smaller
than the main button colour and
positioned so that the tops are the
same
Bottom glow: an ellipse the same size as the main button colour but
with a linear gradient background of
white (at the bottom) fading to
transparent. This is also clipped as
per the main button colour.
Hover-over glow: an ellipse the same size as the main button colour
with a radial gradient background of
white (at the centre of the ellipse)
fading to transparent. This is
initially transparent.
Transparent element for catching mouse events: on top of all of this is
a transparent ellipse the same size as
the white button surround for catching
MouseEnter, MouseLeave,
MouseLeftButtonDown and
MouseLeftButtonUp events. This
element also contains the Storyboard
for the pulsating hover-over effect
(although this could be in any XAML
element).

Related

Stop QLabel text blending with background colour

In short
I'm trying to get the text in my QLabel to paint as if it were over a black background, ignoring the real background colour.
In depth
I have a QLabel in a green coloured widget, the text is anti-aliased and white, the anti-aliasing softens the edges of the text by blending with the green background colour.
Hardware detects the exact green colour and uses it like a green screen to display some techno-wizardry without also drawing over my software overlay, it makes the background look black.
The anti-aliased text has a fuzzy green halo where it has slightly changed the green colour and hardware doesn't overwrite it.
I want the text to be draw as if it were over a black background
What I've tried
I have tried using a black opaque QGraphicsDropShadowEffect to be drawn under the text, thus giving the text a black background to draw on, this led to a bigger green halo around the text.
I have tried setting various QBrushes in the label's QPalette for the Qt::WindowText and Qt::Base ColorRoles.
I have re-implemented the paintEvent and I am trying to use style()->drawItemText(... ) to avoid re-implementing all the helpful alignment code.
I have tried intercepting the QStyleOpt parameter and setting its QPalette's background colour to black, however that didn't change anything, I still get fuzzy, greenish text.
I have tried various QBrush and QPen colours in the QPainter.
I'm really close using a QPainterPath in an overidden paintEvent function (in a class extending QLabel) where I paint a black path of the text behind the text, then I call QLabel::paintEvent and let it draw the text over the top. The issue here is that in some cases the path is clipped to smaller than the widgets rect() on the left hand side, scope for another question I think!
What I could try but haven't worked out yet
I could give the text a black outline as per this question however I'm using a QWidget not a QGraphicsView text item, and then the black outline would still probably blend with the green background.
Compromises I've already thought of and want to avoid
I could set the QLabel background to black, leaving large rectangles of black over the resulting overlay, unfortunately the labels are often much larger than the text being displayed.
I could stop the font being anti-aliased, this looks quite ugly and it stops all fonts being uniform across the product.

Click through transparent area of an image

Can html/css, natively, click through the transparent area of an image?
I'd like to place two buildings side by side. And if a user clicks on a transparent area (green) of the nearest image, the click would pass through and go the the farther (the taller one).
I've already checked, with no luck:
Click through transparent area on partially transparent image
Click area on sprite in canvas
html/css alone might be very difficult. Even plus javascript, because when you click on the red house picture, the event is triggered on the picture itself. And the green area you defined is not a square. it is hard to define such a area simply in html/css.
My suggestion would be add another picture of that green shape, with the exact content of it and put it on top of the red house picture.
As a result, you have three pictures with the farther one at bottom, the red house on top of the building, and the special shape made from the building on the top of the red house. So when people click on the transparent area, they actually click on the special shape instead click on the red house picture. Then you can attach a link to the special shape of green area so it link to the two levels building. This is the easiest method I can think about.
Hope it helps.

Display Color Wheel using CSS Sprite Technique

Provided the color wheel image how can we display it using CSS Sprites technique adding hover effects over the red, blue & yellow areas ? Clicking on any color area should open respective links.

How to create a button on our desire shape like circle, star in flex 3?

I would like to customize the shape of the button to different shapes like circle, star, square or of any shape. How would i achieve so?
I apologize because this doesn't answer your question, but:
In order to make sure the user can reliably click on your button, you probably want it to be a convex shape. A rectangle or circle is fine, and you could paint a star on it. But you wouldn't want the user to try to click your star and miss, just because they were not quite inside one of its arms.
Canvas can be used as button.
Take a canvas of required size. Give your required button shape(image) as background image to canvas.
Example:
Explanation: {nextYellowButton} is the embedded button. It is an arrow mark shape button.
It is a .PNG image. So, it doesn't include the background color.
Now your button is of arrow shape. it occupies 50px * 50px area on screen. But it looks exactly like an arrow mark.

How to imitate shadow around the thumbnails by StretchDIBits?

I am now writing a image viewer, It is used for view thumbnails.
As it is ugly, I decide to draw shadow round thumbnail.
There is background color.
I am using StretchDIBits to draw a shadow image at the location of thumbnail.
However it is really annoying that it cover the background color...
When the background is white, it looks perfect.
but if the backgound is not white, it has a white border.
so I make use of AlphaBlend, first draw the shadow image onto a DC, then use AlphaBlend onto the background. However, I can still see the white border.
Is there any why to generate a perfect shadow , no matter what background is.
Are you sure the shadow bitmap contains alpha values for the alpha channel ? I.o.w.: how are you creating the shadow bitmap: are you doing that by blurring a square on a transparent target or a white target? If the first, the shadow bitmap contains an alpha channel and should blend fine with the background. if the second, your shadow bitmap contains white fragments and thus will blend that white with the background.

Resources