I have created a VB6 function to draw the shape on the screen from a VCA shape data. Its working fine with me. But there are some issues worrying me to go for the next level :) I would like to get expert's advice on this matter.
- This function will take the data from "TRCFMT=1;1000;E;R;F" then draw the shape only if it is in ASCII absolute format (1). How can I read the other formats like Binary absolute format, Binary differential format or Packed binary format?
- Also how can I read the data if the Radii is unevenly specified(U)?
My VB6 function is as below...
Public Sub DrawShape(Destination As PictureBox, StringPoints As String, DrawColor As ColorConstants, BackColor As ColorConstants)
Const PI = 3.14159265359
Dim StartPoint, EndPoint, StepFactor As Double
Dim Radii() As String
Dim MaxData As Integer
'drawing default
With Destination
.Appearance = 0
.BorderStyle = 1
.ScaleMode = 6 ' in millimeters
.DrawWidth = 2 '.5 ' thickness of the outerline
.AutoRedraw = True
.Cls
.BackColor = BackColor
.ForeColor = DrawColor
If .Width < 80 Then .Width = 80 ' to make standard drawing space
If .Height < 50 Then .Height = 50 ' to make standard drawing space
End With
Radii = Split(StringPoints, ";") ' getting a complete array of Radii from the string
MaxData = UBound(Radii) ' finding the array count
StartPoint = 0 'drawing the starting point
StepFactor = (PI * 2) / (MaxData + 1)
EndPoint = StepFactor
'Drawing the shape
For i = 0 To MaxData
Destination.Circle (Destination.ScaleWidth / 2, Destination.ScaleHeight / 2), Radii(i) / 115, , StartPoint, EndPoint 'Radii(i) / 115 was default to Radii(i) / 100, each monitor will need adjustment
DoEvents ' let the system handle other load while drawing. it will also make feel like drawing on the screen
StartPoint = EndPoint ' have to start the next line from where the arc was end
EndPoint = StartPoint + StepFactor ' draw the arc until the equally divided stepfactor value
Next
End Sub
Removed the error handling options to reduce the complexity here.
"StringPoints" contains only the radii like below. I had managed to create another function for such array.
2529;2535;2540;2545;2550;2555;2560;2565;2569;2575;2581;2586; 2591;2597;26022607;2613;2619;2625;2630;2633;2635;2639;2643;2 647;2652;2657;2663;2673;26822690;2696;2701;2705;2709;2712;27 16;2720;2723;2726;2729;2733;2735;etc...
Bookmarks