原文如下:
By default the modeless dialog cannot keep focus in Autocad VBA. In order to
achieve that you will have register an additionall control and make
reference to it under Tools > References....But let’s go step by step:
1. First you’ll have to register a AcFocusCtrl.dll under Windows. You can do
that by going to the Start menu and selecting Run. In the window that pops
up write the following line (this is how the path looks on my computer, on
yours could be a bit different)
regsvr32 "C:\Program Files\Common Files\Autodesk
Shared\AcFocusCtrl.dll"
2. After that, go to the Acad VBA go to the Tools > References... and check
the box for the AcFocusCtrl 1.0 Type Library.
3. Now you can use your new control by putting it on your modeless dialog
form. Don’t wory where will you put it, it doesn’t show up once you run your
program.
4. Add a following Sub in the code window for your modeless dialog.
Private Sub UserForm_Initialize()
Me.AcFocusCtrl1.KeepFocus = True
End Sub
5. Thats it . . .
6. . . . if you are using Acad 2002 which comes with VB6, but if you are
using Acad 2000i which comes with VB5 ( I think) you don’t have the before
mentioned dll on you computer. Now here we are walking in a bit grayish
area, but the easiest way is to find a nearest computer with an Acad 2002,
grab the AcFocusCtrl.dll file, put it under C:\Program Files\Common
Files\Autodesk Shared and follow the instructions under 1.,2.,3....
全部回复(2 )
只看楼主 我来说两句抢地板回复 举报
晕
回复 举报