|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
A few GDI+ U/I questionsQuestion #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 #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. -- Show quoteHide quoteBob 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" <TheStorys@TAKEOUTTHISSPAMBUSTERsofthome.net> wrote in message news:%23bqFax8NFHA.604@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 > > 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 Show quoteHide quote "SStory" <TheStorys@TAKEOUTTHISSPAMBUSTERsofthome.net> wrote in message news:%23bqFax8NFHA.604@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 > >
Serialization questions
Code Execution Just Stops two dlls + arguments Binding a combo box Cannot compile program written by another user on my PC Opening a file over the internet Hyperlinks Does anyone help me convert vb.net to c# Database filepath got overrided by OpenFiledialog??? formatting Dates? |
|||||||||||||||||||||||