Disable save file for default image in a picturebox C# - c#

Basically I have a simple tool that loads an image into a picturebox from a url. I've added savefiledialog for people to save the image to their drives on click if they wish to do so.
On-load I have a default image display in the picturebox from resources.
My problem is that it allows people save the loaded default image. What I want to do is only allow them to save the images loaded from url not the actual default image that loads when the tool is started, sort of disable the savefiledialog if the image is the default one or something to that effect.
How do I go about this? Thanks.
Edit: The default image comes from resources and is on load. Everything works except I dont want them to save the default image, only the images they load manually.

Add a boolean flag to your class indicating whether you've loaded a "real" image.
If that flag is false, don't show the dialog.

Related

c# picturebox size changing from display option being set to 125%

I have a form with a picturebox in it. I have to set the picture box to stretch image( I don't care if it changes the resolution of the picture) and I load the picture at runtime. Then I want to put buttons on the picture and I read these locations from a file and these locations change depend on which picture is loaded. All works good on my laptop but I do not account for the fact under display you can make text and other items larger. This laptop is set to 125%. What do I use to scale my points or can I just turn this off for my program? I would prefer to just turn it off. It changes my splash screen too.
I am using Visual Studio, C#
I found the answer to my problem. When I would load my VS project on a machine that was set to 125% it would actually change the size of my controls inside my project. If you do not want visual studio to change the size of these control you have to set display text and images to 100%, load your VS project, add autoscalemode = none, then close the project, change display text and images back to 125% then all should be good.

How to show animated gif in tree views?

I need to use a blinking icon as an image for a specific item in a tree view. For this, i tried to add an animated gif file including two frames, one including the image and one an empty frame. I could add the image to the image list in designer. But it doesn't blink. I tried to figure out what's the problem, but i couldn't.
Any idea?
Default Windows Form does not support any animation, that's why gif file look like static image, when we use it in windows forms. If you are using windows form, then use timer control to redraw the treeview. Or use integrated wpf content in windows form(my choice)

Copying an image within my Windows Phone App

I am writing a Windows Phone Application in C# and on my application page i have an image object that is currently filled with an image. However i have another image object on the same page as well as a button object. What i want to do it click the button, and once i have done so i want to copy the image from the filled image object and paste it into the blank object.
Is there a way of doing this, i read something about the use of a bitmap to do so but i'm not sure how to do it? Any examples or ideas of what code i could use would be greatly appreciated.
You can remember Image.Source and pass that to the other page and set it as a source for another image control.
It also depends on how you are filling the first Image control. If you are in the control of filling both controls, then you can just as easy use the same code to fill both controls.

Picture Box, Image loading

Adding the Windows Form template to my full game as a way to read a text file when ever its called. I add a picture box to the form and what comes up is Value cannot be null. Parameter name: docData I looked around the Interwebs and it seems to be a problem with XNA (4.0) and how its missing things that make picture box work. How do I work around this to add a image to the picture box?
I will start from the beginning. I create a Windows Game(4.0), name it PictureBox. I add the Windows Form, name that Form1.cs. I add in the picture box. I then open up the properties menu, click on Image and it gives me the null. I have done nothing yet, but still this error happens.

How to resize Windows Icon Overlay?

I made a icon overlay to my file, *.myfile, but the overlay size is wrong. When the icon shows in size 16x16, the overlay covers the icon.
How can I change the overlay size? (IShellIconOverlayIdentifier)
You can't change the overlay size. Instead use a multi-resolution icon file where all necessary sizes are available.
For a good example take a look into the source of TortoiseSVN. Their will be only one icon file used, but if you open it with an appropiate paint tool, you'll see that this file contains different sizes.
Update
If you take a look right at the first method, you'll get the following comment:
"The Shell calls IShellIconOverlayIdentifier::GetOverlayInfo to request the
location of the handler's icon overlay. The icon overlay handler returns
the name of the file containing the overlay image, and its index within
that file. The Shell then adds the icon overlay to the system image list."
You can see in line 129 that it tries to find out the path of the needed file from the registry. By browsing the code you can find the icons in subversion here. In line 165 you can see that it takes the filename from the registry and writes it back to its out parameters and maybe the magic flag to let windows decide which size should be taken from the file is *pdwFlags = ISIOI_ICONFILE;.

Categories