Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


imagebutton error


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-11-2008, 09:22 AM
Junior Member
 
Join Date: Sep 2007
Posts: 28
Question imagebutton error

Hello all,

The following code gives me an out of memory error IDE error. The error is on the last line when I assign the imagebutton1.image to bin.retrieveimage. There are several images embedded in data.dat. If I change imagebutton1.image to image1.image all is fine. Using version 6.05.

Code:
FileOpen(c1,"data.dat",cRandom)
bin.New1(c1,true)
image1.Image=bin.RetrieveImage
imagebutton1.Image=bin.RetrieveImage
FileClose(c1)
The error is the following:

Quote:
Consultez la fin de ce message pour plus de détails sur l'appel du débogage
juste-à-temps (JIT) à la place de cette boîte de dialogue.

************** Texte de l'exception **************
System.OutOfMemoryException: Mémoire insuffisante.
à System.Drawing.Graphics.CheckErrorStatus(Int32 status)
à System.Drawing.Graphics.DrawImage(Image image, Rectangle destRect, Int32 srcX, Int32 srcY, Int32 srcWidth, Int32 srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs, DrawImageAbort callback, IntPtr callbackData)
à System.Drawing.Graphics.DrawImage(Image image, Rectangle destRect, Int32 srcX, Int32 srcY, Int32 srcWidth, Int32 srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback)
à System.Drawing.Graphics.DrawImage(Image image, Rectangle destRect, Int32 srcX, Int32 srcY, Int32 srcWidth, Int32 srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr)
à Dbasic.EnhancedControls.CEnhancedImageButton.OnPai nt(PaintEventArgs e)
à System.Windows.Forms.Control.PaintWithErrorHandlin g(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
à System.Windows.Forms.Control.WmPaint(Message& m)
à System.Windows.Forms.Control.WndProc(Message& m)
à System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
à System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message& m)
à System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Any ideas?

Thanks
Reply With Quote
  #2 (permalink)  
Old 03-11-2008, 10:38 AM
Junior Member
 
Join Date: Dec 2007
Posts: 43
Default

I never used RetrieveImage, but I suppose that in order to embed several images into the .dat file you used the EmbedFile command.
Have you alredy tried the Retrievefile?
Have you tried to switch the "Image" instruction with the "imageButton" instruction just to see if the program behaviour changes?
It seems to me, but I'm not an expert, that RetrieveImage could raise the error for 2 reason
1) he starts reading at an offset of the .dat file where there are no information about the image file (something has been already read by the image instruction and the pointer has been moved)
2) he can read only an image (there are no parameters to specify what and where to read inside the .dat)
But as I said I could be totally wrong..
Mimmo
Reply With Quote
  #3 (permalink)  
Old 03-11-2008, 11:36 AM
Junior Member
 
Join Date: Sep 2007
Posts: 28
Default

skipper,

I did use the embedfile command to create the data.dat. All works fine if I use image1.image or form1.image with bin.retrieveimage, so I know data.dat is OK. It is only when I use imagebutton1.image that I get this error. My understanding is that a bitmap is passed by bin.retrieveimage and then should work for all object.image. Imagebutton1.image="file.gif" works as well. I think it might be a bug of some kind.

thanks
Reply With Quote
  #4 (permalink)  
Old 03-11-2008, 03:20 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Switzerland
Posts: 816
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

Bonjour kolbe

I had the same kind of problem.

Your ImageButton1 is probably set to transparent, in this case you get an error.
If you set transparent to false and after loading the image you set it to transparent it works.

Look under

Image problem with ImageButtons

Meilleures salutations
Klaus
Switzerland
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
AddEvent & ImageButton in IDE agraham Bug Reports 1 09-10-2008 09:31 PM
ImageButton MouseOver superbabicka Questions & Help Needed 0 06-29-2008 09:19 PM
Getting ImageButton image from database glook Questions & Help Needed 5 11-16-2007 08:31 AM
.color doesn't work on ImageButton Mistrel Questions & Help Needed 2 10-13-2007 07:32 AM
I need examples for imagelist imagebutton sloopa Questions & Help Needed 2 05-19-2007 05:00 PM


All times are GMT. The time now is 03:50 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0