473,507 Members | 6,295 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A few GDI+ U/I questions

Question #1)
If I do Image.Save with the same filepath that I got the image from, it
bombs with "A generic error occurred in GDI+"
Any ideas? I prompt the user before overwriting, but if they want to do it,
I would like to offer the ability.

Question #2) I have my cropping working, using my own rubber banding
selector widget, but I am wondering how to best allow them to hold SHIFT and
maintain aspect ratio like Photoshop and others do? Any ideas on the math,
algorithm needed to do this. I'm sure it is simple just having one of those
days where I can't think of how to do it.

Thanks a lot,

Shane
Nov 21 '05 #1
2 1476
#1 GDI+ FAQ

#2 Just use the X value of the mouse and make the rectangle height the the
width multiplied by the original width divide by the original height.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"SStory" <Th*******@TAKEOUTTHISSPAMBUSTERsofthome.net> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
Question #1)
If I do Image.Save with the same filepath that I got the image from, it
bombs with "A generic error occurred in GDI+"
Any ideas? I prompt the user before overwriting, but if they want to do
it,
I would like to offer the ability.

Question #2) I have my cropping working, using my own rubber banding
selector widget, but I am wondering how to best allow them to hold SHIFT
and
maintain aspect ratio like Photoshop and others do? Any ideas on the
math,
algorithm needed to do this. I'm sure it is simple just having one of
those
days where I can't think of how to do it.

Thanks a lot,

Shane

Nov 21 '05 #2
Mr. Powell is indeed "The Man", up there with Rod Stephens and Richard
Mansfield for gdi information, but a from-here quickie on #1 is to call
GC.Collect. .Net locks the .FronFile opened file "in case it needs to
dynamically get more data" (as in for a multipage Tiff). However, if you
have grabbed the image and are holdng a clone then that lock gets in the
way. This is one of the few cases where calling GC.Collect - just after
loading the image to a local object - is a good solution.

Humbly: maybe the free Adobe eBook mentioned on this page would be of
interest? http://www.smithvoice.com/ispec_1.aspx

robert smith
kirkland, wa
www.smithvoice.com

"SStory" <Th*******@TAKEOUTTHISSPAMBUSTERsofthome.net> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
Question #1)
If I do Image.Save with the same filepath that I got the image from, it
bombs with "A generic error occurred in GDI+"
Any ideas? I prompt the user before overwriting, but if they want to do
it,
I would like to offer the ability.

Question #2) I have my cropping working, using my own rubber banding
selector widget, but I am wondering how to best allow them to hold SHIFT
and
maintain aspect ratio like Photoshop and others do? Any ideas on the
math,
algorithm needed to do this. I'm sure it is simple just having one of
those
days where I can't think of how to do it.

Thanks a lot,

Shane

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
2495
by: **ham | last post by:
I know that's an old dirty issue; GDI+ almost -the slowest part of the framework - has bothered many developers using it in animations. Even in managed C++ the performance is awful. Now, any dude...
2
6089
by: °Ë´óɽÈË | last post by:
Hi guys, As you know, we can call SetROP2 to set the current foreground mix mode in GDI. But I doesn't work in GDI+. The step is: GetDC --> SetROP2 -->Graphics.FromDC, then draw sth by graphics...
4
5267
by: pixel | last post by:
hi GDI ExtFloodFill doesn't "see" GDI+ colors ..ToArgb() doesn't work at all any suggestions br pixel
5
4127
by: anonymous | last post by:
I'm writing a program that deals extensively with the printer. For the most part my application runs fine, but occasionally I run into some Exceptions. The most common exceptions I run into are...
3
1413
by: James dean | last post by:
Is an updated version of Gdi+ being planned to complement the new beta trial version of Visual Studio 2005. Why is GraphicsPath slow? I cannot find good performance information about GDI+, can...
1
5302
by: James dean | last post by:
Could someone explain how this works. I think the graphics card is used to do blitting and drawing shapes like rectangles. How does it draw using the Graphics card on the PC and why is this feature...
6
6263
by: James dean | last post by:
I want a good site that will show clearly how much more functionality GDI+ has. I cannot seem to find anything other than sites that list "some" of the new functionality that GDI+ offers. A...
10
1613
by: Jim Hubbard | last post by:
Can you use VB.Net to set a system-wide hook to intercept all GDI calls from GDI to the system's hardware? I want to intercept all GDI instructions sent to the system's hardware layer. As I...
7
5962
by: Marcin Rzeznicki | last post by:
Hello, Do you think it is legitimate practice to mix GDI+ and GDI calls (via Get/ReleaseHDC()) in paint event of a control? I've heard there is possibility of performance loss while "locking"...
0
7220
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7105
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7371
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7023
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7479
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5037
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
1
757
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
410
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.