|
is long bigger than int in C# ? I thought it was.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
This post does not make sense in the context of my question, or you didn't explain yourself well enough.
|
|
|
|
|
You're storing the size in an int. A long is bigger.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Ahh. The problem wasn't int being big enough. The problem was making a byte[] that was big enough. My byte[]'s total size in memory was greater then 64kb. The other post though should solve my issues.
|
|
|
|
|
Yeah, long is System.Int64, and int is System.Int32;
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
There is no 64KB limit on arrays. If you get close to 2GB you might have problems on 32 bit systems.
But anyway, the solution to your problem is quite simple - no need to keep all the data in memory, just save it as you go:
byte[] buffer = new byte[1024*1024]; // 1MB buffer
while (true)
{
int bytesRead = gzDecompressed.Read(buffer, 0, buffer.Length);
// If we reached the end of the data
if (bytesRead == 0) break;
outStream.Write(buffer, 0, bytesRead)
}
|
|
|
|
|
You are awesome. That totally solved my problem and she works great now.
Thanks a Million.
--Peter
|
|
|
|
|
Hi,
1. How can you resize a picture stored in a Bitmap object.
2. Why is it not a real icon when you save it as ImageFormat.Icon
Thanks
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
1 - You can create a new bitmap of the right size, and copy it through a graphics object. You can also just display it at a different size, if that's all you need.
2 - I have no idea, what makes it not real ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Thank you Christian, regarding (2), simply when you save it as an icon that way, it's not displayed along with the other icons as "an icon", you dont see the icon!! you just see the file as if it's a corrupted file and the only way to view it is to set the container folder view as "thumbnail", simply it still acts like a picture file with a missing icon!
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Muammar© wrote: How can you resize a picture stored in a Bitmap object.
Create a new Bitmap object with the size you want, create a Graphics object for it, and draw the original image on it scaled to the size.
Muammar© wrote: Why is it not a real icon when you save it as ImageFormat.Icon
In what way is it not a "real" icon?
Have you included any mask in the image? I don't know how to do this exactly, but I suppose that you would add it as another frame to the image.
---
single minded; short sighted; long gone;
|
|
|
|
|
mask.. frame.. Even more puzzled!
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Icons use a specific color as a transparency mask.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
bm.MakeTransparent(colorDialog1.Color); still not working.. Please christian, help
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Hello,
You can get the Color directly from your Bitmap:
Color transparentColor = bm.GetPixel(0, 0);
bm.MakeTransparent(transparentColor);
Hope it helps!
All the best,
MArtin
|
|
|
|
|
Thanks Martin, but I tried this as well.. nope, still not working, are you telling me that it's working fine with everyone here??
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Hello,
Muammar© wrote: are you telling me that it's working fine with everyone here??
It worked more than once for me.
Have you converted your icon from and jpg maybe?
If yes check if it's realy using only one background color. (Fast: Use Paint and try Fill background with Red)
Where are you showing the bitmap after making it transparent?
All the best,
Martin
|
|
|
|
|
I didn't say it would, I was just explaining the terminology. Why do you need to create an icon in code ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
IIRC this is the code snippet that creates a real icon from a bitmap:
Icon icon=Icon.FromHandle(bitmap.GetHicon());
Stream s=new FileStream(fileSpec, FileMode.Create);
icon.Save(s);
s.Close();
|
|
|
|
|
Thanks Luc
IT'S WORKING
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Hi
I want to put value"DD5FGRT" in byte array
and want to compare two byte array.
how can i do this.
|
|
|
|
|
Characters are encoded and decoded to byte sequences - you can't talk about a byte representation of a string without specifying an encoding.
You will find the encodings in the Text namespace:
System.Text.Encoding.UTF8.GetBytes("DD5FGRT");
People tend to use ASCII and Default (ANSI) encoding as well, and these are indeed great - when interfacing with your grandmothers DOS programs. They do not belong in any serious development today as they can only handle a miniscule subset of text. For the Default encoding, you even have the added benefit that this will change from system to system (or on the same system when someone change regional settings).
If nothing else, you can always check the length of the array, and then loop it to see if it's identical.
|
|
|
|
|
I open the second form from first form.
but the first form can not get the second one with OwnedForms attribute.
whenever it maybe happen?
|
|
|
|
|
You need to set the Owner or Parent property on the form.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|