Can anyone explain how to calculate the highlight color based on dominant color in images like Windows-7 taskbar when mouse is over the taskbar item?
Any c# code?
I believe what it does is take the most prominent color in the application's icon using a method similar to this: Python - Find dominant/most common color in an image
With that information, it then applies a translucent radial gradient hue and positions it based on your mouse location. The gradient is more white toward the center of your mouse, but the center is actually off screen. The closer to the actual taskbar item, the more transparent it becomes.
Related
Hello I am developing an app using C# UWP. I have a text box, when I click on the text box the cursor flashes black and white awaiting the next letter. my question is, is there a way to change the color of this cursor? for example changing it so it flashes red and blue instead of black and white. Thanks!
As Justin XL said there is no such api to change color of cursor currently. In another way,
if you feel that the cursor color is not bright enough, you can try to change the TextBox background or the forgorund color to let cursor appear bright. If you do want this feature, please feel free to submit feature request on UserVoice.
I want to add a mouse hover event in C# (creating a windows 8 app) on a irregular .png image that when its main image area (not the entire box or the transparent area) is hovered, its opacity should change.
Can I get a working code for this ?
The alpha channel of a PNG has 256 levels. Where's the threshold? Total transparency or relative transparency? The latter also depends on color and the current background.
What I want to say is that a raster (per-pixel) approach might not yield the desired results.
In some cases it may be better to have a polygon describing the relevant area and check if the mouse position is inside or outside of that polygon.
This way the designer can exclude very faint areas he might redeem not relevant and, vice versa, include areas that would be otherwise excluded.
A compromise between these two approaches is the use of a collision mask that has just 1 bit per pixel and is 0 for don't care and 1 for relevant. That mask would be painted manually by the designer and used to detect if the pixel inside the PNG is relevant or not to the mouse.
I'm working on a simple application with text animations and videos as background.
It's really similar to a simple LED scrolling text and I'm using the animations framework of WPF for this (Storyboards and timelines).
My text comes from the right side and finishes animation to the left side, thus it is visible for the entire width of the window.
Now, what if I want to display this text only in a specific rectangle of the window? The text would normally come from the right and finish to the left, but should be visible only when passing through this rectangle. Imagine it like a "rectangle hole" in the background where the text is shown.
I hope I have been straightforward in my explanation!
Thank you.
Is it an opacity mask you're after?
http://www.c-sharpcorner.com/uploadfile/dbeniwal321/implementing-opacity-masks-in-wpf/
Obviously you won't be using gradients of opacity as seen in the article - you'll use a more strict rectangle outline and play your animation as usual - using the bounds of the mask as the boundaries of your animation.
Text in a Canvas. Set the size and position of your Canvas to be your rectangle hole. With clipping on, when the text is outside the Canvas, it will not show. You just animate Canvas.Left attached property on your text.
I need to move the black square in an arbitrary area of the screen and copy screen area inside black square to area in my application.
How to do it? Thanks.
Take a look at Graphics.CopyFromScreen():
http://msdn.microsoft.com/en-us/library/system.drawing.graphics.copyfromscreen.aspx
As for the movable black rectangle, I'd suggest making a transparent form and manually painting the border as desired. Use the client area size and position of the form as a hint as what to pass to CopyFromScreen().
Ok, so I've heard that the color Microsoft decided to use for there Transparency is Black. Which would explain why black text is invisible when drawn/placed onto a Glass surface.
Wouldn't it just make sense for us to change the transparency color (black) BACK to Magenta? Why didn't they do this again? Is it even possible to change this color?
I'm not sure about chainging the transparent color, but you could render #010101 text and it should be dark enough for black, no? On a glass surface pure black could be hard to see anyway.