LiteCAD API Functions Guide
LiteCAD API Functions Guide
Home
Meaning
lcInitialize
lcUninitialize
lcInitialize
Home
Performs LiteCAD initialization. This function should be called once at the start of your
application. Global properties can be set before lcInitialize.
Return Value
If the function succeeds, the return value is nonzero (TRUE).
See Also
lcUninitialize
lcUninitialize
Performs LiteCAD uninitialization. This function should be called once as the last
operation performed by LiteCAD.
BOOL lcUninitialize (
BOOL bSaveConfig
);
Parameters
bSaveConfig
If TRUE, then LiteCAD will save current system configuration into the
LC_PROP_G_DIRCFG directory.
Return Value
If the function succeeds, the return value is nonzero (TRUE).
See Also
lcInitialize
Home
Home
Meaning
lcPropGetBool
lcPropGetInt
lcPropGetFloat
lcPropGetStr
lcPropGetHandle
lcPropPutBool
lcPropPutInt
lcPropPutFloat
lcPropPutStr
lcPropPutHandle
Global properties
Home
LiteCAD system variables are global properties, therefore in the lcProp... functions use
NULL for the hObject parameter.
Global properties can be set/get before calling of lcInitialize function.
Type
Ac
ces
s
Meaning
LC_PROP_G_REGCODE
string
Registration code
LC_PROP_G_VERSION
string
LiteCAD version
LC_PROP_G_MSGTITLE
string
RW
LC_PROP_G_HELPFILE
string
RW
LC_PROP_G_DIRDLL
string
Directory of running
Litecad.dll module
RW
RW
RW
Directory of drawing's
templates (*.lcd), by default
<LC_PROP_G_DIRDLL>\Tem
plates
Property
LC_PROP_G_DIRFONTS
LC_PROP_G_DIRLNG
LC_PROP_G_DIRTPL
string
string
string
LC_PROP_G_DIRCFG
string
RW
LC_PROP_G_SAVECFG
bool
RW
LC_PROP_G_ICON16
handle
string
RW
W
LC_PROP_G_ICON32
handle
string
RW
W
LC_PROP_G_RULERBMP
handle
LC_PROP_G_DLGVAL
string
RW
LC_PROP_G_PRNUSEBMP
bool
RW
LC_PROP_G_PRNBMPFILE
string
RW
RW
Meaning of negative
PointSize parameter, if TRUE
- size in pixels, FALSE - % of
window height
LC_PROP_G_PNTPIXSIZE
bool
LC_PROP_G_GETDELENT
bool
RW
Controls if lcBlockGetEnt...
functions will retrieve
deleted entities or not
LC_PROP_G_SOLIDBARC
bool
RW
LC_PROP_G_FILEPROGRES
S
bool
RW
LC_PROP_G_GBRBMPFILE
string
RW
LC_PROP_G_PICKADD
bool
RW
LC_PROP_G_PICKBYRECT
bool
RW
LC_PROP_G_PICKDRAG
bool
RW
LC_PROP_G_PICKBOXSIZE
int
RW
LC_PROP_G_GRIPSIZE
int
RW
LC_PROP_G_GRIPCOLORF
int
RW
LC_PROP_G_GRIPCOLORB
int
RW
LC_PROP_G_CAMERA_COU
NT
int
RW
LC_PROP_G_CAMERA_I
int
RW
LC_PROP_G_CAMERA_NA
ME
string
LC_PROP_G_CAMERA_ON
bool
LC_PROP_G_CAMERA_TIM
E
int
RW
LC_PROP_G_CAMERA_WID
TH
int
LC_PROP_G_CAMERA_HEI
GHT
int
LC_PROP_G_CAMERA_BIT
S
handle
int
LC_PROP_G_CAMERA_BPR
OW
int
LC_PROP_G_WF_LEFT
float
RW
LC_PROP_G_WF_BOTTOM
float
RW
LC_PROP_G_WF_WIDTH
float
RW
LC_PROP_G_WF_HEIGHT
float
RW
LC_PROP_G_WF_HIDE
bool
RW
Drawing database
Home
The LiteCAD drawing object is the internal database representing a drawing. The
database contains graphical objects (entities) and non-graphical (named objects). You
must create at least one instance of a drawing object in your application. You can load a
file into a drawing object or create a drawing programmatically. To view and
interactively edit a drawing, an application must link it with a LiteCAD design window.
When you are finished working with a drawing object you must delete its handle to free
system memory allocated to it.
These are the functions used to manage LiteCAD drawing object:
Function
Meaning
lcCreateDrawing
lcDeleteDrawing
lcDrwNew
lcDrwLoad
lcDrwLoadMem
lcDrwInsert
lcDrwCopy
Copies a drawing
lcDrwSave
lcDrwSaveMem
Named objects
lcDrwAddLayer
lcDrwAddLinetype
lcDrwAddLinetypeF
lcDrwAddTextStyle
lcDrwAddDimStyle
lcDrwAddPntStyle
lcDrwAddImage
lcDrwAddImage2
lcDrwAddImage3
lcDrwAddBlock
lcDrwAddBlockFromDrw
lcDrwAddBlockFromFile
lcDrwAddBlockFile
lcDrwAddBlockPaper
lcDrwAddBlockCopy
lcDrwDeleteObject
lcDrwCountObjects
lcDrwSortObjects
Retrieve objects
lcDrwGetFirstObject
lcDrwGetNextObject
lcDrwGetObjectByName
lcDrwGetObjectByID
lcDrwGetObjectByIDH
lcDrwGetEntByID
lcDrwGetEntByIDH
lcDrwGetEntByKey
Other
lcDrwPurge
lcDrwClearXData
lcDrwExplode
lcDrwSetLimits
lcDrwUndoRecord
lcDrwUndo
Graphic objects are contained in blocks, therefore, in order to add graphics into a
Acce
ss
Meaning
LC_PROP_DRW_UID
string
Unique Identifier of a
drawing
LC_PROP_DRW_FILENAME
string
RW
Drawing's filename
LC_PROP_DRW_DESCR
LC_PROP_DRW_COMMENT
string
RW
Drawing's description
LC_PROP_DRW_READONLY
bool
RW
"ReadOnly" flag
LC_PROP_DRW_DIRTY
bool
RW
"Drawing was
modified" flag
Property
LC_PROP_DRW_IDMAX
int
string
Maximal value of
object identifier
Hexadecimal string
(up to 16 characters)
LC_PROP_DRW_SYNCZOOM
bool
RW
"Synchronize Layouts
Zoom" flag
LC_PROP_DRW_HASALPHABLE
ND
bool
LC_PROP_DRW_COLORBACKM
int
RW
LC_PROP_DRW_COLORBACKP
int
RW
LC_PROP_DRW_COLORFOREM
int
RW
Model Space
foreground color
(COLORREF)
LC_PROP_DRW_COLORFOREP
int
RW
Paper Space
foreground color
(COLORREF)
LC_PROP_DRW_COLORCURSOR
M
int
RW
LC_PROP_DRW_COLORCURSOR
P
int
RW
LC_PROP_DRW_COLORPAPER
int
RW
handle
string
RW
LC_PROP_DRW_LINETYPE
handle
string
RW
Handle to active
linetype
Name of active
linetype
LC_PROP_DRW_LTSCALE
float
RW
LC_PROP_DRW_TEXTSTYLE
handle
string
RW
LC_PROP_DRW_PNTSTYLE
handle
string
RW
LC_PROP_DRW_DIMSTYLE
handle
string
RW
Handle to active
dimension style
Name of active
dimension style
LC_PROP_DRW_BLOCK
handle
string
RW
LC_PROP_DRW_FILLING
handle
string
RW
LC_PROP_DRW_BARTYPE
int
RW
LC_PROP_DRW_LWMODE
int
RW
"Display linewidth"
flag
LC_PROP_DRW_LWIDTH
int
RW
Current linewidth
mode (LC_LW_THIN,
LC_LW_REAL,
LC_LW_PIXEL)
LC_PROP_DRW_LWDEFAULT
int
RW
int
RW
Linewidth screen
scale, mm / pixel
(used to display
linewidth
LC_LW_PIXEL mode)
LC_PROP_DRW_COLOR
string
RW
Active color
LC_PROP_DRW_COLORBYLAYE
R
bool
RW
Color "ByLayer"
LC_PROP_DRW_COLORBYBLOC
K
bool
RW
Color "ByBlock"
LC_PROP_DRW_COLORI
int
bool
RW
R
LC_PROP_DRW_COLORT
int
bool
RW
R
True Color
(COLORREF)
TRUE if the color is
RGB
LC_PROP_DRW_FCOLOR
string
RW
LC_PROP_DRW_FCOLORBYLAY
ER
bool
RW
LC_PROP_DRW_FCOLORBYBLO
CK
bool
RW
LC_PROP_DRW_FCOLORI
int
bool
RW
R
LC_PROP_DRW_FCOLORT
int
bool
RW
R
True Color
(COLORREF)
TRUE if the color is
RGB
LC_PROP_DRW_SELPENMODE
int
RW
LC_SELPEN_COLOR or
LC_SELPEN_BYENT
LC_PROP_DRW_SELCOLOR
int
RW
LC_PROP_DRW_LWSCALE
Selection
Color of selected
entities (for
LC_SELPEN_COLOR
mode)
LC_PROP_DRW_SELCOLOR2
int
RW
LC_PROP_DRW_SELBYLAYER
bool
RW
LC_PROP_DRW_SELINPGON
bool
RW
Select polygons by
click on inner area
LC_PROP_DRW_SELINPGONF
bool
RW
LC_PROP_DRW_SELI
NPGON works only for
filled polygons
LC_PROP_DRW_SELINIMG
bool
RW
LC_PROP_DRW_LOCKSEL
bool
RW
"Enable selection on
locked layers" flag
bool
RW
Enable/disable grips
Grips
LC_PROP_DRW_ENABLEGRIPS
LC_PROP_DRW_GRIPSLIMIT
int
RW
Max number of
selected entities to
display grips
LC_PROP_DRW_GRIPCOLORF
int
RW
LC_PROP_DRW_GRIPCOLORB
int
RW
bool
RW
Enable exploding of
arcs, circles, ellipses
Explode options
LC_PROP_DRW_EXPLODEARC
LC_PROP_DRW_EXPPLINELA
bool
RW
Explode bulge
polylines: TRUE-to
lines and arcs, FALSEto lines
LC_PROP_DRW_EXPSIMPLINE
bool
RW
Enable exploding
simple polylines (to
lines)
LC_PROP_DRW_EXPTEXTSPLIN
E
bool
RW
If TRUE - explode
TrueType text to
splines, FALSE - to
polylines
handle
Handle to "Model
Space" block
LC_PROP_DRW_LAYER_0
handle
LC_PROP_DRW_LINETYPE_CON
T
handle
Handle to linetype
"Continuous"
LC_PROP_DRW_LINETYPE_BYL
AY
handle
Handle to linetype
"ByLayer"
LC_PROP_DRW_LINETYPE_BYB
LK
handle
Handle to linetype
"ByBlock"
LC_PROP_DRW_TEXTSTYLE_ST
D
handle
LC_PROP_DRW_PNTSTYLE_STD
handle
LC_PROP_DRW_DIMSTYLE_STD
handle
Handle to dimension
style "Standard"
LC_PROP_DRW_FILL_NONE
handle
LC_PROP_DRW_FILL_SOLID
handle
LC_PROP_DRW_RESOLARC
int
RW
LC_PROP_DRW_RESOLSPLINE
int
RW
LC_PROP_DRW_RESOLTEXT
int
RW
float
RW
Default resolution
View limits
LC_PROP_DRW_LIM_MIXPIXSI
ZE
LC_PROP_DRW_LIM_MAXLEF
float
RW
Xmin of limits
rectangle (see also
lcDrwSetLimits)
LC_PROP_DRW_LIM_MAXBOT
float
RW
Ymin of limits
rectangle
LC_PROP_DRW_LIM_MAXRIG
float
RW
Xmax of limits
rectangle
LC_PROP_DRW_LIM_MAXTOP
float
RW
Ymax of limits
rectangle
LC_PROP_DRW_LIM_MAXON
bool
RW
int
RW
float
RW
string
RW
LC_PROP_DRW_XDATASIZE
int
RW
LC_PROP_DRW_XDATA
handle
RW
Named objects
Home
LiteCAD drawing files contain both graphical and nongraphical objects. You use
graphical objects, such as lines, arcs, and circles, to create your designs. At the same
time, you use nongraphical information, referred to herein as named objects, to
manage the design. Loosely speaking, named objects are graphical object
specifications. Named objects include such items as text styles, dimension styles,
layers, linetypes and so on. Named objects help you design more efficiently. For
example, if you use a set of linetype properties frequently, you can save the properties
as a named linetype and then apply the linetype to lines in your future drawings.
LiteCAD stores named objects by type, in different tables. LiteCAD's API provides
functions to add, delete and change properties of the named objects. You can view and
revise all named objects using LiteCAD's dialog boxes.
The following table enumerates LiteCAD's named objects.
Named object
Description
Block
Layer
Linetype
Text style
Point style
Dimension
style
Raster image
Filling
Meaning
LC_PROP_TABLE_ID
int
string
Unique Identifier
Hexadecimal string (up
to 16 characters)
LC_PROP_TABLE_NAME
string
RW
Table Name
LC_PROP_TABLE_DESCR
string
RW
Table description
LC_PROP_TABLE_TYPE
int
Property
Type
LC_PROP_TABLE_DELETED
bool
"Deleted" flag
LC_PROP_TABLE_DRW
handle
Handle to owner
drawing
LC_PROP_TABLE_PRIORITY
int
RW
LC_PROP_TABLE_NREFS
int
A number of references
to the object
LC_PROP_TABLE_XDATASIZE
int
RW
LC_PROP_TABLE_XDATA
handle
RW
LC_PROP_TABLE_XSTR
string
RW
LC_PROP_TABLE_INT0
...
int
RW
float
RW
LC_PROP_TABLE_INT4
LC_PROP_TABLE_FLOAT0
...
LC_PROP_TABLE_FLOAT4
See also
Retrieve objects
Home
Entities are visible graphical objects (lines, circles, raster images, and so on) that make
up a drawing. Graphical objects have typical properties such as Identifier, Layer,
Linetype, Color, etc. They also have specific properties, depending on their object type,
such as, Center, Radius, and Area.
LC_PROP_ENT_TYPE value
Point
LC_ENT_POINT
Construction Line
LC_ENT_XLINE
Line
LC_ENT_LINE
Polyline
LC_ENT_POLYLINE
Rectangle
LC_ENT_RECT
Circle
LC_ENT_CIRCLE
Arc
LC_ENT_ARC
Ellipse
LC_ENT_ELLIPSE
Text
LC_ENT_TEXT
Arc Text
LC_ENT_ARCTEXT
Multiline Text
LC_ENT_MTEXT
Block reference
LC_ENT_BLOCKREF
LC_ENT_IMAGEREF
LC_ENT_ECW
Hatch
LC_ENT_HATCH
Dimension Rotated
LC_ENT_DIMROT
Dimension Aligned
LC_ENT_DIMALI
Dimension Ordinate
LC_ENT_DIMORD
Dimension Radial
LC_ENT_DIMRAD
Dimension Diametric
LC_ENT_DIMDIA
Dimension Angular
LC_ENT_DIMANG
Leader
LC_ENT_LEADER
Viewport
LC_ENT_VIEWPORT
Barcode
LC_ENT_BARCODE
Camera view
LC_ENT_CAMERA
Entities are contained in blocks, therefore, in order to add graphics into a drawing, you
have to add it into specified block.
Each entity has the following properties:
Type
Access
Meaning
LC_PROP_ENT_TYPE
int
Type of graphic
object (see above)
LC_PROP_ENT_ID
int
string
Unique Identifier
Hexadecimal string
(up to 16
characters)
LC_PROP_ENT_KEY
int
RW
User value
LC_PROP_ENT_BLOCK
handle
string
Handle to owner
Block
Name of owner
Block
LC_PROP_ENT_DRW
handle
Handle to owner
Drawing
LC_PROP_ENT_LAYER
handle
string
RW
Handle to Layer
Name of Layer
LC_PROP_ENT_LINETYPE
handle
string
RW
Handle to Linetype
Name of Linetype
LC_PROP_ENT_LTSCALE
float
RW
Linetype scale
LC_PROP_ENT_LWIDTH
int
RW
Linewidth
int
string
RW
string
int
RW
RW
Color name
RGB value
(COLORREF)
Property
LC_PROP_ENT_PRIORITY
Outline Color
LC_PROP_ENT_COLOR
LC_PROP_ENT_COLORI
int
bool
RW
R
LC_PROP_ENT_COLORT
int
bool
RW
R
True Color
(COLORREF)
TRUE if the color is
RGB
LC_PROP_ENT_COLORBYLAYER
bool
RW
Color "ByLayer"
LC_PROP_ENT_COLORBYBLOCK
bool
RW
Color "ByBlock"
LC_PROP_ENT_FILLING
handle
string
RW
RW
LC_PROP_ENT_FILLED
bool
LC_PROP_ENT_SOLIDFILL
bool
RW
LC_PROP_ENT_FCOLOR
string
int
RW
RW
LC_PROP_ENT_FCOLORI
int
bool
RW
R
LC_PROP_ENT_FCOLORT
int
bool
RW
R
LC_PROP_ENT_FCOLORBYLAYER
bool
RW
Filling Color
"ByLayer"
LC_PROP_ENT_FCOLORBYBLOCK
bool
RW
Filling Color
"ByBlock"
LC_PROP_ENT_FALPHA
int
RW
Alpha value
(1..255), for semitransparent filling
bool
"ReadOnly" flag
(depends on a layer)
Flags
LC_PROP_ENT_LOCKED
LC_PROP_ENT_VISIBLE
bool
"Visible" flag
(depends on a layer)
LC_PROP_ENT_HIDDEN
bool
RW
"Hidden" flag
LC_PROP_ENT_DELETED
bool
RW
"Deleted" flag
LC_PROP_ENT_IMMORTAL
bool
RW
LC_PROP_ENT_SELECTED
bool
"Selected" flag
LC_PROP_ENT_XMIN
float
X min
LC_PROP_ENT_YMIN
float
Y min
LC_PROP_ENT_XMAX
float
X max
LC_PROP_ENT_YMAX
float
Y max
LC_PROP_ENT_XCEN
float
Center X
LC_PROP_ENT_YCEN
float
Center Y
LC_PROP_ENT_Z
float
RW
Z-coordinate
LC_PROP_ENT_XDATASIZE
int
RW
LC_PROP_ENT_XDATA
handle
RW
LC_PROP_ENT_XSTR
string
RW
Geometric extents
Custom Data
Meaning
lcEntErase
lcEntMove
Moves object
lcEntScale
Scales object
lcEntRotate
Rotates object
lcEntMirror
Mirrors object
lcEntExplode
Explodes object
lcEntOffset
Offsets object
lcEntToTop
lcEntToBottom
lcEntToAbove
lcEntToUnder
lcEntGetGrip
lcEntPutGrip
lcEntUpdate
Updates entoty
lcEntCopyBase
lcIntersection
See also
Retrieve objects
Retrieve objects
Home
LiteCAD drawing contains a named objects as a layer, linetype, text style, etc. and a
graphics objects, as a line, polyline, arc, text, etc.
There are several functions intended to find required object.
Retrieve named objects
Function
Meaning
lcDrwGetFirstObject
lcDrwGetNextObject
lcDrwGetObjectByName
lcDrwGetObjectByID
lcDrwGetObjectByIDH
Meaning
lcDrwGetEntByID
lcDrwGetEntByIDH
lcDrwGetEntByKey
lcWndGetEntByID
lcWndGetEntByIDH
lcWndGetEntByKey
lcBlockGetFirstEnt
lcBlockGetNextEnt
lcBlockGetLastEnt
lcBlockGetPrevEnt
lcBlockGetEntByID
lcBlockGetEntByIDH
lcBlockGetEntByKey
lcBlockGetFirstSel
lcBlockGetNextSel
Locate by position
lcWndGetEntByPoint
lcWndGetEntByPoint2
lcWndGetEntsByRect
lcWndGetEntity
Graphics window
Home
The LiteCAD graphics window is used to display and edit graphics data contained in the
drawing object. Put it as a child-window it on the desired window/form of your
application, by call the function lcCreateWindow, and link it with a drawing by the
function lcWndSetBlock.
These are the LiteCAD window functions:
Function
Meaning
lcCreateWindow
lcDeleteWindow
lcWndResize
lcWndRedraw
lcWndSetFocus
lcWndSetExtents
lcWndZoomRect
lcWndZoomScale
lcWndZoomMove
lcWndGetCursorCoord
lcWndExeCommand
lcWndOnClose
lcWndSetBlock
lcWndSetProps
lcWndGetEntByPoint
lcWndGetEntByPoint2
lcWndGetEntsByRect
lcWndGetEntity
lcWndGetEntByID
lcWndGetEntByIDH
lcWndGetEntByKey
lcCoordDrwToWnd
lcCoordWndToDrw
Acces
s
Meaning
LC_PROP_WND_ID
int
RW
Window Identifier
LC_PROP_WND_WIDTH
int
LC_PROP_WND_HEIGHT
int
LC_PROP_WND_HWND
handl
e
WinAPI handler
(HWND) of a window
LC_PROP_WND_BLOCK
LC_PROP_WND_VIEWBLOCK
handl
e
Handle to a block
linked with a window
LC_PROP_WND_DRW
handl
e
Handle to a drawing
currently displayed in
a window
Property
LC_PROP_WND_RULERS
bool
RW
Visibility of window
rulers (The window
must be created with
LC_WS_RULERS style
flag)
LC_PROP_WND_HASFOCUS
bool
TRUE, if a window
have input focus
LC_PROP_WND_PIXELSIZE
float
LC_PROP_WND_SELECT
bool
RW
Mode "Select
objects"
LC_PROP_WND_SELBYRECT
bool
RW
Implied windowing
for objects selection
LC_PROP_WND_BREAKPOINTS
bool
RW
Display breakpoints
LC_PROP_WND_BREAKPTNUMS
bool
RW
Display breakpoint
number
LC_PROP_WND_ALPHABLEND
bool
RW
LC_PROP_WND_STDBLKFRAME
bool
RW
standard block is
active
LC_PROP_WND_DTIME
int
Redraw time,
milliseconds
LC_PROP_WND_DRAWPAPER
bool
RW
LC_PROP_WND_FROZEN
bool
RW
"Frozen" mode
LC_PROP_WND_COMMAND
LC_PROP_WND_CMD
int
handl
e
bool
Id of active command
Handle to active
command
TRUE if has active
command
RW
RW
LC_PROP_WND_CMDENT1
bool
LC_PROP_WND_OSNAP
int
bool
LC_PROP_WND_CURSORARROW
LC_PROP_WND_CURSORSYS
bool
int
handl
e
RW
W
RW
LC_PROP_WND_CURSORCROSS
bool
RW
Enable crosshair
cursor
LC_PROP_WND_CURSORSIZE
int
RW
Size of crosshair
cursor, % of screen,
if negative - size in
pixels
LC_PROP_WND_PICKBOXSIZE
float
Half-size of selecting
square (drawing's
units)
LC_PROP_WND_CURX
int
float
Cursor position X,
pixels
Cursor position X,
drawing's units
LC_PROP_WND_CURY
int
float
Cursor position Y,
pixels
Cursor position Y,
drawing's units
LC_PROP_WND_CURLEF
float
Bottom side
coordinate of
selecting square
(drawing units)
LC_PROP_WND_CURBOT
float
LC_PROP_WND_CURRIG
float
LC_PROP_WND_CURTOP
float
LC_PROP_WND_COORDS
bool
RW
Display cursor
coordinates at leftbottom corner
LC_PROP_WND_XMIN
float
Xmin of currently
visible drawing's
area
LC_PROP_WND_YMIN
float
Ymin of currently
visible drawing's
area
LC_PROP_WND_XMAX
float
Xmax of currently
visible drawing's
area
LC_PROP_WND_YMAX
float
Ymax of currently
visible drawing's
area
LC_PROP_WND_XCEN
float
Center X of currently
visible drawing's
area
LC_PROP_WND_YCEN
float
Center Y of currently
visible drawing's
area
LC_PROP_WND_DX
float
Width of currently
visible drawing's
area
LC_PROP_WND_DY
float
Height X of currently
visible drawing's
area
LC_PROP_WND_GRIDSNAP
bool
RW
LC_PROP_WND_GRIDSHOW
bool
RW
Display coordinate
grid
LC_PROP_WND_GRIDDX
float
RW
Distance between
vertical grid lines
LC_PROP_WND_GRIDDY
float
RW
Distance between
horizontal grid lines
LC_PROP_WND_GRIDX0
float
RW
LC_PROP_WND_GRIDY0
float
RW
LC_PROP_WND_GRIDBOLDX
int
RW
LC_PROP_WND_GRIDBOLDY
int
RW
LC_PROP_WND_GRIDCOLOR
int
RW
LC_PROP_WND_GRIDDOTTED
bool
RW
LC_PROP_WND_GRIDCOLOR2
int
RW
LC_PROP_WND_GRIDDOTTED2
bool
RW
LC_PROP_WND_PANSTEP
int
RW
LC_PROP_WND_PANLW
bool
RW
LC_PROP_WND_PANIMAGE
bool
RW
Coordinate grid
Pan optimization
LC_PROP_WND_PANFILL
bool
RW
LC_PROP_WND_PANPIXSZ
bool
RW
Pan: reduce
resolution
LC_PROP_WND_MEASCOLORPN
T
int
RW
Measurement point
color (COLORREF)
LC_PROP_WND_MEASCOLORLIN
E
int
RW
Measurement line
color (COLORREF)
LC_PROP_WND_MEASLINESIZE
int
RW
Measurement line
size
LC_PROP_WND_MEASFONTSIZE
int
RW
Measurement font
size
LC_PROP_WND_MEASFILLAREA
int
RW
LC_PROP_WND_COLORINFBG
int
RW
LC_PROP_WND_COLORINFBOR
D
int
RW
LC_PROP_WND_COLORINFTEXT
int
RW
Measurements
Colors
If a drawing is not linked with a window, the following properties are available:
Property
LC_PROP_WND_LWMODE
Type
int
Access
Meaning
RW
LC_PROP_WND_LWSCALE
float
RW
LC_PROP_WND_COLORBG
int
RW
Window background
color
LC_PROP_WND_COLORCURSOR
int
RW
Cursor color
LC_PROP_WND_COLORFORE
int
RW
Foreground color
Home
The properties window is used to display and edit properties of various LiteCAD objects.
In Litecad.exe program this window is placed at left side of the design window. When
you select an entity, its properties appear in the window, so you can modify it (see the
picture below).
In your application you can put it on desired place. In order to link the properties
window with a drawing, you have to call the lcWndSetProps function.
These are the functions of the properties window:
Function
Meaning
lcCreateProps
lcDeleteProps
lcPropsResize
lcPropsUpdate
Status Bar
Home
The status bar is used to display cursor coordinates and other infoemation. In
Litecad.exe program status bar is placed at bottom side of a design window (see the
picture below).
Meaning
lcCreateStatbar
lcDeleteStatbar
lcStatbarResize
lcStatbarCell
lcStatbarText
lcStatbarRedraw
Code sample:
from \LC_Samples\LaserDraw\ project
HANDLE
g_hStatBar;
// status bar
//----------------------------------------------int APIENTRY _tWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR
lpCmdLine, int nCmdShow)
{
...
// Create StatusBar
g_hStatBar = lcCreateStatbar(
lcStatbarCell( g_hStatBar, 1,
lcStatbarCell( g_hStatBar, 2,
lcStatbarCell( g_hStatBar, 3,
lcStatbarCell( g_hStatBar, 4,
...
g_hwMain );
0 );
100 );
200 );
350 );
}
//----------------------------------------------void OnAppResize (WPARAM SizeType, int Wmain, int Hmain)
{
int x, y, w, h, Hsbar;
// Default height of the status bar
Hsbar = lcPropGetInt( 0, LC_PROP_G_SBARHEIGHT );
...
// StatusBar position
x = 0;
y = Hmain - Hsbar + 1;
w = Wmain;
h = Hsbar;
lcStatbarResize( g_hStatBar, x, y, w, h );
}
//----------------------------------------------void OnMouseMove (HANDLE hEvent)
{
...
// Display data in status bar
// X
okDblToStr( X, szNum, 2 );
swprintf( szBuf, L"X: %s", szNum );
lcStatbarText( g_hStatBar, 1, szBuf );
// Y
okDblToStr( Y, szNum, 2 );
swprintf( szBuf, L"Y: %s", szNum );
lcStatbarText( g_hStatBar, 2, szBuf );
// redraw the status bar
lcStatbarRedraw( g_hStatBar );
}
Events
Home
Event processing permits you to control user actions while the user is running your
application. LiteCAD features several types of events that can be used to instantiate
additional procedural code. For each of these events you create an "event procedure" in
your application. It has the following syntax:
Event
lcEventSetProc
lcEventReturnCode
lcEventsEnable
Meaning
LC_EVENT_MOUSEMOVE
LC_EVENT_LBDOWN
LC_EVENT_LBUP
LC_EVENT_LBDBLCLK
LC_EVENT_RBDOWN
LC_EVENT_RBUP
LC_EVENT_KEYDOWN
LC_EVENT_PAINT
LC_EVENT_VIEWBLOCK
LC_EVENT_WNDVIEW
LC_EVENT_SNAP
LC_EVENT_ADDSTR
LC_EVENT_FILE
LC_EVENT_EXTENTS
LC_EVENT_ADDENTITY
LC_EVENT_PICKENT
LC_EVENT_SELECT
LC_EVENT_ENTPROP
LC_EVENT_DRWPROP
LC_EVENT_ADDCMD
LC_EVENT_CCMD
Some events are manifested by setting a return value, in those cases, LiteCAD's
behavior is dependant upon the return value.
The function lcEventReturnCode is used to set event return code.
Inside the event procedure, you can access the following event properties by using the
hEvent parameter:
Type
Access
Meaning
LC_PROP_EVENT_TYPE
int
Event type
(LC_EVENT_MOUSEMOVE
and other)
LC_PROP_EVENT_APPPRM1
int
Application-defined
parameter 1
LC_PROP_EVENT_APPPRM2
handle
Application-defined
parameter 2
LC_PROP_EVENT_WND
handle
LC_PROP_EVENT_DRW
handle
Drawing
LC_PROP_EVENT_BLOCK
handle
Block
LC_PROP_EVENT_ENTITY
handle
Entity
LC_PROP_EVENT_HDC
handle
Device context
LC_PROP_EVENT_HCMD
handle
Object defined in a
custom command
Property
LC_PROP_EVENT_INT1
LC_PROP_EVENT_INT2
LC_PROP_EVENT_INT3
LC_PROP_EVENT_INT4
LC_PROP_EVENT_INT5
int
RW
Integer value.
The meaning depends on
event type.
LC_PROP_EVENT_FLOAT1
LC_PROP_EVENT_FLOAT2
LC_PROP_EVENT_FLOAT3
LC_PROP_EVENT_FLOAT4
LC_PROP_EVENT_FLOAT5
LC_PROP_EVENT_FLOAT6
float
RW
Float value.
The meaning depends on
event type.
LC_PROP_EVENT_STR1
LC_PROP_EVENT_STR2
string
string value.
The meaning depends on
event type.
Code sample:
// LiteCAD event procedure
//----------------------------------------------void CALLBACK EventProc (HANDLE hEvent)
{
int EventType;
LcApplication* pApp = (LcApplication*)lcPropGetHandle( hEvent,
LC_PROP_EVENT_APPPRM2 );
if (pApp){
EventType = lcPropGetInt( hEvent, LC_PROP_EVENT_TYPE );
switch( EventType ){
case LC_EVENT_MOUSEMOVE: pApp->OnMouseMove( hEvent ); break;
case LC_EVENT_KEYDOWN:
pApp->OnKeyDown( hEvent ); break;
...
}
}
}
//----------------------------------------------bool LcApplication::Init (HINSTANCE hInst, LPCWSTR szAppDir)
{
BOOL bInit;
...
lcEventSetProc( LC_EVENT_MOUSEMOVE, EventProc, 0, (HANDLE)this );
lcEventSetProc( LC_EVENT_KEYDOWN, EventProc, 0, (HANDLE)this );
...
bInit = lcInitialize();
...
}
//----------------------------------------------void LcApplication::OnMouseMove (HANDLE hEvent)
{
WCHAR szBuf[256], szNum[16];
double X, Y;
HANDLE hLcWnd = lcPropGetHandle( hEvent, LC_PROP_EVENT_WND );
szNum );
1, szBuf );
szNum );
2, szBuf );
lcStatbarRedraw( m_hStatBar );
}
//----------------------------------------------void LcApplication::OnKeyDown (HANDLE hEvent)
{
UINT VirtKey, Flags;
BOOL bShift, bCtrl;
double X, Y;
HANDLE hLcWnd, hLcDrw, hBlock;
VirtKey = lcPropGetInt( hEvent, LC_PROP_EVENT_INT1 );
Flags
= lcPropGetInt( hEvent, LC_PROP_EVENT_INT2 );
bShift = lcPropGetInt( hEvent, LC_PROP_EVENT_INT3 );
bCtrl
= lcPropGetInt( hEvent, LC_PROP_EVENT_INT4 );
X = lcPropGetFloat( hEvent, LC_PROP_EVENT_FLOAT1 );
Y = lcPropGetFloat( hEvent, LC_PROP_EVENT_FLOAT2 );
hLcWnd = lcPropGetHandle( hEvent, LC_PROP_EVENT_WND );
hLcDrw = lcPropGetHandle( hEvent, LC_PROP_EVENT_DRW );
hBlock = lcPropGetHandle( hEvent, LC_PROP_EVENT_BLOCK );
if (OnKeyDown( VirtKey, Flags )){
lcEventReturnCode( 1 );
}
...
}