Click through a transparent image in WPF or Silverlight - c#

I need to develop a program that consist of an image (png) with an hole in the center. Under this image there will be a frame and I want that clicking on the transparent hole of the image I can click a button inside the frame. I don't know if there is a method to propagate the click through the image or something else.
Thanks for your help

You mut set IsHitTestVisible to false on the image, then clicks go through.

Related

C# WindowsForms: Reproduce Microsoft control

I would like to reproduce a Control in my WindowsFormsApplication that is equal to the refresh Button of the Windows Network connection form.
Does anybody know which Control it is or how to build a equal one in C#? It seems to be a PictureBox but if you hover it with the Cursor it gets a semi transparent blue colored overlay.
you can use XanderUI for this, add the button, change the button image and change both hover and click background colors to whatever color you like

creating WintRT XAML control : image with a text panel that slide up on mouse over

I need to create a small xaml control (for a windows 8 application / WintRT)
This control is a simple button that surround an image with a text block at the bottom of the image.
The text block should be hiddent and slide up when the user pass his mouse over the button
like in this image:
(source: skynet.be)
I have the button, the image and the textblock, but I don't know how I can hide the textblock and slide it up on mouse over.
Could anyone help me?
Thanks
Replace the button's ControlTemplate with an image and a text block. Use VisualStateManager and Hover state to animate TextBlock.
This might be some help:
Simple hover effect in XAML?

C# - Disable buttons with image

I'm using C# and WinForms.
When using a button with a BackgroundImage property, when I enable/disable the button, the image doesn't get gray... Result : The user is unable to tell if the button is enabled or disabled without trying to click it.
When using a button with a Image property, the image's behavior is correct but the image is not centered in the button !
As you can see in the picture, the first button uses BackgroundImage , the second one uses Image property but the minus sign is not centered properly... How can I manage this enable/disable state with a proper image's behavior ?
Thanks in advance !
I was doing the same thing some time ago and everything worked out by just using the Image property. You could try to set ImageAlign:
button.ImageAlign = System.Drawing.ContentAlignment.MiddleCenter;
Maybe increase the dimensions of the button to see if that changes anything (maybe the image is just too big for the disabled button. All I can tell you is that it should work perfectly using the Image property.

How do I scrape what a transparent panel shows into a bitmap?

Question:
How do I scrape what a transparent panel shows into a bitmap?
Background:
I need to make a form that sits on top of everything and blurs part of the screen but doesn't stop the user from interacting with it. Odd... I know.
I created a form and added a panel to it. I then set the set background color of the panel to red. Then set the form's TransparentKey property to red and topmost = True.
So now I have a transparent panel. Cool. I can interact with the app below it. Cool. Now I just need to add the blur. I would like to take what is showing on panel1 and blur it then display on panel2 that sits over the top of panel1. Or at least that is the idea.
Important detail:
DrawToBitmap() just shows the red background.
This is running on XP.
Yes, DrawToBitmap(). But not on the transparent panel, on the one that's underneath it. If that 'panel' isn't actually yours then you have to use Graphics.CopyFromScreen().
Not sure what you intend to do with it, but drawing the blurred image in the transparent panel will make it non-transparent and you cannot interact with the underlying window anymore. Also, don't use Red, you'll get unintended transparency if the underlying window contains any red. Color.Fuchsia is a good choice, it is a fuchsed-up color.

How can I develop scale like measure it add on in Firefox

I want measuring tool in project that will be same as measure it in Firefox (add-on). How to do this?
To get such a think to work you'll need an application that runs as a tray icon or something like that. Then you open your application and tell him, that you'd like to measure.
Now, you'll go and put a transparent window onto the whole screen(s) and wait for a mouse move event. Within the mouse move event, you'll check the mouse button state. If it is going to be hit you know the starting position and you can draw some kind of user-control at this position and if the user releases the mouse button, you're going to stop the resizing of your user-control.
The user-control itself should be semi-transparent and checking for the resizing and/or paint events, to draw the ruler lines around the border.
Last but not least you can show some kind of tooltip or labelcontrol in relation to the position and size of your user-control and screen bounds to give some status informations.
To get a good starting point about how to get the transparent overlay part done, you can take a look into ObjectListView Overlay.
--EDIT--
One solution could be:
Create a separate transparent windows form
Upon certain key press, for instance Ctrl+Shift+R, show your app with lower transparency level; so that user can see the background.
Draw ruler upon form load
You may allow user to move the ruler window with mouse click.

Categories