您好,欢迎访问三七文档
当前位置:首页 > 行业资料 > 国内外标准规范 > 基于VB的绘图工具的绘图技术
26()Vol.2No.6200112JOURNALOFBEIHUAUNIVERSITY(NaturalScience)Dec.,2001:100924822(2001)0620549204VB1,2,3(1.,132013;2.,132012;3.,132013):VB,WindowsAPIVB,.:VB;WindowsAPI;:TP302.4:A:2001208220::(1973-),,,;(1954-),,,,.,,AutoCAD,,.,.VBWindowsAPIVB,.1WindowsAPIWindowsAPIWindows,(DLL),.Windows,WindowsAPIGDI();;.WindowsAPI,.APIAPIAPI.1.1APIWindowsAPI,.VBCreatePen()API,CreateHatchBrush(),CreateSolidBrush();SelectObject()DeleteObject(),.1.2APIWindowsAPIVB.Rectangle()RoundRect()Arc()Chord().VBAPIAPI,.1.3,.API,.,,.APIPtInRegion();CreateRectRgn();CreatePolygonRgn().1.4APIAPI,.,,.:1)CreateRectRgn(),24.2)MouseDown,.3)MouseMove,.,.,,,.2VBVB.2.1VB.X,Y.VB8,.twip().ScaleMode,ScaleLeftScaleTop,Scale.2.2VB,Print,Line,Circle,DrawStyle,DrawWidth,FillColor,FillStyle.2.3,DrawMode.VB16,vbXorPen().,,,.2.4.vbXorPen,.1)MouseDown,,DrawModevbXorPen;MouseMove,;MouseUpvbCopyPen().2)MouseDown;MouseMoveAutoRedrawFalse,Refresh;MouseUpvbCopyPen().31)EXEDraw.vbp,:Form1:dispict;TempPict1TempPict2,VisibleFalse,AutoRedrawTrue.3APIBrush.cls,RegnAPI.cls,DrawAPIObj.cls.APIBrush.BrushType()DrawDc()hBrush()BColor();BCreate()BSelect()BSelectOrg(055()2);RegnAPI.RegnObj()hRegn()DrawDC();DelRegn()MakeRegn()RgnFill()MakeRegnClip()ChechIn();DrawAPIObj.APIObj()DrawDC();DrawObj().2):DimAOAsDrawAPIObjDimRGN1AsRegnAPIDimRGN2AsRegnAPIPrivateSubdispict-MouseDown(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle)DimRet1,Ret2AsLongRet1=RGN1.CheckIn(X,Y)findoutiftheclickinthecontrolhandleregionIfRet10ThenRGN1.RGNFillRGB(0,255,255)changetheregioncolorControl1=ONsettheflagtoindicatethatthecontrolisinusedispict-MouseMove0,0,Handle1X+(CWidth/2),Handle1Y+(CWidth/2)EndIfRet2=RGN2.CheckIn(X,Y)...EndSubPrivateSubdispict-MouseMove(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle)DimthrowAsLongIfControl1=ONOrControl2=ONThen...throw=BitBlt(temPict1.hdc,0,0,dispict.ScaleWidth,dispict.ScaleHeight,temPict2.hdc,0,0,SRCCOPY)IfControl1=ONThendrawthenewrectangleAO.DrawObjX,Y,Handle2X+(CWidth/2),Handle2Y+(CWidth/2)updatethehandlelocation...RGN1.DeleteRgndeletethecurrentregionmaketheregionforthehandleRGN1.MakeRGNHandle1X,Handle1Y,Handle1X+CWidth,Handle1Y+CWidthRGN1.RGNFillRGB(0,255,255)fillbothregionRGN2.RGNFillRGB(0,0,0)EndIf...copytheupdatetothedisplaythrow=BitBlt(dispict.hdc,0,0,dispict.ScaleWidth,dispict.ScaleHeight,temPict1.hdc,0,0,SRCCOPY)EndIfEndSubPrivateSubdispict-MouseUp(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle)DimthrowAsLongRGN1.RGNFillRGB(0,0,0)fillthehandleswithblack1556,:VBRGN2.RGNFillRGB(0,0,0)throw=BitBlt(dispict.hdc,0,0,dispict.ScaleWidth,dispict.ScaleHeight,temPict1.hdc,0,0,SRCCOPY)Control1=OFFturnoffbothcontrolsControl2=OFFEndSub3VBWindows(GUI),.VB,VBWindowsAPI.,APIVB.,.:[1]SteveBrown.VisualBasicWin32API[M].,,,.:,2000.183210.SteveBrown.VisualBasicDevelopingGuide[M].TranslatedbyLiFenghua,ChenLizhi,LiDongdong.Beijing:PublishingHouseofElectronicsIndustry,2000.183210.[2]DeborahKurata.VisualBasic6.0[M]..:,1999.185216.DeborahKurata.VisualBasic6.0Object2orientedProgramDesign[M].TranslatedbyXiaoxiangWorkroom.Beijing:ThePeoplesPostPublishingHouse,1999.185216.[3]StevenHolzner.VisualBasic6[M]..:,1999.380420.StevenHolzner.VisualBasic6BlackBook[M].TranslatedbyTranslatingGroupofXiangshi.Beijing:ChinaMachinePress,1999.380420.TheDrawingTechnologyBasedontheDrawingToolofVBWangQiuping1,LuDa2,WangXianli3(1.TheComputeCentreofBeihuaUniversity,Jilin132013,China;2.ElectricDepartmentofNortheastElectricPowerCollege,Jilin132012,China;3.TrafficConstructionEngineeringCollegeofBeihuaUniversity,Jilin132013,China)Abstract:ThedrawingtechnologywasrealizedthroughcallingwindowsAPI(ApplicationProgrammingInterface)functionanddrawingmethodbasedonVB.Thetechnologyproblemsinthecourseofdevelopingdrawingtoolwereintroduced.Keywords:VB;WindowsAPI;Drawing255()2
本文标题:基于VB的绘图工具的绘图技术
链接地址:https://www.777doc.com/doc-9086403 .html