I am using AT Command "AT+CNMI=2,3,2,1,0" to
There is a event handler named 'DataReceived' of SerialPort object. But I don't know what will be the parameter and how to handle the parameter to receive the message.
Could you please send a sample 'DataReceived' function?
1. j <= detectLeft.Height gets executed for every pixel, you'd better store detectLeft.Height in a local int variable
2. executing a lot of GetPixel() calls tends to be slow since each time the coordinates are checked against the image boundaries, and translated into a linear index, something that can be done more easily once one knows they all get handled sequentially
3. the most practical approach to (2) is by using pointers
4. why do you use 4 bytes per pixel if all it can be is black and white; an array (bools, bytes, ints, ...) or a BitArray would be more economical in space, and hence in speed (assuming your image is say 512*512, it takes 1MB which is about the size of the level 2 cache); less data would run faster.
Maybe you should swith to one byte per pixel (optimum between density and simplicity)
5. there are special code snippets to find the lowest bit set in an integer, this could be much faster assuming a binary image (yours is), and a majority of zeroes. x & -x results in zero if x is zero, and in an int with exactly one bit set which is also set in x otherwise.
Luc Pattyn [Forum Guidelines][My Articles] The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
I'm hoping that someone could give me some advice on how to code a data-grid so that the first row added appears at the bottom, and each additional row fills in above the previous!
In the program I am building, the data-grid starts out empty, and then the user adds information over the course of the session - the first piece of information he adds needs to be on the bottom, and then the second on top of the first, etc.
Well, a program without an interface can't really do much, can it ? Or do you mean interfaces as a coding construct, not a user interface ? I would suggest you buy a book on C# and read it, rather than hope to get a deep understanding from random forum replies.
An interface is useful mostly as a means to get around the lack of multiple inheritance.
Driven to the arms of OSX by Vista.
Please read this[^] if you don't like the answer I gave to your question.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I'm assuming like Christian that your question is about using interfaces in your own classes. Interfaces do not offer any significant performance benefit. However, they are very useful in situations where classes do inherit from the same base type. Here's a quick example of using interfaces:
public class SecretService : ISecurityCleared
public class CIA : ISecurityCleared
public class President : ISecurityCleared
public interface ISecurityCleared
void ViewTopSecretMessage(string message);
Another advantage of interfaces (again assuming you are talking about code constructs and not the UI) is that they provide a well defined contract to program against. In other words, if you know that a certain type supports a certain interface, then you know that it implements the methods on that interface. An example:
look at this situation(this is just an example for clarification):
i have 2 threads:
thread1: is my main thread,( the static Program class) and should for example Run a form.
thread2: is my sec thread and should show a Splash screen that should be displayed according to my main thread.
thread1(main) wants to update a progressbar on thread2. i am a little confused...
i guess that i could solve this by implementing events, rising them on thread1 and Handling them on thread2 and do the requested job accordingly(i.e. updating a progress).
but sth new arises and that was Cross-Thread-Oper... , and there is no Invoke Metod for my this obj (that is Static Program class, don't call me stupid) to prevent this exception(cross-thread-...excption).
Thread1 should call Invoke/BeginInvoke on the progressBar in Thread2.
Dave BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
Last Visit: 31-Dec-99 18:00 Last Update: 3-Oct-23 18:35