Blinking or glowing button in C# - c#

I'm wondering how to create blinking or glowing "Alarm!" button/image.. For image -> one normal jpg, and one gif? Any easier solutions?

You might this useful - http://www.codeproject.com/KB/buttons/VistaButton.aspx
Easy way is to create two image files , one with the glow, another without it . When the app receives the alarm change the button image .

The buttons in Windows Vista and Windows 7 already glow and throb by default when the user mouses over them, and/or when one is set as the default button for a form. The effect looks like this:
If you're not getting this effect already, make sure that the FlatStyleproperty of your button control is set to "System".

Related

Clickable Screen overlay in C#

I am looking for some technologies or ways to create an application which should work like an active (clickable) overlay.
Let's say that we have running application which is always on top. My idea is to create a section on the left or right side of the screen. I'll try to explain in the fast sketch below:
As seen from the image, not only I want to create overlay which is on top aswel, but I want to adjust screen size for "App running always on top"
Is something like that possible?
If so can you please navigate me to the right direction?
PS: My app should have some clickable elements like radio buttons etc.
Thanks a lot
I think you want something like the window that appears when you right click an icon on the Windows taskbar. This is just a Windows Form without titlebar (here you can read how to hide titlebar: https://stackoverflow.com/a/7483026/14940782).
Then, you can add Opacity or BackColor to the form to make it semi transparent or with some color you want. BackColor allows Transparent, by the way.

C# - Windows Form loaded with images on PictureBox : Can they be turned invisible or hidden into another color?

I'm trying to create an image matching game in C#.
My idea was to load all the pictures when I create the form. Then, when I launch the program and the form loads, I wanted to turn all those icons to black, hiding the pictures.
I've tried changing icon.BackColor = Color.Black but it doesn't do anything. Setting the visibility to hidden is also not an option.
Is there a way, or do I need to load the pictures individually using image.fromFile... went he form loads?
EDIT : As I was not able to find a way to answer this question, I took another approach. simply loading only black colored pictureboxes, attributing a random assigned name to each of them corresponding to an image. And on click, this image is shown.
As I was not able to find a way to answer this question, I took another approach. Simply loading only black-colored picture boxes, attributing a randomly assigned name to each of them corresponding to an image. And on click, this image is shown.

Balloon pop up over control mouse enter/exit

Hello,
Above is the program I am writing. On the right panel is basically two custom controls (the blue rectangle area) I created and just added them as controls to the background panel control when this winform program loads.
I used MS paint to draw out the pop up balloon that I want to see when my mouse enter this control's area. I want to do the following:
1. If mouse enter the control area, the yellow area balloon pop up and populate with the information of that specific control
2. If mouse move out of the control area, the pop up balloon disappear.
Can this be done with Winform application? I looked around and found out about Tooltip class but so far from researching I don't know if it does what I want to do.
I could be wrong but googling around gave me the impress that Tooltip offers very little in term of style. Ideally I want to make this pop up balloon into almost like a border-less pop up window where I can put image , font ect.....at will. Also Tooltip works if you hover over a button or specific field whereas I want the entire control area.
Can this be done? I appreciate if you can point me to any work around if there is one.
I wrote a comment, but I figure I'll expand it into a full answer. This is assuming you want a new control, which isn't a tooltip, for maximum customizability. I did something similar to this for work recently, to act as a non-modal info popup that disappears when clicked.
Creating a Custom Popup Form
What you want is essentially a floating popup that appears over your form, which means you'll want to define a new Form object, rather than a UserControl, as it won't actually be embedded within your other form.
Give it a multiline, non-editable textbox that you can fill with the information you want to populate, then simply call a new instance of the form on your Mouse_Enter event. Close it upon Mouse_Leave.
Adjusting The Style
You'll have to play with it a bit to get it to actually act like a popup and not just a window. I'd recommend setting it to a non-modal popup, and removing the border. You can write a function to automatically size it to its contents. I don't imagine you'll want the user manually resizing it.
Some other things to look into would be overriding the CreateParams property that comes with the basic Form object. You can force DropShadows and TopMost forms without making the form modal. Overriding ShowWithoutActivation to always return true will prevent the form from stealing focus when it pops up.
I'm not sure if you can pull off rounded edges like you have in your mockup. Perhaps you can pull it off with some wizardry in the OnPaint() function, but I couldn't tell you how to do it.
It might be a bit of a pain for fiddling around with, but you can get some good functionality and appearance out of it. If you think you can pull it off acceptably with the ToolTip class, go for it. It took me about a week to get my notifications where I wanted them (though I added several features that you probably don't need to worry about).
Examples
Some keywords to look up in related searches would be Toast Notification and Non-Modal Popup. This might be some use:
http://www.codeproject.com/Articles/442983/Android-Style-Toast-Notification-for-NET
Since you already have implemented custom user controls you might want to try it again. Make a control that is that style and color, changes it's size based on it's text. You can feed it information (such as the text to display) from your existing user control object. You can also have the mouse enter/leave code reside in your first user control.
If you're not sure how to make a rectangle with round corners you can either make it on the fly using a graphics object (which will turn into a bitmap on the screen) or make it how you want it to look in GIMP (or photoshop if you have it) then use that image as the background on your user control. Make the default background transparent (so your voids above the round corners are not grey). If you make a pre loaded image you'll need to be aware you will only be able to scale it equally in Y and X directions. unequal scaling will make it look distorted.
Can you use the Mouse_Enter event on the control?

transparency in windows forms C#

if the transparentkey property is used to make the top level form transparent,it works , but it also makes the main form click-throughable. I want the opposite of this, that the form becomes transparent, but is still able to recieve clicks. can this be done ?
Here is een solution. The form is totaly transparent and still clickable.
There is also
myform.Opacity = .75
.. which you can change as required. It may work better depending on your needs - you don't state whether its the whole form or only part of it you want transparent. Also, from MSDN on TransparencyKey:
Any mouse actions, such as the click
of the mouse, that are performed on
the transparent areas of the form will
be transferred to the windows below
the transparent area.
.. so it would seem that wont help you at all.

WinForms (.NET) Button Anchoring when Maximized

Ok, I have googled, but maybe I put my search in weirdly. :/
I have a VB.NET WinForms application. I have the anchor properties set for all the controls so that it will resize all the controls to look decent when the form is maximized. (Haven't gotten around to manual resizing yet however).
Anyway, the problem:
I go to set the same properties for a button (testing with a single button for now) on the main GUI form/picture. When I go to run the program via F5, it looks decent. But when I maximize the form, the entire button covers up more than it should.
I've taken screenshots of the form so you can see a visual of what I'm talking about. :/
Before: http://zack.scudstorm.com/before.png
After: http://zack.scudstorm.com/after.png
What other propert(y|ies) do I need to set for the buttons to show up correctly? :/ (The buttons go over the boxes that say, for example, "1-1", "2-3", etc.
Thanks,
-Zack
Seems like you have anchored top-left and bottom-right when what you want is just top-left.
Edit: If it's just an image that does not change when the winform changes, then don't anchor your buttons at all. Just put them where they go. If you are scaling the image, then I would either detect the clicks on the image and do the scaling math or do the scaling math and set my buttons in code in the Form.OnResize event.
As it appears that your goal is just to be able to handle clicks on the "computers"...
One option that can be useful for this sort of task is to create an "overlay" bitmap (not displayed, but which is the exact same size as your source bitmap) which uses different colors to represent all the clickable regions. (e.g. (R=0,G=0,B=0) for computer 0, (0,0,1) for computer 1, etc)
You could even generate this bitmap somewhat automatically without too much trouble (If you have a mode where you can click the top left and then bottom right corners of the image to define a new region)
When the mouse is clicked, you can check the pixel at the scaled coordinates of the mouse position in the overlay and determine what their click corresponds to. This can be a lot easier than creating loads of controls, and makes it a lot easier to have clickable regions that aren't rectangular.

Categories

Resources