1 using Microsoft.Office.Tools.Ribbon;
3 using System.Collections;
4 using System.Collections.Generic;
5 using System.Diagnostics;
8 using System.Threading.Tasks;
10 using System.Windows.Controls;
11 using System.Windows.Forms;
12 using System.Windows.Input;
13 using System.Windows.Media;
14 using System.Windows.Shapes;
24 ArrayList ret =
new ArrayList();
32 System.Reflection.Assembly myAssembly = System.Reflection.Assembly.GetExecutingAssembly();
33 System.IO.Stream myStream = myAssembly.GetManifestResourceStream(
"ShapeLib.icons.pencil.png");
34 pui.
image =
new System.Drawing.Bitmap(myStream);
48 double ret = (1 - u) * (1 - u) * (1 - u) / 6.0;
54 double ret = (3 * u * u * u - 6 * u * u + 4.0) / 6.0;
59 double ret = (-3 * u * u * u + 3 * u * u + 3 * u + 1.0) / 6.0;
64 double ret = u * u * u / 6.0;
90 p.Stroke =
new SolidColorBrush(System.Windows.Media.Color.FromRgb(
r,
g,
b));
97 Debug.WriteLine(
"draw pencil");
119 int m = data.
pList.Count;
120 Point[] plist =
new Point[m + 3];
121 data.
pList.CopyTo(plist, 1);
122 plist[0] = plist[1] ;
128 PathFigure myPathFigure =
new PathFigure();
131 PathSegmentCollection myPathSegmentCollection =
new PathSegmentCollection();
133 myPathFigure.Segments = myPathSegmentCollection;
135 PathFigureCollection myPathFigureCollection =
new PathFigureCollection();
136 myPathFigureCollection.Add(myPathFigure);
138 PathGeometry myPathGeometry =
new PathGeometry();
139 myPathGeometry.Figures = myPathFigureCollection;
141 ret.Data = myPathGeometry;
144 for (
int i = 0; i < m - 3; i++)
146 Point p = (Point)plist[i];
147 Point p1 = (Point)plist[i + 1];
148 Point p2 = (Point)plist[i + 2];
149 Point p3 = (Point)plist[i + 3];
160 for (
int j = 0; j < MAX_STEPS +
extra; j++)
163 double u = j * 1.0 / MAX_STEPS;
164 double Qx =
B0(u) * p.X +
169 double Qy =
B0(u) * p.Y +
177 myPathFigure.StartPoint =
new System.Windows.Point((
int)Qx, (
int)Qy);
183 LineSegment lineseg =
new LineSegment();
184 lineseg.Point =
new System.Windows.Point((
int)Qx, (
int)Qy);
185 myPathSegmentCollection.Add(lineseg);
199 public override void MouseDownInsert(
object sender, System.Windows.Input.MouseButtonEventArgs e)
201 if (e.ChangedButton == MouseButton.Right)
228 public override void MouseUpInsert(
object sender, System.Windows.Input.MouseButtonEventArgs e)
248 Debug.WriteLine(
"click");
289 public override void MouseMoveInsert(
object sender, System.Windows.Input.MouseEventArgs e)
RibbonControlEventHandler click
List< gPath > multiSelList
string belong
判斷按下Button控制項
void remGPath(double px, double py, double ex, double ey)
儲存新繪製的圖形資料
void writeIn(gPath Data, int Action)
維護 undo stack ,把目前狀態存起來.並清空redo stack,如果之前有undo 動作,是回覆到某一狀態,在此之後的動作都可清除
System.Windows.Point controlBtn4
某一類的形狀.包含UI 的界面,繪製方式.更新方式.新增方式
override void MouseMoveInsert(object sender, System.Windows.Input.MouseEventArgs e)
void redraw(int removetype)
static IList< ShapeObj > SupportedShape(getForm myview)
define supported shape
override System.Collections.ArrayList getMenuItem()
覆寫System.Collections.ArrayList
void btn_Click(object sender, RibbonControlEventArgs e)
UI 點選
override void MouseUpInsert(object sender, System.Windows.Input.MouseButtonEventArgs e)
System.Drawing.Image image
override void MouseDownInsert(object sender, System.Windows.Input.MouseButtonEventArgs e)
override void DrawShape(gView gv, gPath data, Boolean bfirst)
依data 繪製,如果是第一次畫要新建shape, 更新的話只要更新最後一點
Path buildShape(gPath data, Path old=null)