winform 承载CAD窗口
哪位高手知道,在winform里有什么控件可以加载CAD的窗口,AxAcCtrl这个COM组件,不知道加载自己绘图的命令,比如说,我自己写的一个绘图方法(加了Command属性)的方法,如何窗口中显示我绘图的图,哪位高手指导一下,最好能提供一下源代码,谢谢!!!this.axAcCtrl1.PutSourcePath(filename);试一下吧,不知道行不行。 xiaozhuyaofei 发表于 2012-6-2 18:48 static/image/common/back.gif
this.axAcCtrl1.PutSourcePath(filename);试一下吧,不知道行不行。
不行啊,根本就没有PutSourcePath这个方法,不过谢谢你。 本帖最后由 aroom 于 2012-6-5 02:36 编辑
;;;1、导入库
(importAll "kernel32.dll")
(importAll "user32.dll")
(importAll "gdi32")
;;; 2、定义常量
(setq WS_OVERLAPPEDWINDOW 13565952)
(setq IDI_APPLICATION 32512)
(setq IDC_ARROW 32512)
(setq WHITE_BRUSH 0)
(setq WM_CREATE 1)
(setq WM_DESTROY 2)
(setq WM_MOVE 3)
(setq WM_SIZE 5)
(setq WM_PAINT 15)
(setq WM_CLOSE 16)
(setq WM_NOTIFY 78)
(setq WM_COMMAND 273)
(setq OFN_HIDEREADONLY 4)
(setq OFN_PATHMUSTEXIST 2048)
(setq OFN_FILEMUSTEXIST 4096)
;;; 3、定义结构
(structDef WNDCLASSEXA cbSize style lpfnWndProc cbClsExtra cbWndExtra hInstance hIcon
hCursor hbrBackground lpszMenuName lpszClassName hIconSm)
(structDef MSG hwnd message wParam lParam time pt_x pt_y)
(structDef OPENFILENAME lStructSize hwndOwner hInstance lpstrFilter lpstrCustomFilter
nMaxCustFilter nFilterIndex lpstrFile nMaxFile lpstrFileTitle nMaxFileTitle lpstrInitialDir
lpstrTitle Flags
(nFileOffset "d")
(nFileExtension "d") lpstrDefExt lCustData lpfnHook lpTemplateName)
;;; 4、定义回调函数
(defun myWndProc (hwnd message wParam lParam)
(println message)
(cond
((== message WM_CREATE)
(setq acad (GetOrCreateObject "autocad.Application"))
(setq acad.Visible 1)
(SetParent acad.HWND hwnd) ;;; AutoCAD嵌入到Windows 窗体
)
((== message WM_CLOSE)
(acad.quit)
(ReleaseObject acad)
(MessageBoxA hwnd "单击了关闭按钮,退出程序." "TeaScript提示" 0)
(DefWindowProcA hwnd message wParam lParam))
((== message WM_DESTROY) (PostQuitMessage 0))
(true (DefWindowProcA hwnd message wParam lParam))))
;;; 5、定义主函数
(defun MyWindow ()
(var ClassName nil Caption nil uMsg nil wndclass nil)
(setq hInstance (GetModuleHandleA 0))
(setq ClassName "mywindow")
(setq Caption "TeaScript编写的一个窗口")
(setq wndclass (new Struct WNDCLASSEXA))
(setq wndclass.cbSize (sizeof WNDCLASSEXA))
(setq wndclass.lpfnWndProc (callback 0 myWndProc))
(setq wndclass.hInstance hInstance)
(setq wndclass.hIcon (LoadIconA 0 IDI_APPLICATION))
(setq wndclass.hCursor (LoadCursorA 0 IDC_ARROW))
(setq wndclass.lpszClassName &ClassName)
(RegisterClassExA &wndclass)
(setq myhwnd (CreateWindowExA 0 ClassName Caption WS_OVERLAPPEDWINDOW 200 200 400
300 0 0 hInstance 0))
(ShowWindow myhwnd 1)
(UpdateWindow myhwnd)
(setq uMsg (new Struct MSG))
(while (> (GetMessageA &uMsg 0 0 0) 0)
(TranslateMessage &uMsg)
(DispatchMessageA &uMsg)))
;;; 6、开始运行
(MyWindow)
aroom 发表于 2012-6-5 02:26 static/image/common/back.gif
;;;1、导入库
(importAll "kernel32.dll")
(importAll "user32.dll")
谢谢你的回答,我想再问一个问题,如何把导入的CAD窗口中的命令窗口和上面的菜单栏全部隐藏掉,只剩下中间的工作区域,这个问题怎么解决,谢谢!
页:
[1]