One of the requirements for my project includes developing a form where the user can select from a pre-defined selection of furniture configurations, and drag them to the screen. (see attached form picture).
As it stands, when the user clicks one of the labels, and then clicks on the graphics area, I send a request to a function that draws the graphics onto the screen. It basically creates a new graphics path, and runs the required drawing functions depending on the figure.
It works rather well for now (2 days into it). My goal is to be able to either serialize the graphics path or the graphic space so it can be associated with an invoice, and the figure brought back up so the sales manager can see what configuration the sales rep intended and generate the proper purchase order.
The way I look at it is this, I can save the figure in one of two ways:
1) Save it as a picture (which I'm not entirely sure can be serialized), and keep a seperate file on the server which the programs can skim through and check if a picture exists that is associated with that invoice.
2) Somehow serialize the picture or graphics path into the invoice itself (:) would be preferable)...
I know you can define subpaths using markers, and then there's that graphicsIterator class, and then there's (gulp) MetaFiles....
I'm not sure which one would be best. Its not necessary that the salesmanager can edit the picture, I would just have the program clear the screen and the SalesManager could redraw it the way its supposed to be.
Any ideas... thoughts... suggestions....
http://www.sofa.com/df.jpg
So what happens is: the users clicks a button, that event changes a form-level variable to the furniture selected.
ie: myFigure = Figure.SofaRecliner
Once the user clicks on the graphics area, in that click event, I send the figure and its rotation and the graphics area to a function that Select Cases the passed figure and executes the drawing functions on a temp path...
VB Code:
Public Sub DrawFigure(ByVal myFigure As Figure, ByRef g As Graphics, ByVal rotation As Integer, ByVal myPoint As Point) Dim r As New GraphicsPath() Dim mypen As Pen = New Drawing.Pen(Color.Black) 'get the path Select Case myFigure Case Figure.ArmlessSofa DrawArmlessSofa(r) Case Figure.ArmlessLove DrawArmlessLove(r) ' ........
[/Highlight]VB Code:
Private Sub DrawLAFRecLove(ByRef c As GraphicsPath) Dim rect1 As New Rectangle(0, 0, 66, 50) Dim rect2 As New Rectangle(10, 10, 56, 40) Dim rect3 As New Rectangle(10, 45, 56, 5) c.AddRectangle(rect1) c.AddRectangle(rect2) c.AddLine(33, 10, 33, 50) 'recfootrests c.AddRectangle(rect3) End Sub Private Sub DrawRecliner(ByRef c As GraphicsPath) Dim rect1 As New Rectangle(0, 0, 33, 50) Dim rect2 As New Rectangle(0, 45, 33, 5) c.AddRectangle(rect1) c.AddLine(0, 10, 33, 10) c.AddRectangle(rect2)
