Results 1 to 1 of 1

Thread: Drawing of VCA shapes programmatically - Questions!

  1. #1
    OptiBoard Apprentice gsmahesh's Avatar
    Join Date
    Jul 2010
    Location
    Kuwait City, Kuwait
    Occupation
    Lens Manufacturer
    Posts
    35

    Confused Drawing of VCA shapes programmatically - Questions!

    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...
    Last edited by gsmahesh; 01-22-2016 at 08:26 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. best kids shapes and collections
    By jeffzilla in forum General Optics and Eyecare Discussion Forum
    Replies: 3
    Last Post: 08-26-2010, 12:42 PM
  2. Public Relations Department: Back to the drawing board!
    By rinselberg in forum Just Conversation
    Replies: 2
    Last Post: 02-14-2009, 08:32 PM
  3. Drawing a blank
    By MEB in forum Ophthalmic Optics
    Replies: 12
    Last Post: 04-05-2005, 11:00 AM
  4. drawing the line
    By edKENdance in forum General Optics and Eyecare Discussion Forum
    Replies: 12
    Last Post: 12-10-2003, 08:57 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •