|
Hey
My program recieves a byte array containing a jpg. I am using Image.FromStream and then viewing the image on a picturebox. Image.FromStream is quite slow so is there any other way I could view the jpg?
Thanks
|
|
|
|
|
I don't believe there is another way. Apart from loading it from the disk (which really, opens the file then reads it from the stream)
There shouldn't really be any reason for it to go particularly slowly, unless it's a very large image. Could it be possible that something else is causing the lack of swiftness?
My current favourite quote is: Punch them in the face, see what happens!
-SK Genius
|
|
|
|
|
The problem is im recieving 16 video streams and each is 25fps. Thats 400fps and Image.FromStream is taking 3-4 ms per frame. Its just to slow.
|
|
|
|
|
So you're trying to play video in a picture box? You may want to check some articles on video playback with DirectX.
My current favourite quote is: Punch them in the face, see what happens!
-SK Genius
|
|
|
|
|
No there not videos. Its a frame from a IP camera along with other information and is sent from a server.
|
|
|
|
|
Either way, trying to render pictures so fast is beyond the capabilities and intended use of GDI+ (which is what is being used to draw your pictures)
The best you can do is call SuspendLayout on your picture boxes so that they don't redraw as soon as you've changed the picture and then ResumeLayout and Invalidate once you have updated all of your picture boxes. Reducing the number of redraws that are done, but even then I can't see it being very fantastic.
Also, if your showing lots of different pictures one after the other at a reasonably quick pace, I'd say that was video.
My current favourite quote is: Punch them in the face, see what happens!
-SK Genius
|
|
|
|
|
Ok thanx for the help. So if showing pictures at a quick pace is actually just a video surely I can use DirectX or DirectShow to play the "Video"? Or wont this be quick enough to do what I want? If not I will just have to reduce the frame rate.
Thanks
|
|
|
|
|
I am co-operating in the development of a data management system. I have written a seriously complicated component of the program with we are still debugging.
Now, I am going to use NUnit to automatize a number of tests. All said, but now, for debugging purposes, I will need to run a number of tests on the component. I have chosen really specific data to use for the testing and put those data in a folder of XML files. The structure of the XML files follows the structure of the database the data could be in, but I did this for 2 reasons: Due to a network problem, I can't connect to the test database, and I wanted to exclude "data noise" to really pinpoint my tests.
And now the question: how to I make NHibernate use my folder of xml files as a datasource instead of the test database?
|
|
|
|
|
c:\Program Files\Microsoft SQL Server\90\SDK\Assemblies\Microsoft.Sqlserver.connectioninfo.dll
how do i get an object for connectioninfo
so as to use the methods and properties of connectioninfo class
Pls guide me
thanks in advance
|
|
|
|
|
Does this[^] article help?
/ravi
|
|
|
|
|
Here I would like to know how to do a carriage return in C #, the equivalent of \ r \ n
public void initest(string par, int val)
{
TxFrame = par + val;
TxFrame += "\r\n";
m_ComPort.Write(TxFrame);
}
|
|
|
|
|
In general, you would use Environment.NewLine (say you are writing to a file and want to achieve the newline). In this specific instance, it looks like you are writing to a COM port so this isn't the case; what you have don here is correct.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
modified on Wednesday, June 2, 2010 7:59 AM
|
|
|
|
|
No offense, but I think that's a bad idea in this case - he appears to be using a COM port, and writing something platform dependent to it does not seem like a good idea to me.
|
|
|
|
|
Ah - I hadn't noticed the COM port usage there. You're right that this doesn't make sense in this case.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
\r\n works in C# (meaning that it produces a carriage return and a newline), what's the problem?
|
|
|
|
|
public void initest(string par==D, int val==1)
{
TxFrame = par + val;
TxFrame += "\r\n";
// the problem is the result of TxFrame is "D1\r\n"
m_ComPort.Write(TxFrame);
}
thanks
|
|
|
|
|
Ok, well then what do you want the result to be?
Or do you mean that you see "\r\n" in the debugger and thought that it meant backslash r backslash n?
|
|
|
|
|
yes I see him in the debug and I want it to be a carriage return
|
|
|
|
|
yes I see him in the debug and I want it to be a carriage
|
|
|
|
|
Don't worry, it's probably already correct - that's just the way these things are displayed in the debugger
|
|
|
|
|
|
I've had to do a bit of work printing to serial printers and instead of sending the string value to the COM port, you might want to use something along the lines of System.Text.Encoding.UTF8.GetBytes(string) for TxFrame and then append the CR (0x0D) LF (0x0A) to the byte array. It seemed to work for me.
|
|
|
|
|
There are a few problems with your message:
1.
"carriage return" and "line feed" are the names of two popular ASCII characters.
2.
what you want to terminate a line of text and start a new one is called "NewLine" in .NET; it is a string and its content depends on your system (Windows, Linux, ...). The default value can be found in Environment.NewLine and will be used by some WriteLine methods, such as Console.WriteLine
3.
data sent to a peripheral using a COM port, or sent to another system in some other way (e,g, portable file), or shared with another system (e.g. a database), should NOT rely on a local convention or characteristic.
4.
the SerialPort also offers a WriteLine method, which relies on its own NewLine property which in turn is initialized to a "line feed". If you explicitly set to "\r\n", you will probably get what you want.
5.
the code in your other message, with initializers D and 1, will not compile as is.
6.
code snippets should preserve their formatting, that is what PRE tags are invented for. Use them!
7.
If you hope to be successful in programming, you'll have to become a lot more meticulous.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Why not something like:
m_ComPort.NewLine = "\r\n" ;
...
m_ComPort.WriteLine ( System.String.Format ( "{0}{1}" , par , val ) ) ;
|
|
|
|
|
Hi All,
I am sharing tips which is about Document merging in C#.NET.
Some times during application development we need to generate a MS Word document from a predefined format and some custom data. The predefined format is generally called as Template. This template used to carry some merge fields which can be replaced with the user data.
The user data can be taken from DB or XML data source etc.
The following procedure describe how to generate a MS Word document by merging a word template with external data using C# and MS Word reference libraries.
Step 1:Create a template word document
Hello {Recipient_name},
Wish you a very Happy New Year.
Thanks
- Here {Recipient_name} is called as a merge field and this can be replaced with the external content.
- The shortcut key to create the merge field in word document is : ctrl+F9
Hope you find this tipshttp://www.mindfiresolutions.com/Document-merging-in-CNET-734.php[^] useful and of assistance.
Thanks,
Bijayani
|
|
|
|