![]() |
Click here to advertise with us
|
|
|||||||
| Graphics/GDI+ Graphics discussion for VB.NET applications, Winforms, Web, Compact Framework, etc. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hello Gentlemen,
Hoping you are good. Sorry can someone help me on this: I'm trying to do one sinusoid graphic representing the real time rolling motion of one ship on the seas. I take the inclination of the ship from serial input, and with this data I would to change the line of the sinusoid graphic; exemple: at fixing zero degrre of inclination, the diagram should going on zero on y daxis. y axis=inclination of the ship x axis=time (every 1 millisecond.) Can somebody help me on this, please?!?!' All my best, zippo |
|
|||
|
Do you know how to create a GDI layer ?
your going to need something like this Code:
Dim g As Graphics = PictureBox1.CreateGraphics
g.DrawArc(New Pen(Color.Black), 1, 1, 100, 100, 5, 10)
|
|
|||
|
Hi Zippo,
I posted a detailed example on another forum (under my other nom de plume boops boops) for someone wanting to plot the output from a serial port. It's a bit like a simple oscilloscope trace. In that case it was for plotting the varying DC voltage output of a solar cell, but maybe it will give you some ideas for displaying your ship inclination data. See post #47 in [RESOLVED] Converting voltage level into graphical display - Page 2 - VBForums. @anthony.selby: I don't agree with you about using CreateGraphics for any kind of drawing. That seems to be a hangover from VB6. The idea of GDI+ is to use the Graphics object provided in the Paint event -- of a form, a picture box etc. |
|
|||
|
Hello Gentlemen,
First of all, thanks a lot to all for the kind help you give me. Anthony, pleasure to listen you, but why I can take the signal from serial port to arc?! Dear Vicj, thanks, I like very much thuis solution, but after try, the system is not works, and I have in debugging, one error on datapoints: parameter not valid. What I can do for make this working?!?!? waiting your light!!! my best, zippo |
|
|||
|
Hi Mister Zippo,
If you have a debugging problem you want solved here, please post the code you are using to this thread and indicate where the error occurs. The code I sent to the other forum probably needs some more error checking, but I can't remember all the details. I have no idea what you mean by "on datapoints". Besides, other people reading this thread may also want to know. Please enclose code in [code] ... [ /code] tags, for readability. ciao, VicJ |
|
|||
|
Ciao VicJ,
well, you're right. I post here below my code. Problem occurs then I debug the program, it not start and appear usual yellol window indicating the line: e.Graphics.DrawCurve(Pens.Green, DataPoints) telling: "NO VALID PARAMETER" Please help!!!!!!! Quote:
Waiting your kind reply. My best, zippo |
|
|||
|
Probably it is failing because there are not enough data points for DrawCurve: I forget whether the minimum is 2 or 3. There is not much point in trying to draw a curve until there are at least 3 data points anyway, so I suggest you enclose all the drawing code in the Paint sub in this If statement:
Code:
If voltsQ.Count > 2 ... End If |
|
|||
|
Dear VicJ,
Ok, I have make the if statement, and now the form is opening, but, still there is no curve drawing.noting. I cannot understand! please, what I fail?!? ![]() All my best. zippo zippo |
|
|||
|
do you call Serialsensor more then just on the load ... I only see where the data from your serial port is being read once ?
It looks to me that there will only ever be one value placed in the queue ? |
|
|||
|
Dear anthony,
I take one b, for example b1 that bring the value of inclination from PIC to PC, from 0 to 255, using serial communication serialsensor. and I would to have displayed one real time graphic, as a oscilloscope for example, of the track of that byte. When b1=122 --->0 degree, b1=255-->+25 degree, b1=0--->-25 degrees. as the sea motion is a period, what I should have will be like a sinusoid graphic! hope to be clear. Please, if you think it possible, help me!!! big regards, zippo |
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|