Call the This function after operation.
public void NewState (Graphicslist graphicslist)
{
Keep objects state after operation.
Listafter = new list<drawobject> ();
Afterzoomrate = new list<pointf> ();
Drawobject Newo = null;
BOOL Bvalid = false;
foreach (drawobject o in graphicslist.graphicslist)
{
if (!bvalid)
{
afterzoomrate.x = o.objectzoomrate.x;
Afterzoomrate.y = O.objectzoomrate.y;
Afterzoomrate.add (New PointF (o.objectzoomrate.x, o.objectzoomrate.y));
Bvalid = true;
}
if (O.objecttype = = (int) DrawArea.DrawToolType.Line)
{
Listafter.add (O.clone ());
}
else if (O.objecttype = = (int) DrawArea.DrawToolType.PolyLine)
{
Newo = new DrawPolyline (((DrawPolyline) O). Pointarray[0]. X, ((DrawPolyline) O). Pointarray[0]. Y);
int num = 0;
foreach (PointF point in ((DrawPolyline) O). Pointarray.toarray ())
{
if (num >= 1)
{
((DrawPolyline) Newo). Addpoint (point);
}
num++;
}
Newo.id = o.id;
Newo.objecttype = O.objecttype;
The recording of the record, the reduction of the place ¤ Drag a Á?ì
Newo.objectzoomrate = o.objectzoomrate;
Newo.objectdragoffset = O.objectdragoffset;
When Ì?à more ¨¤, the o?à,list<t> refers to the ¨2 in ¨°. When the Ì?à ¨2 in the store?? Hair ¤?é |¨2 change à? ¥ then ¨° and ¨2 with the Change à? ¥ guide ì? No T method ¤?§ withdrawal? ¤ Pin ¨2 recovery? On |? One °, a á?? State??
Listafter.add (Newo);
}
}
}
public override void Undo (Graphicslist list)
{
List. Clear ();
foreach (drawobject o in Listbefore)
{
List. ADD (O.clone ());//O/o.clone ()
}
Undoobjects (list);
List. Updatezoomrate (beforezoomrate[0],true);
}
public override void Redo (Graphicslist list)
{
List. Clear ();
foreach (drawobject o in Listafter)
{
List. ADD (O.clone ());//o.clone () o
}
Redoobjects (list);
List. Updatezoomrate (Afterzoomrate[0],false);
}
Replace objects in graphicslist with objects from list
private void Undoobjects (Graphicslist graphicslist)
{
for (int i = 0; i < Graphicslist.count; i++)
{
drawobject replacement = null;
foreach (drawobject o in Listbefore)
{
if (o.id = = graphicslist[i].id)
{
replacement = O;
À¨¨ Example ¤y
Graphicslist.replace (i, replacement);
}
/* Else
{
O.resize (Beforezoomrate, o.objectzoomrate.x);
}*/
}
}
}
Replace objects in graphicslist with objects from list
private void Redoobjects (Graphicslist graphicslist)
{
for (int i = 0; i < Graphicslist.count; i++)
{
drawobject replacement = null;
foreach (drawobject o in Listafter)
{
if (o.id = = graphicslist[i].id)
{
replacement = O;
À¨¨ Example ¤y
Graphicslist.replace (i, replacement);
}
/* Else
{
O.resize (Afterzoomrate, o.objectzoomrate.x);
}*/
}
}
}
}
}
=============================================================================================================== =============================================================================================================== ========================
Using System;
Using System.Collections.Generic;
Using System.ComponentModel;
Using System.Data;
Using System.Drawing;
Using System.Linq;
Using System.Text;
Using System.Windows.Forms;
Namespace CSharp
{
public partial class Adminform:form
{
MainForm parentform = new MainForm ();
Public Adminform (mainform parent)
{
InitializeComponent ();
ParentForm = parent;
}
public float Getmergedis ()
{
return (float) (convert.todouble (Mergedistextbox.text));
}
public float Getsplitdis ()
{
return (float) ((convert.todouble (Splitdistextbox.text)) *parentform.drawarea.pxwidth);
}
}
}
==================================================================================
When all sorts of languages are focused on one person, the brain is a little messed up 1