' (C) Copyright 1997 by SoftSource. All rights reserved.
' Sample Visual Basic code for working with Vdraft
'
' This code demonstrates setting information
' in a drawing
Option Explicit
'
' miscellaneous vars
Public AppName$ ' name string for the app
Public DirtyFlag% ' Used to flag when changes have been made
Public DwgName% ' used to show that the user entered a new drawing name
Public gblAngScaleFlag% ' allows the angle sample box to get rescaled once only
Public gblAspect ' used by DrawSampleAngle
Public gblDwgNameWasChanged% ' shows if the user changed the drawing name
'
' vars used as constants
Public CRLF As String ' mainly for use in dlgs
Public PI As Double ' a slice of....
'
' objects for talking to Vdraft with
Public Vdraft As Object ' the Vdraft object itself
Public Doc As Object ' the active drawing (assumedly the New drawing)
'
' miscellaneous globals
Public gblGetNameFlag As Integer ' determines behavior of GetNameForm
Public gblNewName As String ' used with NewNameForm
Public gblLTName$ ' used with new line type form
Public gblLTDesc$ ' used with new line type form
Public gblLTSpec$ ' used with new line type form
Public gblMode As Integer ' used to determine operational mode on some dlgs
Public gblEditValue As Double ' used with new line type form
Public Const LTMax = 32
Public LineTypes(LTMax) As String ' linetype name
Public LTSpec(LTMax) As String ' linetype spec
Public LTDesc(LTMax) As String ' linetype description
Public Const LayMax = 50
Public Layers(LayMax), LayLT(LayMax) As String ' layers
Public LayColor(LayMax) As Long
Public Const TSMax = 20 ' maximum number of text styles
Public Const TSParams = 9 ' number of params in the array
Public TextStyle(TSMax, TSParams) As String ' text style information
Public Const TSFontFile = 0
Public Const TSBigFontFile = 1
Public Const TSDefHeight = 2
Public Const TSObliqueAngle = 3
Public Const TSXScale = 4
Public Const TSUpsideDown = 5
Public Const TSVertical = 6
Public Const TSBackwards = 7
Public Const TSName = 8
'
' color constants, these are done in decimal because
' when they are done in hex VB sometimes interprets them
' as signed values instead of unsigned.
Public Const WHITE As Long = 16777215
Public Const MAGENTA As Long = 16711935
Public Const YELLOW As Long = 65535
Public Const GREEN As Long = 65280
Public Const RED As Long = 255
Public Const CYAN As Long = 16776960
Public Const BLUE As Long = 16711680
'
' external function declarations
Declare Function GetPrivateProfileStringA Lib "Kernel32" (ByVal lpAppName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Integer, ByVal lpFileName As String) As Integer
Declare Function WritePrivateProfileString Lib "Kernel32" (ByRef lpAppName As String, ByRef lpKeyName As String, ByRef lpString As String, ByRef lpFileName As String)
Function Str2Color(Clr As String) As Long
'
' convert the incoming string literal to a color value