|
TJS4u wrote: i treid the code below but nothing happens....
That is because you are not doing anything! What are you expecting? Do you know how to use a serial port?
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
hello leppie
my requirement is to connect a microcontrolelr to the serial port .
i tried this to see if data is in the buffer ... then it can't be read back
Thanks
|
|
|
|
|
What are you expecting to happen? You can't just write "A" to a serial port and then expect to read it back.
You need to have some hardware connected to the serial port that either responds to data, or transmits data in.
Simon
|
|
|
|
|
You can use SerialPort class in System.IO.Ports namespace for communicating with serial port. It provides various methods/event to read and write data.
|
|
|
|
|
hello
i treid the code below but nothing happens....
serialPort1.PortName = "COM1";
serialPort1.BaudRate = 9600;
serialPort1.DataBits = 8;
serialPort1.Parity = Parity.None;
serialPort1.StopBits = StopBits.One;
serialPort1.Open();
serialPort1.Write("A");
serialPort1.Close();
serialPort1.Open();
textBox1.Text = serialPort1.ReadLine();
|
|
|
|
|
Hi,
I think you are going in wrong direction. Serial port are buffered port and it has got two seperate data line, which are TX (Transmit) and RX(Receive). Now if you send any data to your serial port it's there in TX buffer. So which ever device connected to this serial port suppose to get that.
So, you want to see whether this code working for you or not. So do one thing. Get one RS232 connector and short both RX pin and TX pin. Now try the same code, it should work. This is called loopback mechanism in hardware style.
If you don't have this connector then there are few utility software which create virtual serial port and same utility can create loopback mechanism also. This is loopback in software style.
I am sure either of two approach should solve your problem. Please let me know if you still face issues.
Himadri
|
|
|
|
|
Seriously, aren't there enough articles about this topic here on CP?
That's what the search function is for.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi
I would like to draw an image that contains lines , text and rectangles.
In order to draw it I need to use the graphics object.
Also I would like window\control will handle scroll bar, drawing the image automatically in case the image move with the mouse for example, so I was thinking to use image object in order to store my image
How can I export the image I created manually from graphic object (after I create all the items I want such as line, rectangle, etc on panel for example) to image object?
Thanks
Ronen
|
|
|
|
|
You don't need to - just create a new Bitmap, the create a new graphics object, and draw to that
e.g. something like
Bitmap bmp = new Bitmap( 640, 480 );
using( Graphics G = Graphics.FromImage(bmp) )
{
G.FillRectangle(...);
}
|
|
|
|
|
OK Thank u all,
Itry to draw to bitmap and it work great
How can I display it in the form
Should I create picturebox control and load the bitmap to it?
I would like the form to create scroll bar automaticly if need (in case the form is smaller then the bitmap image)
Ronen
|
|
|
|
|
Hi,
you can create a Bitmap, obtain the corresponding Graphics (through Graphics.FromImage), paint
to your hearts content, then use Bitmap.Save
BTW: there are several articles about Paint-like apps here on CP.
|
|
|
|
|
Check the URL
[^]">
Cheers!!
Brij
|
|
|
|
|
|
skvs wrote: I'm trying to draw a sine wave on a panel using GDI+, but everytime when i Re-Size it has to redraw the waveform.
You've already asked this question dozens of times and been told that that is how it works. When the form is resized or covered up you are responsible for redrawing it at the size you want. There is no magic gdi+ routine that redraws or zooms in for you.
skvs wrote: Can anyone knows about "Chart control" in C# using GDI+ and if any documentation link is there please give it.
I've already given you the link to the chart control docs and samples.
Simon
|
|
|
|
|
skvs wrote: Can anyone knows about "Chart control" in C# using GDI+ and if any documentation link is there please give it.
Google know lot's of them.
|
|
|
|
|
Help[^]
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hello everyone,
I want to embed a resource file (xml file) into a DLL assembly and access the xml file from the DLL.
But I can not find sample code for me to do this. All samples I could find is dealing with embed and access image in resource file. Could anyone show me a sample please?
thanks in advance,
George
|
|
|
|
|
It's XML so just store it as a string. You don't need anything fancier than that. However, if you add a settings file and add it to there, you'll be able to change it by changing it in the config file ( although as it's an XML file, you may need to encode it, or put it in a CDATA section )
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Thanks Christian!
If I have already added an XML file into my project, how to make it into a resource file into the final DLL assembly?
regards,
George
|
|
|
|
|
Assembly assembly = Assembly.GetExecutingAssembly();
string[] resources = assembly.GetManifestResourceNames();
Stream s = assembly.GetManifestResourceStream("YourResourceName")
|
|
|
|
|
Thanks Navaneeth,
Stupid question. If I have already added an XML file into my project, how to make it into a resource file into the final DLL assembly?
regards,
George
|
|
|
|
|
Select the XML file, in the properties there is an option to make it embedded. I don't remember the name exactly.
|
|
|
|
|
Thanks Navaneeth!
1.
I find this item. Do you mean this -- Build Action --> Embedded Resource?
2.
What is the differences between Build Action --> Embedded Resource and Build Action --> Resource?
regards,
George
|
|
|
|
|
Choose the property for that file, select "Build Action" as "Embedded Resource"
|
|
|
|
|
Thanks Navaneeth,
There is another option called resource other than embedded resource. What is the differences?
regards,
George
|
|
|
|