From: BTIS Jeff on 21 May 2010 16:50 Andy, If you are open to use of a commercial ActiveX component to replace the VB Picturebox, our MetaDraw 3 will allow you to very quickly complete your task. You can try this out quickly, I've included some sample code below to help you get started, and you can download the installation kit for evaluation from : http://www.bennet-tec.com/btproducts/metadraw/installkit/md3_inst.zip Here's a link to basic info on MetaDraw http://www.btis.com/btProducts/MetaDraw/MetaDraw.htm In MetaDraw you can draw shapes either by code or by allowing the user to draw directly with the mouse ( but still fully under your control. ) For more complex objects made up of multiple shapes, you can group shapes to form complex elements or you can simply images you have already drawn with your standard Pictureboxes as well. With one line of code you can then allow users to drag the objects around. Likewise with one line of code you can allow users to rotate the shapes. And of course if you need to Zoom, Scroll, Print, Save and Reload, . . . Or even assign hidden data to each shape, . . It's all in there This is all very easy - Here is some sample code Draw a line by code MetaDraw.AddObject OT_Line, X1, Y1, X2, Y2 Draw a circle by code ( using coordinates of bounding rectangle) MetaDraw.AddObject OT_Ellipse, X1, Y1, X2, Y2 Set the Line Color for just added shape MetaDraw.LineColor = Some RGB color Set the Fill Color for just added shape MetaDraw.FillColor = Some RGB color Import an image from an existing picturebox MetaDraw.PictureClip = Picture1.Image or alternatively MetaDraw.PictureImage = Picture1.Image MetaDraw.AddObject OT_Image, X1, Y1, X2, Y2 Allow user to draw a circle with mouse MetaDraw.EditMode = ED_ELLIPSE Allow user to draw a line with mouse MetaDraw.EditMode = ED_LINE Allow user to drag existing elements MetaDraw.EditMode = ED_SELECT Allow user to Rotate existing elements MetaDraw.EditMode = ED_ROTATE Get Current Coordinates of Some shape ' can be checked at any time, but may be best in ' Change event when user has just moved the shape MetaDraw.GetBounds left, top,right, bottom, 0 Get the rotation angle of some shape ' can be checked at any time, but may be best in ' Change event when user has just rotated the shape Angle = MetaDraw.ObjRotation Print the Result to user's choice of printer MetaDraw.ExportDC = -2 Save the current state and then reload to continue editing MetaDraw.SavePicture "somefile.mdp", Pic_Picture, Pictype_Internal MetaDraw.LoadPicture "somefile.mdp", Pic_Picture, Pictype_Internal Save the current state in a standard graphic format MetaDraw.SavePicture "somefile.jpg", Pic_Picture, Pictype_PNGFile ' other supported standard formats include ' BMP, JPG, PNG, GIF, WMF, EMF The coordinate system used above is the default 0 - 1000 coordinate space when first creating MetaDraw. You can also adjust the initial size and coordinate space with PicWidth, PicHeight, OrigWidth, OrigHeight and ZoomFactor properties. I hope this is helpful to you. * * Please include a copy of this message with any reply on this topic - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - If you have additional technical questions on other topics please post these questions separately using the support page of our web site. www.Bennet-Tec.com => Click on Support => Click on "Submit Support Question - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ----- Jeff Bennett, Jeff A/T Bennet-Tec D/O/T Com * Bennet-Tec Information Systems, Inc * 50 Jericho Tpk, Jericho, NY 11753 * WWW.Bennet-Tec.Com RELIABLE Component Software and Custom Software Development Services * Expert Systems * Text Processing * Databases * Interactive Web Sites * Diagramming, Drawing, Hotspot Graphics * Data Input & Data Presentation Systems * Decision Support * Web Based Data Collection * Forecasting * Signature Capture * Desktop Windows, Tablets, Pocket PCs TList / ALLText / MetaDraw / Web Signature ======================== ========================
First
|
Prev
|
Pages: 1 2 Prev: Error 6 line of code? Next: Is it possible to read directly bytes from within my application? |