|
Nope.That does not help.
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
i just looked it up in msdn, but the constructor u are using requires that you have two parameters:
new Bitmap(Stream s, bool useColorCorrection)
the constructor you are using does not exist, thats why u get the error. try this.
new Bitmap(stream, true);
if that doesnt work, then i haven't got a clue what to do.
Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk "All programmers are playwrights and all computers are lousy actors."
|
|
|
|
|
Thank you friend.I solved it.See the below replies.
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
The byte array held in an Image in Access doesn't appear to be strictly the same format that you'd use in the stream.
When I used the example in this article:
File Upload in ASP.NET[^]
to upload pictures to my web site, I noticed that Access couldn't recognise that they were actually images, it just saw them as Byte arrays.
Paul
|
|
|
|
|
So couldn't you find any solution for it?
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
Well... the solution for me was to upload it to the database using exactly the opposite code I used to download it from the database. ie. insert the picture as-is into an OLE object. It can't be read as a graphic by Access, but you can use the code you have to download it.
But if the picture is already in Access then you can't do that.
The alternative is to figure out what is different between the byte array you read from the database and the stream you're trying to create and adjust it.
One idea is to upload a picture to a database then write a piece of code to upload the same image as a byte array. Then write another piece of code to download both and compare the arrays.
Once you've done that, let us know what the difference is
|
|
|
|
|
pdriley wrote:
One idea is to upload a picture to a database then write a piece of code to upload the same image as a byte array. Then write another piece of code to download both and compare the arrays
Well,I do it for myself too.
pdriley wrote:
The alternative is to figure out what is different between the byte array you read from the database and the stream you're trying to create and adjust it.
I begin to try to figure it out.If I find it I'll tell you.
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
Yohooooooooo,I found it.
When you insert bitmap from Access,it insert some extra byte at the beginning of array bytes.It insert exactly 78 bytes.So when you read them from your application you have to read from byte nember 78 to the end.Then it will be OK.
But don't forget its only when you insert BitMap Object from Access,not from your program.This number maybe different for different kind of data.
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
Cool!
Assumedly those 78 bytes tell Access what kind of OLE object it has.
It'd be really useful to know how it does that so that you can add the 78 bytes when you're uploading to the database. Sounds like a lot of trial-and-error though, maybe another day.
Paul
|
|
|
|
|
I test it for NorthWind in sqlServer 7.0 but the same problem still happend.But maybe its because this database import from Access or it is old version of sql.
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
Mazdak wrote:
this unhandled error happend:
Invalid parameter used.
Without the exception named I don't know what that means
But there are a few things that might be happening.
First, check the length of the byte array to make sure it matches the length of the data in the column; it might not have retreived all the data (just a guess)
Second, check the Northwind database to see if you have an updated one that removed the pictures from the database and replaced them with filenames. That is the case with my version of Northwind.
Last, if the database does indeed have binary data in it; make sure it is the correct binary representation of the bitmap. I vaguely remember that the pictures stored in the earlier versions of Northwind were serialized COM objects (in this case MS Paint bitmap objects). I don't think the Bitmap constructor knows how to deal with those.
James
"And we are all men; apart from the females." - Colin Davies
|
|
|
|
|
James T. Johnson wrote:
Last, if the database does indeed have binary data in it; make sure it is the correct binary representation of the bitmap. I vaguely remember that the pictures stored in the earlier versions of Northwind were serialized COM objects (in this case MS Paint bitmap objects). I don't think the Bitmap constructor knows how to deal with those.
Yes.That was the problem.But what about new versions?I don't have it now to test it.
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
New versions of northwind store the images outside of the database and put the filenames for the images in the database.
I assume SQL Server's northwind still stores the images in the database since it doesn't have any other way of providing the files to other locations.
James
"And we are all men; apart from the females." - Colin Davies
|
|
|
|
|
This is actually what i suggested to friend doing database a couple years back having had similar problems when i knew nothing about SQL or ASP, but logic was the answer
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
Hi all
If anyone is interested, and I'm sure that there are many can test my sound library for .NET. It is basically a wrapper for BASS, a multipurpose commercial quality sound library ( BASS Homepage [^]). Most of the functionality has been implemented.
I felt as this hasnt been implemented fully and there are still some bugs, it doesnt quite deserve an article yet. The library is accompanied with a Windows help file (nDoc) with most functions included.
If you have queries or suggestions, do not hesitate to contact me This is all work in progress, so dont complain .
Hope u have fun
Before i forget, the URL nBASS 0.9 Source, Bin & Doc[^]
I will try add a few examples when i have time.
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
No problem.
43 68 65 65 72 73 2c
4d 69 63 68 61 65 6c
|
|
|
|
|
I have updated the source a bit after the Timer suggestion from James.
I have also included tests, a CD Player (plays from default CD drive) and a MOD player (plays range of formats) and a Stream Player (WAV files, MP3 ,OGG).
nBASS-0.9.1-src.zip[^]67kB
and i upload bass.dll[^]110kB
The tests/examples will should how easy it is to use
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
Just and FYI...
There is already a free full .NET api wrapper for BASS, provided by them. If you want to check it out, you can download the source.
However, just compile it to a DLL and use if you want also.
Aalst
|
|
|
|
|
Yes I know, but #1 that is written in VB.Net and #2 it is NOT "managed" or OO. If you have look at my code you can see how I have implemented this.
So if you wanna worry about handles, marshalling, releasing resources and running events as delegates directly from your your program, feel free to use the VB.Net one
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
how to use vc++ function SetWindowsHookEx in c#?
is its equal function exit in c#?
r00d0034@yahoo.com
|
|
|
|
|
[DllImport("USER32.DLL")]
public static extern HHOOK SetWindowsHookEx(int idHook, HOOKPROC lpfn, HINSTANCE hMod, DWORD dwThreadId)
this is all the informaion that i can give. im not sure if the DWORD in C++ and C# are the same, so u may have to use a diferrent type there, icant help you there, maybe someone else can.
Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk "All programmers are playwrights and all computers are lousy actors."
|
|
|
|
|
Hi,
How can I use Raster Fonts in TextBoxes?
(it seems raster fonts are not supported in .Net!)
Thanks,
Nima.
|
|
|
|
|
Try this, create 3 propertygrids, assign any objects to their selectedobject property, then call a timer every say 100ms doing a refresh on all the propertygrids. You will notice that all propertygrids collapses and expands when the plus or minus sign has been clicked.
Im sure this is not meant to happen...
This is very easily recreatable. Now if I only knew how to upload samples...
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
|
It appears to be a bug with Refresh; you don't even need the timer object.
I modified your sample to put buttons below each grid, each button called refresh on the grid above it. Closing or opening one grid would cause the others to follow suit when their button was pressed.
BTW, there is a bug in your test program. You call Refresh from the System.Timers.TimerElapsed event; this results in the delegate being called on another thread where you shouldn't call any methods or set any properties except for BeginInvoke, EndInvoke, Invoke, and CreateGraphics.
To make it compliant I just made a minor change:
The code added first checks to see if it can execute properly, if it can't (InvokeRequired returns true) then I call Invoke on Form object passing in a delegate of the same type as the method (System.Timers.ElapsedEventHandler) and the two parameters as an array of objects. After the call to Invoke I return since the rest of the method has already completed.
void Timer(object sender, System.Timers.ElapsedEventArgs e)
{
if( InvokeRequired )
{
Invoke(
new System.Timers.ElapsedEventHandler(this.Timer),
new object [] { sender, e }
);
return ;
}
...
}
James
"And we are all men; apart from the females." - Colin Davies
|
|
|
|