|
Friends,
I am trying to save the image in a picturebox to a file.
It returns a gdi+ error
This is what I do :
tmpfileloc= apppath + "temp_make.jpg";
FileStream fs= new
FileStream(tmpfileloc,FileMode.OpenOrCreate,FileAccess.Write);
Image tmpimg= pictureBox1.Image;
tmpimg.Save(fs,ImageFormat.Jpeg);
fs.Close();
And the error I am getting is this :
An unhandled exception of type
'System.Runtime.InteropServices.ExternalException' occurred in
system.drawing.dll
Additional information: A generic error occurred in GDI+.
Whats wrong ?
Tweety
If you can smile when things go wrong, you have someone in mind to blame
|
|
|
|
|
|
Hi Leppie,
Thanks for the prompt reply.
I am loading the image into the picturebox from a JPG file in my desktop. And the program does create a 0 byte file, when I try to save it. Then it crashes.
Specifying the fileaccess as FileAccess.ReadWrite doesn't stop the error. What is 24bppRGB format ?
Tweety
If you can smile when things go wrong, you have someone in mind to blame
|
|
|
|
|
leppie wrote:
The only thing I can think of that perhaps the image format is not 24bppRGB.
The way I was loading the picture into the picturebox was not perfect. I think that corrupted the image format. I fixed the issue.
Thanks.
Tweety
If you can smile when things go wrong, you have someone in mind to blame
|
|
|
|
|
Why don't my web controls (e.g. buttons) display in my browser when I run? If I use an HTML button, it shows up fine. Both appear to be server side controls (both have runat="server". What's the difference between Web Form controls and HTML controls?
Joe
|
|
|
|
|
|
I've been trying to keep my samples as simple as possible...create a new project (web app). On the grid that's displayed, drop a web form button onto the grid from the toolbox...compile, then execute and the button doesn't show. Only labels show up. I have a feeling it's something silly that I'm just not aware of. It's been frustrating to track down why I don't see what I expect. When I drop an HTML button (from the toolbox) onto the grid, it shows up when I execute.
Joe
|
|
|
|
|
I was hoping to have a listview control in details view, where each column was bound to a data source. When the user clicked in a box (grid lines on obviously) a drop down box filled with the bound data should appear.
Does anyone know if such a control exist . Maybe point me to an article detailing the procedure.
Thanks in advance,
Paul
|
|
|
|
|
|
i'am currently working on a encryption tool using des and rc2 algorithms. The program works and all but is set up too only encrypt one file at a time. im trying to find a way to encrypt a hole folder just by typing the directey i.e
"C:\\my folder". I have just started programming...in c#(or any lauguage for that matter) so i need help with this perticular subject.
I have been going at this a diffrent way (allowing the user to selected a file and writing the FileName to a listbox..then pulling the files off the list box 1 by 1 to be encrypted).
please help me if you can.
|
|
|
|
|
|
i went to msdn and found additional stuff (i go there alot its just so damn big you know it ?) thanks for pointing me in the right direction.
Jesse M.
|
|
|
|
|
|
some time mouse shows busy sign can any body tell how i may check that mouse is busy or not?
r00d0034@yahoo.com
|
|
|
|
|
The hourglass shape of the mouse cursor generally indicates that an applicaiton (as opposed to the mouse itself) is busy. If you're writing an application in C#, this is typically controlled with the Cursor.Current static property (in System.Windows.Forms).
I'm not sure this will do what you want, but it's the right general direction.
Burt Harris
|
|
|
|
|
This piece of code is from the DX8 tutorial:
VOID* pVertices;
if( FAILED( g_pVB->Lock( 0, sizeof(g_Vertices), (BYTE**)&pVertices, 0 ) ) )
return E_FAIL;
memcpy( pVertices, g_Vertices, sizeof(g_Vertices) );
g_pVB->Unlock();
Is it possible to translate it in C#? I'm trying to write a simple DX8 application as I use only C#. I'm using the VB type lib but obviously there are functions not available in C# like D3DVertexBuffer8SetData, that replaces the above C++ code in VB.
While this exercise might be a little unpractical it actually helps me better understand the difference between managed and unmanaged .
Any ideas how to set up and run DX8 in C# (is it possible at all; is it possible to do it in a' managed' way)?
Thank you
Z.
|
|
|
|
|
DX8 is a pain to work with in C#. If you can, I would just wait a few months for the DX9 SDK to come out. That'll have C# support.
I don't know whether it's just the light but I swear the database server gives me dirty looks everytime I wander past.
-Chris Maunder
Microsoft has reinvented the wheel, this time they made it round.
-Peterchen on VS.NET
|
|
|
|
|
|
leppie wrote:
The beta's looked very promising
Not that adventurous. I install betas all the time...but I wasn't quite ready to install that one. Especially when you can't uninstall it...
leppie wrote:
you dont need the SDK to write Managed DX9 apps.
Huh? Yeah you do...
I think you mean you don't need it to run DX9 apps.
I don't know whether it's just the light but I swear the database server gives me dirty looks everytime I wander past.
-Chris Maunder
Microsoft has reinvented the wheel, this time they made it round.
-Peterchen on VS.NET
|
|
|
|
|
|
Personally...I would wait for DX9 to come out before trying to do anything DX related with .NET. Its not that it's impossible, but its just not very pretty.
Alternatively instead of using the DX8 wrappers you can try to create the COM objects yourself using COM interop. Adam Nathan's book .NET and COM: The Complete Interoperability Guide (SAMS press) even has an entire chapter dedicated to creating a game using DirectX from .NET.
James
"The elastic retreat rings the close of play as the last wave uncovers
the newfangled way.
But your new shoes are worn at the heels and
your suntan does rapidly peel and
your wise men don't know how it feels to be thick as a brick."
"Thick as a Brick" from Thick as a Brick, Jethro Tull 1972
|
|
|
|
|
thank you everybody for the answers, your are of course right
but I still would like to know if there is a way to overcome such a piece of code (so let me take it out of the context of dx):
VOID* pVertices;
if( FAILED( g_pVB->Lock( 0, sizeof(g_Vertices), (BYTE**)&pVertices, 0 ) ) )
return E_FAIL;
memcpy( pVertices, g_Vertices, sizeof(g_Vertices) );
these VOID* and memcopy iritate me too much!
|
|
|
|
|
|
The only issue is you are passing structs back and forth (and these are not always correctly handled by the type marshaler). A suggestion to get your job done is to marshal the struct yourself. This article[^] shows it.
|
|
|
|
|
Thank you everybody! I'm still curious can I succeed in showing a spinning cube on the screen or not will I succeed to marshal my customvertex struct or not
|
|
|
|