|
First, thanks for taking the time to help me on this Christian.
Second, I still can't seem to save anything using the Image.Save method. Here's my entire chuck of code, maybe you could help me find what, if anything, I'm doing wrong.
if (lstFiles.SelectedIndex >= 0 && lstFiles.SelectedIndex < lstFiles.Items.Count)
{
string szImgPath = dlgDir.SelectedPath + "\\" + lstFiles.SelectedItem.ToString();
Bitmap dibBkgnd = new Bitmap (szImgPath);
try
{
string szSavePath = @"C:\Documents and Settings\Temp\Incomplete\";
dibBkgnd.Save (szSavePath, System.Drawing.Imaging.ImageFormat.Bmp);
SystemParametersInfo (0x14, 0, szSavePath, 0x1 | 0x2);
dibBkgnd.Dispose ();
}
catch (Exception ex)
{
MessageBox.Show ("There was an error setting the wallpaper: " + ex.Message);
}
} When I run this I'm still getting the same exception ("A generic error occurred in GDI+") thrown on the Save method.
The image is of the jpg format and I'm trying to save it as a bmp so I can set the wallpaper. I also tried changing the ImageFormat to a Jpeg just to see if it was a problem with saving to a different type, but I received the same exception. I also tried having no '\' after Incomplete cause I wasn't sure it was added in in the Save , but again the same exception.
Any and all help you can offer is very appreciated.
- Aaron
|
|
|
|
|
monrobot13 wrote:
First, thanks for taking the time to help me on this Christian.
No worries, it beats working :P
monrobot13 wrote:
string szSavePath = @"C:\Documents and Settings\Temp\Incomplete\"; dibBkgnd.Save (szSavePath, System.Drawing.Imaging.ImageFormat.Bmp);
Well, this can't work. You need to append a file name to the path
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote:
No worries, it beats working
Heh, isn't that the truth.
Hmm, well I feel quite the fool. I've no idea why I didn't think of that. That was defenitley the problem as I've got it working now.
Thanks for all the help, I probably never would have picked up on that. Also, thanks for the help on the My Documents folder problem.
It's been much appreciated.
- Aaron
|
|
|
|
|
My pleasure - there's no escaping the fact that GDI+ isn't exactly helpful with it's error messages....
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
The cause of the error is that you are trying to save the file with the same name as the file you loaded. As long as the Bitmap object exists, the source file is open.
---
b { font-weight: normal; }
|
|
|
|
|
Have an issue with accelerator keys being displayed (underlined) and handled in my menus
i add menu items with '&' before the letters i want to act as accelerators, but when i run the program these are not displayed and handled until i hit the alt key. Unlike most other programs ive seen which always display the underlined accelerator.
what this means for me is that if i mouse click to open up a menu i cant see, nor use, any of the accelerator keys.
i literally need to go (for example) alt-f to open file menu, and then can i only see the other accelerators and use them.
is there a standard (built-in) way of having the accelerators always shown? or do i need to implement this myself (if so whats the best approach)?
thanks in advance
- paul
|
|
|
|
|
See my post here[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
You can pass by reference, which is the same thing to all intents and purposes ( that is, you get the same result ).
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
excellent, thanks! C# has some quirks I'm not used to in C++
-mutty
|
|
|
|
|
Mutty wrote:
C# has some quirks I'm not used to in C++
Yeah, there's a lot that looks more similar than it is. If you try to use const and find it next to useless, try readonly. Not a whole lot better, but closer....
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Well actually this brings up my next question... see my post about constant declarations. -mutty
|
|
|
|
|
hey i'm making a web browser, i got the progress bar in my status bar, i know how to make it go up by setting a value and the performstep() function but how do i get it to go up when i load webpages? it doesn't matter if its in c++ or c# well c# preferably since thats what i'm programming the browser in but if you know what it is in c++ i'll just transfer it over to c#, thx in advance.
|
|
|
|
|
if i understand what yoy need correctly
you can get the length of the file there are http header that can get the legth of the file but maynot return value in all cases this header is Content-Length
by using this value and chunks transfer at second
you can progress your progress bar
MCAD
|
|
|
|
|
ok so what code do i need to put in for that?
|
|
|
|
|
I haven't used the control myself, but checking MSDN I'd say you have to register for the WebBrowser.ProgressChanged event. The event args passed to the ProgressChanged event contain CurrentProgress and MaximumProgress values that you can use to update your progress bar.
- Aaron
|
|
|
|
|
thank you so, much, i forgot about the events in the web browser control, i was looking at the progress bar control. but thank you both for the help.
|
|
|
|
|
Hello,
When I press Ctrl+C in my DataGrid the exception is thrown, hoever if I right click the cell and select Copy from menu, evrything works fine. Any ideas?
Thank you.
|
|
|
|
|
to help other to help you provide more detail about your problem like what is the exception you got?
MCAD
|
|
|
|
|
Hello,
I have to to make a header like the following:
============================================================================
-----|--------------|--------------1st Option-------|-----2nd Option-------|
ID---|---Name-------|---------- Rate | Provider --|-- Rate -|- Provider -|
============================================================================
1 ABC .43 PQR 0.54 LMN
2 DEF .32 JKL 0.12 STU
...............
...............
Rest of the Data
................
................
does anyone have some idea how to create a header like the one shown above?
Thanks in advance...
- A programmer's national anthem; "AAAAAHHHHH!!!!"
|
|
|
|
|
Try to create a custom control header....
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/header/header.asp
G
|
|
|
|
|
|
I was thinking of reusing the DateTimePicker control with another calender but i couldn't find a way of doing it, is there any way to make the DateTimePicker to use another calender than the gregorian calender.
To select a date of preference, that would normally be shown as today's date in a circle and the caption @ bottom that reads "Today 10/08/2005" to a string of preference ??
Any Help guys??
|
|
|
|
|
I'm afraid you can't because DateTimePicker and MonthCalender are microsoft comon control which reflect Local user setting so to use differnt culture you need to Change it from Regional and Language Options dialog
box even if you change CurrentCulture or CurrentUICulture
It will not work
MCAD
|
|
|
|
|
Hello,
If I have a messagebox with two buttons OK, and Cancel. How do I catch which button the user presses?
Thank you
|
|
|
|