(Defun objectdcl_loadarx () (IF (NOT (MEMBER "objectdcl.arx" (ARX))) (ARXLOAD "objectdcl.arx" "ObjectDCL.arx not found.") ) ) ; this is a test fuction for the GetFontName method below (defun c:GetFont () (alert (GetFontName "Standard")) ) ; this method is used to get the font name of any text style passed in. ; no checking has been added to ensure the text style is valid. (defun GetFontName (fontStyleName / typeFace Bold Italic charSet PitchandFamily) (setq vlaobj (vlax-ename->vla-object (tblobjname "style" fontStyleName))) (vla-GetFont vlaobj 'typeFace 'Bold 'Italic 'charSet 'PitchandFamily) ; if the type face is blank, a .shx font file is set, so we will get the font file name instead. (if (or (= typeFace "") (= typeFace nil)) (setq typeFace (vlax-get-property vlaobj "fontfile" ) ) ) ; return the font name typeFace typeFace ) (Defun c:font (/ nUnderline nStrikeout nFontSize sFontName nFontStyle) (defun c:FontDlg_OK_Clicked () (Odcl_Form_Close FontExample_FontDlg) ) (defun c:FontDlg_Cancel_Clicked () (Odcl_Form_Close FontExample_FontDlg) ) (defun c:FontDlg_Underline_Clicked (nValue /) (setq nUnderline nValue) (FontDlg_UpdateFontExample) ) (defun c:FontDlg_Strikeout_Clicked (nValue /) (setq nStrikeout nValue) (FontDlg_UpdateFontExample) ) (defun c:FontDlg_FontSize_SelectionChanged (nSelection sSelText /) (setq nFontSize (atoi sSelText)) (FontDlg_UpdateFontExample) ) (defun c:FontDlg_FontStyle_SelectionChanged (nSelection sSelText /) (setq nFontStyle nSelection) (FontDlg_UpdateFontExample) ) (defun c:FontDlg_FontName_SelectionChanged (nSelection sSelText /) (setq sFontName sSelText) (FontDlg_UpdateFontExample) ) (defun FontDlg_UpdateFontExample () (Odcl_Control_SetProperty FontExample_FontDlg_SampleFont "Font" sFontName ) (Odcl_Control_SetProperty FontExample_FontDlg_SampleFont "FontSize" nFontSize ) (Odcl_Control_SetProperty FontExample_FontDlg_SampleFont "FontUnderline" nUnderline ) (Odcl_Control_SetProperty FontExample_FontDlg_SampleFont "FontStrikeOut" nStrikeout ) (if (= nFontStyle 0) (progn (Odcl_Control_SetProperty FontExample_FontDlg_SampleFont "FontItalic" 0 ) (Odcl_Control_SetProperty FontExample_FontDlg_SampleFont "FontBold" 0 ) ) ) (if (= nFontStyle 1) (progn (Odcl_Control_SetProperty FontExample_FontDlg_SampleFont "FontItalic" 0 ) (Odcl_Control_SetProperty FontExample_FontDlg_SampleFont "FontBold" T ) ) ) (if (= nFontStyle 2) (progn (Odcl_Control_SetProperty FontExample_FontDlg_SampleFont "FontItalic" T ) (Odcl_Control_SetProperty FontExample_FontDlg_SampleFont "FontBold" 0 ) ) ) (if (= nFontStyle 3) (progn (Odcl_Control_SetProperty FontExample_FontDlg_SampleFont "FontItalic" T ) (Odcl_Control_SetProperty FontExample_FontDlg_SampleFont "FontBold" T ) ) ) ) ; call the method to ensure the ObjectDCL.arx file is loaded (objectdcl_loadarx) ; call the method to load the project. (Odcl_LoadProject "FontExample" T) ; show the form here, and make any calls required to initialize/reinitialize the dialog box controls before Odcl_Form_Show (Odcl_Form_Show FontExample_FontDlg) ) ;|«Visual LISP© Format Options» (94 2 4 2 nil "end of " 72 6 0 0 1 T T nil T) ;*** DO NOT add text below the comment! ***|;