[mono-vb] Re sizing Images

Stifu stifu at free.fr
Mon Sep 14 11:38:16 EDT 2009



Easy_Rider9999 wrote:
> 
> I have made some more workarounds and my app runs fairly well in my own
> Ubuntu 8.04 environment with my self-compiled Mono 2.4.2.3 (with
> libgdiplus) but with the 2.4.2.3 Suse Virtual PC Image my app crashes when
> opening a folder with pictures! Is libgdiplus missing in this image? Here
> is the error message:
> 
> ucPictureListview.DrawLVItem SetImages to unsaved Items and checked Items
> /home/rupert/Desktop/TestTest/DSC03690.JPG
> System.ArgumentOutOfRangeException: Index is less than 0 or more than or
> equal to the list count.
> Parameter name: index
> 4
>   at System.Collections.ArrayList.ThrowNewArgumentOutOfRangeException
> (System.String name, System.Object actual, System.String message)
> [0x00000] in
> /usr/src/packages/BUILD/mono-2.4.2.3/mcs/class/corlib/System.Collections/ArrayList.cs:3258 
>   at System.Collections.ArrayList.get_Item (Int32 index) [0x00013] in
> /usr/src/packages/BUILD/mono-2.4.2.3/mcs/class/corlib/System.Collections/ArrayList.cs:2649 
>   at System.Windows.Forms.ImageList+ImageCollection.GetImage (Int32 index)
> [0x00024] in
> /usr/src/packages/BUILD/mono-2.4.2.3/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ImageList.cs:678 
>   at System.Windows.Forms.ImageList.Draw (System.Drawing.Graphics g, Int32
> x, Int32 y, Int32 index) [0x00000] in
> /usr/src/packages/BUILD/mono-2.4.2.3/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ImageList.cs:1128 
>   at System.Windows.Forms.ImageList.Draw (System.Drawing.Graphics g, Point
> pt, Int32 index) [0x00000] in
> /usr/src/packages/BUILD/mono-2.4.2.3/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ImageList.cs:1123 
>   at (wrapper remoting-invoke-with-check)
> System.Windows.Forms.ImageList:Draw
> (System.Drawing.Graphics,System.Drawing.Point,int)
>   at System.Windows.Forms.ThemeWin32Classic.DrawListViewItem
> (System.Drawing.Graphics dc, System.Windows.Forms.ListView control,
> System.Windows.Forms.ListViewItem item) [0x0029f] in
> /usr/src/packages/BUILD/mono-2.4.2.3/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeWin32Classic.cs:2963 
>   at System.Windows.Forms.ThemeWin32Classic.DrawListViewItems
> (System.Drawing.Graphics dc, Rectangle clip, System.Windows.Forms.ListView
> control) [0x00074] in
> /usr/src/packages/BUILD/mono-2.4.2.3/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeWin32Classic.cs:2655 
>   at System.Windows.Forms.ListView+ItemControl.OnPaintInternal
> (System.Windows.Forms.PaintEventArgs pe) [0x00000] in
> /usr/src/packages/BUILD/mono-2.4.2.3/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs:3027 
>   at System.Windows.Forms.Control.WmPaint (System.Windows.Forms.Message&
> m) [0x00078] in
> /usr/src/packages/BUILD/mono-2.4.2.3/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:5559 
>   at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message&
> m) [0x0016c] in
> /usr/src/packages/BUILD/mono-2.4.2.3/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:5319 
>   at System.Windows.Forms.ListView+ItemControl.WndProc
> (System.Windows.Forms.Message& m) [0x0009a] in
> /usr/src/packages/BUILD/mono-2.4.2.3/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs:3050 
>   at System.Windows.Forms.Control+ControlWindowTarget.OnMessage
> (System.Windows.Forms.Message& m) [0x00000] in
> /usr/src/packages/BUILD/mono-2.4.2.3/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:234 
>   at System.Windows.Forms.Control+ControlNativeWindow.WndProc
> (System.Windows.Forms.Message& m) [0x00000] in
> /usr/src/packages/BUILD/mono-2.4.2.3/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:215 
>   at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg,
> IntPtr wParam, IntPtr lParam) [0x00085] in
> /usr/src/packages/BUILD/mono-2.4.2.3/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NativeWindow.cs:242 
> ucPictureListview.DrawLVItem Finished
> ucPictureListview.OnScrollFinished Finished
> frmMain.clsTV_FolderSelected addPathToFolders
> frmMain AddPathToFolders Start
> frmMain AddPathToFolders AddFolder: 1
> frmMain AddPathToFolders Finished
> clsFolderTreeview.clsTVAfterSelect Finished
> frmMain.clsTVAfterSelect Start
> 
> 
> Regards Hans
> 

At the risk of being annoying, I'd like to stress again the importance of
reporting bugs so they get fixed (not sure whether you reported it or not,
so ignore this if you did). Workarounds are just hacks, they can be handy,
but they're not long-term solutions. They're more or less dirty, can cause
issues, may not work with other Mono versions, make maintenance more
annoying, and so on... Personally, I add a hack only when I really need to,
report the bug if it's not known, and remove the hack as soon as a stable
Mono version has fixed the concerned issue.

That said, I can't guess the root of your problem from your error. In case
that might help, I can tell you I had crashes when opening files with my app
on openSUSE, and which were due to the fact I tried to open these files with
FileAccess.ReadWrite (the default FileAccess parameter), while I didn't have
write access for these files. So now I only open files with FileAccess.Read,
and catch UnauthorizedAccessExceptions (and also IOExceptions while I'm
there).
-- 
View this message in context: http://www.nabble.com/Resizing-Images-tp24991889p25438134.html
Sent from the Mono - VB mailing list archive at Nabble.com.



More information about the Mono-vb mailing list