|
gvanto wrote: that link doesn't work Sir.
Then you need to get MSDN fixed where you live since it is an invaluable resource for windows developers.
gvanto wrote: I'm just looking for the best way to get the job done.
The best way to start is to look at the documentation for the Graphics class we are telling you about.
led mike
|
|
|
|
|
CAn u recomment me any ebook or any good book on C# graphics and image processing..... Im new to c# and need all basic knowledge about it.........
|
|
|
|
|
|
The graphics framework in C# is called GDI+, there are plenty of good books on it. As for image processing, if you search the site, I have a number of articles on images processing in C#.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi All
the problem is this that I m monitoring a microcontroller through a serial port the serial port have to monitor continuousy. Do some one have any code to monitor the serial port continuosly that when data arrives at the serial port either a character or a number of characters the serial port read it and proces it further .
SAS ![Rose | [Rose]](https://www.codeproject.com/script/Forums/Images/rose.gif)
|
|
|
|
|
Did you try looking in the C# Articles? There is one titled "Serial Communication using C# and Whidbey".
led mike
|
|
|
|
|
i viewed that but it only shows how to communicate it doesnt monitors
any one else
any one else
any one else
any one else
SAS ![Rose | [Rose]](https://www.codeproject.com/script/Forums/Images/rose.gif)
|
|
|
|
|
If I remember correctly the Comport component in the .NET framework 2.0 has an event that gets fired when new data arrives. You might want to look up the documentation on the component http://msdn2.microsoft.com/en-us/library/ed55271k.aspx[^]
Hope this helps
WM.
What about weapons of mass-construction?
"You can always try to smash it with a wrench to fix that. It might actually work" - WillemM
|
|
|
|
|
|
Also why when I moved toolStrip and menuStrip controls to toolStip Container I added lately all event handlers where removed rendering all menu and tool strip items not working, had to manually double click each item then rename old event handler methods to new created on double click to make all things work again
basically for example event that had click stopped working and new was now click_1 so I had to remove new empty click_1 and rename old click to click_1.
Why did this happen?
|
|
|
|
|
To simplify question what is right way to move toolStrip to container?
|
|
|
|
|
For example I have RichTextBox control I inherited and added IsDirty Boolean property.
Now I wonder how can I programmicly (at run time) add event on key press to set this property to true?
I know how to do it through designer.
|
|
|
|
|
TrooperIronMan wrote: Now I wonder how can I programmicly (at run time) add event on key press to set this property to true?
I know how to do it through designer.
You have to "write code". You know... use the keyboard instead of the mouse. Yeah it's old fashioned but at least they give you a "text wizard" to do it in!
led mike
|
|
|
|
|
sure why not but exactly what code should look like, that is question?
|
|
|
|
|
OK i figured out you don't have to bother... it wasn't as complicated as expected... thanks...
|
|
|
|
|
Without creating a system service that would run code on 'shuting down' what type of hook should be used by a app running in the background to know when the system is shutting down or logging off?
Programmer: A biological machine designed to convert caffeine into code. * Developer: A person who develops working systems by writing and using software.
[ ^]
|
|
|
|
|
Take a look at the SystemEvents class especially the SessionEnding event.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
nevermind.. i think ill give up for now and just use a modified spinlock!
im writing a simple lock-free queue (intended for efficient multithreaded use) and im not sure ive quite figured out the logic behind the use of Interlocked.CompareExchange(). would code like the following produce the correct result of adding a new linked list node to the tail of a list under multithreading conditions??
<br />
while (null != Interlocked.CompareExchange(ref _tail.next, newNode, null))<br />
Thread.Sleep(1);<br />
_tail = newNode;<br />
thanks in advance
-- modified at 12:40 Monday 8th January, 2007
|
|
|
|
|
Hi,
I dont think this is thread-safe: you perform two operations on the list
1. CompareExchange
2. modify tail (_tail=newNode)
the combined operations should be atomic.
And I dont think you can achieve it with the Interlocked class at all, since inserting
or removing a node to/from a linked list involves modifying two references or pointers,
which is more than any Interlocked method offers.
SO you will need a lock after all.
Luc Pattyn
|
|
|
|
|
sorry, i dont think u were very convincing, im pretty sure this would work...
- in neutral state, _tail.next is null; the end of the list.
- the first thread executes the interlocked operation which succeeds and atomically sets _tail.next to something other than null.
- this causes the interlocked operation to fail on any other thread, and spin.
- the final assignment returns _tail.next to null (as a new list node has no next-node) and the list is coherent.
i think i just answered my own question there but i do get the feeling im missing something. i have more of an issue dequeuing a list node; ascertaining just how the de/enqueue code can interfere with each other and how i can get it to safely execute in parallel.
I worship his divine shadow. ^
|
|
|
|
|
Well, yes and no:
Yes, if you have a single-linked list and a _last reference, then you can append
a node to it correctly with your code, but that's about it. If there is no _head,
and no backward link (prev), then you can not reach any other node.
A single-linked list with a head only typically uses the following logic
(I use a dummy head node to simplify code: when head.next is the first node (or null),
then head itself never changes and never is null):
void addNode(Node newNode) {
newNode.next=head.next;
head.next=newNode;
}
Node removeFirstNode() {
Node firstNode=head.next;
head.next=firstNode.next;
return firstNode;
}
the safe versions would be:
void addNode(Node newNode) {
do {
Node firstNode=head.next;
newNode.next=firstNode;
} while (firstNode!=Interlocked.ExchangeCompare(head.next,newNode,firstNode));
}
Node removeFirstNode() {
do {
Node firstNode=head.next;
} while (firstNode!=Interlocked.ExchangeCompare(head.next, firstNode.next, firstNode));
return firstNode;
}
But now there are a lot of functional limitations:
there is no access to any other node
1) we do not maintain a tail
2) we do not maintain a backward link
so we have what is known as a stack, certainly not a queue.
If we want more than stack functionality, we'd better have head+tail+nextlinks+prevlinks;
but we must perform multiple stores atomically, and you cannot achieve that
with a single Interlocked method.
You can of course synthesize a lock yourself, something like:
while (0!=Interlocked.ExchangeCompare(lockVar, 1, 0)) Thread.Sleep(1);
lockVar=0;
but that is not what you intended, is it ?
-- modified at 15:10 Monday 8th January, 2007
Luc Pattyn //
|
|
|
|
|
yes i see using a dummy node makes things a heck of a lot easier with the interlocked stuff and i had considered it but i didnt think it would make it that easy. the queue does have a head btw, from which items are removed (added to the tail). at first thought i would need to look into whether a circular reference of the head would introduce some other issue.
but for simplicity's sake (sister of felicity i believe) im gonna use a good old LinkedList and the sleeplock thing. i usually just lock () { } things but for this i certianly want to keep it lightweight. with a little modification to make it adaptive for an actual multi-processor system (ie. not relinquishing time slice) i think itll be quite scalable.
thanks for your input
I worship his divine shadow. ^
|
|
|
|
|
FYI, I tend to avoid circular linked lists; I typically use
either a single-linked list with a dummy head node,
or a double-linked list with a dummy head node and a dummy tail node (different from head);
reason is you can then walk the list forwards/backwards (without removing nodes) until
next/prev equals null.
Combining the head and tail dummies would save a node, but that is typically not worth the hassle (unless nodes are really big of course).
Luc Pattyn
|
|
|
|
|
true, and big nodes should be seen by a doctor lest they hinder the GC
I worship his divine shadow. ^
|
|
|
|
|
How do i create tab control that in runtime i can edit the tab pages names (like excel)
GALGAL
|
|
|
|