AutoCAD 3DMAX C语言 Pro/E UG JAVA编程 PHP编程 Maya动画 Matlab应用 Android
Photoshop Word Excel flash VB编程 VC编程 Coreldraw SolidWorks A Designer Unity3D
 首页 > VB编程

用Visual Basic与MS-Draw开发通用作图软件

51自学网 http://www.wanshiok.com

7、使FORM1始终处于"最上层"(即不被其它窗口覆盖):

Global.bas:

Global Const SWP_MOVE=2
Global Const SWP_NOSIZE=1
Global Const FLAGS=SWP_MOVE Or SWP_NOSIZE
Global Const HWND_TOPMOST=-1
Global Const HWND_NOTOPMOST=-2
Declare Function SetWindowsPos Lib"user"(ByVal h%,ByVal hb%,ByVal X%,
ByVal y%,ByVal cx%,ByVal cy%,By-Val f%)As Integer
Declare Function GetSystemMetrics% Lib"user"(ByVal nIn-dex%)
Global Const
NILL=0&
Global Const WM_SYSCOMMAND=&H112
Global Const WM_LBUTTONDBLCLK=&H203
Global Const SC_CLOSE=&HF06O
Global Const WM-CLOSE=&H10
Global Const WM_GETMINMAXINFO=&H24
Declare Function FindWindows Lib "User"(ByVal lpClassName As Any,
ByVal lpW indowsName As Any)
As Integer

Declare Function sendmessage& Lib "user"(ByVal hWnd%,ByVal wmsg%,
ByVal wpa ram%,ByVal Iparam As Long)

Global Const SW_SHOWMAXIMIZED=3

Declare Function ShowWindows Lib "User"(ByVal hWnd As Integer,
ByVal nCmd S how As Integer)As Integer

8、激活MSDraw,并使其最大化:

Sub Form_Load()
Dim rc%,msdraw_h,Ipclass$,lpcaption$
form1,Width=Pane13D1.Width
rc%=SetWindowPos(form1.hWnd,HWND
_TOPMOST,0,0,0,0,Flags)
rc%=sendmessage(form1,OLE1.hWnd,WM
_LBUTTONDBLCLK,0,NILL)
AppActivate"Microsoft Draw-绘图"
SendKeys"%F",True
SendKeys"{LEFT}X",True
form1.Show
End Sub

9、图形存盘:

Sub Panel3D1_Click()
a$="c:/test.wmf"
AppActivate"Microsoft Draw-绘图"
SendKeys "%FU",True
FORM1.MhOutbox1.MetaFileName=a$
FORM1.MhOutbox1.SaveMetaFile=True
End Sub

10、图形打印:

Sub Panel3D2_Click()
AppActivate"Microsoft Draw-绘图"
SendKeys"%FU",True
MhOutboxl.OutContext=1
MhOutbox.EndPage=True
End Sub
11、退出:
Sub Panel3D3_Click()
Unload form1
End
End Sub

 
 

上一篇:用VB编写一个光驱保镖  下一篇:趣味撞球--VB应用程序一例