Hi, I trying to run a registered version of WinZip 8.1 via a SOAP Service written in C# with Visual Studio 2002.
And I am trying to unzip a file on the server using a soap service call
When I take the code out of the SOAP service and try to run it on my local machine as is it works, on the server that the SOAP service is running on all I get is the executable being run in the background and only visible through the Task Manager, but no files being unzipped. The command line that I actually run does work if I run it from the command promt on the server.
In my application, I want to read images which are in the PNG format, 256 colors, with transparency, store them in memory and then display them on screen.
So I do something like that :
myBitmapArray[i,j] = new Bitmap ("FileName.png");
The pb is my application takes 100 Mb in memory to load the pictures, which are only 4 Mb in the files
Apparently, when loading a picture, there is no format specifier. So I thought it should use the file, but when looking at the PixelFormat member, it's always 32bpp...
So I have tried to create the bitmap another way,
like new Bitmap (128,64, System.Drawing.Imaging.PixelFormat.PixelFormat8bppIndexed), and then copy my image from the file here.
- If I use 16bpp555, I lose the transparency
- If I use 16bpp1555, JIT debugging tells me "out of memory"
- If I use 8bppIndexed, JIT debugging tells me I cannot create a graphics (graphics.FromImage -> error).
How can I load my 256 color files and draw them in a picture box, without taking so much memory because they are transformed in true color?
The png codec is "buggy" and if you use the standard constructor, the bitmap ignore the file attributes and is always 32bppp.
The gif coded works OK, and the bitmap keeps the file attributes.
With this, I've reduced my application memory usage by 60%
hi evey one,
I have a problem with RichTextBox in System.Windows.Forms.
the function SuspendLayout() and ResumeLayout() doesn't work!!!
Did I do something wrong?
And what is the solution when I want to cancle the drawing of this control?
Don't know much about the RichTextBox, but you can hide the control instead of suspending layout, and show it again instead of resuming layout. This even works on COM controls, so I think it shouldt do for all other controls, too.
Hi, I am trying to get my head around safe thread synchronization.
I think the code below is not thread safe as the Start() method may be called several times which would cause the event to be fired asynchronously.
I think that the problem is that the event code is called by many threads. I want the event code to be executed by only one thread at a time.
If I had replaced the code: OnEvent(EventArgs.Empty);
in the first example with the following: MyForm.Text = "A Caption";
then the rules for safe thread practices would clearly be broken.
Although the execution of multiple events cannot be performed simultaneously on a single CPU, they can certainly be interlaced since they are executing on separate threads. The usage of synchronization techniques still applies. Furthermore, making assumptions about the hardware and how it relates to thread synchronization is a dangerous road to go down.
Thanks for these comments.
From the comments made earlier I was starting to think that my understanding of the need for synchronization was completely wrong. Your comments have really cleared things up for me.
I would intentionally leave the ThreadTest class unsafe for multithreading. Inform the subscribers of this class' event that it is executed on another thread. Let the subscribers handle their own synchronization. Remember, the ThreadTest class is not safe for multithreading so that means subscribing and unsubscribing to the event is also not safe multithreading. Here's how the code might look...
publicevent EventHandler MyEvent;
Thread thread = new Thread(new ThreadStart(this.ThreadMethod));
if (MyEvent != null) MyEvent(this, EventArgs.Empty);
// As a subscriber to ThreadTest.MyEvent I know that whatever// delegate I specify for the handler will be executing on an// unknown thread. I must take care of my own synchronization.
ThreadTest test = new ThreadTest();
test.MyEvent += new EventHandler(this.OnEvent);
// Continue with the whatever else you need to do here...
publicvoid OnEvent(object source, EventArgs e)
// It is NOT safe to access shared members here.lock (this)
// It is safe to access shared members here.
Last Visit: 31-Dec-99 18:00 Last Update: 1-Oct-23 15:11