1 using Microsoft.Office.Tools.Ribbon;
4 using System.Collections;
5 using System.Collections.Generic;
6 using System.ComponentModel;
7 using System.Diagnostics;
10 using System.Reflection;
12 using System.Threading.Tasks;
16 using System.Windows.Controls;
17 using System.Windows.Forms;
18 using System.Windows.Input;
19 using System.Windows.Media;
20 using System.Windows.Shapes;
46 public System.Drawing.Image
image;
49 public RibbonControlEventHandler
click;
72 ArrayList ret =
new ArrayList();
85 System.Reflection.Assembly myAssembly = System.Reflection.Assembly.GetExecutingAssembly();
86 System.IO.Stream myStream = myAssembly.GetManifestResourceStream(
"ShapeLib.icons.line.png");
87 ui.
image =
new System.Drawing.Bitmap(myStream);
107 public void btn_Click(
object sender, RibbonControlEventArgs e)
188 throw new NotImplementedException();
193 throw new NotImplementedException();
201 throw new NotImplementedException();
215 Line myLine =
new Line();
222 myLine.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
223 myLine.VerticalAlignment = VerticalAlignment.Center;
252 Line myLine =
new Line();
253 myLine.Stroke =
new SolidColorBrush(System.Windows.Media.Color.FromRgb(0, 255, 0));
258 myLine.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
259 myLine.VerticalAlignment = VerticalAlignment.Center;
284 public void MouseDownUpdate(
object sender, System.Windows.Input.MouseButtonEventArgs e)
317 public void MouseUpUpdate(
object sender, System.Windows.Input.MouseButtonEventArgs e)
328 public virtual void MouseDownInsert(
object sender, System.Windows.Input.MouseButtonEventArgs e)
345 public virtual void MouseUpInsert(
object sender, System.Windows.Input.MouseButtonEventArgs e)
358 if (px == ex && py == ey)
362 Debug.WriteLine(
"click");
464 public virtual void MouseMoveInsert(
object sender, System.Windows.Input.MouseEventArgs e)
468 if (e.LeftButton == System.Windows.Input.MouseButtonState.Pressed)
545 protected void remGPath(
double px,
double py,
double ex,
double ey)
589 Debug.WriteLine(px.ToString() +
"," + py.ToString() +
"_______________________" +
shapeLib.
Data.
mClick.ToString());
608 System.Windows.Point temp = p;
609 double tempDX = temp.X % lineSpace;
610 double tempDY = temp.Y % lineSpace;
611 if (temp.X % lineSpace != 0)
613 temp.X = lineSpace * Math.Round((temp.X / lineSpace), 0);
615 if (temp.Y % lineSpace != 0)
617 temp.Y = lineSpace * Math.Round((temp.Y / lineSpace), 0);
622 public virtual void FormKeyDown(
object sender, System.Windows.Input.KeyEventArgs e)
628 if (e.Key == Key.Delete || e.Key == Key.Back)
641 if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
647 else if (e.Key == Key.V)
System.Windows.Point correctPoint(System.Windows.Point p)
virtual void MouseDownInsert(object sender, System.Windows.Input.MouseButtonEventArgs e)
RibbonControlEventHandler click
List< gPath > multiSelList
string belong
判斷按下Button控制項
ShapeObj Create(string svg)
從xml 生成data
System.Windows.Point controlBtn3
void remGPath(double px, double py, double ex, double ey)
儲存新繪製的圖形資料
void MouseDownUpdate(object sender, System.Windows.Input.MouseButtonEventArgs e)
string SVGString()
存檔時存生xml
void MouseUpUpdate(object sender, System.Windows.Input.MouseButtonEventArgs e)
void writeIn(gPath Data, int Action)
維護 undo stack ,把目前狀態存起來.並清空redo stack,如果之前有undo 動作,是回覆到某一狀態,在此之後的動作都可清除
System.Windows.Point controlBtn4
某一類的形狀.包含UI 的界面,繪製方式.更新方式.新增方式
void myLine_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e)
System.Windows.Point controlBtn2
void changeProperty(string prop, string value)
void myLine_MouseLeave(object sender, System.Windows.Input.MouseEventArgs e)
void MouseMoveUpdate(object sender, System.Windows.Input.MouseEventArgs e)
virtual void FormKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
virtual void DrawShape(gView gv, gPath data, Boolean bfirst)
依data 繪製,如果是第一次畫要新建shape, 更新的話只要更新最後一點
virtual void MouseMoveInsert(object sender, System.Windows.Input.MouseEventArgs e)
void redraw(int removetype)
virtual void DisplayControlPoints(gView gv, gPath data)
static IList< ShapeObj > SupportedShape(getForm myview)
define supported shape
System.Windows.Point controlBtn1
void myLine_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
void btn_Click(object sender, RibbonControlEventArgs e)
UI 點選
System.Windows.Controls.UserControl Root
System.Drawing.Image image
virtual System.Collections.ArrayList getMenuItem()
覆寫System.Collections.ArrayList
List< Shape > controlShape
virtual void MouseUpInsert(object sender, System.Windows.Input.MouseButtonEventArgs e)