public static Point[] getArrowHead(PointF _st, PointF _ed, int size_circle) { Point st = Point.Round(_st); Point ed = Point.Round(_ed); scaleLine(ref st, ref ed, size_circle); Point Vst_ed = ed - (Size)st; // 向量 int LengthV = Distance(new Point(0, 0), Vst_ed); scale(ref Vst_ed, 5, 8); if (LengthV * 5 > size_circle * 16) { scale(ref Vst_ed, size_circle * 16, LengthV * 5); } var nst = ed - (Size)Vst_ed; // new start Point mid = ed - (Size)nst; scale(ref mid, 5, 8); mid = ed - (Size)mid; scale(ref Vst_ed, 5, 8); var perp = new Point(Vst_ed.Y, -Vst_ed.X); scale(ref perp, 3, 8); int LengthPerp = Geom.Distance(new Point(0, 0), perp); LengthPerp = LengthPerp * 8 / 5; if (LengthPerp * 8 < size_circle * 5 && LengthPerp * 5 > size_circle * 8) { Geom.scale(ref perp, size_circle, LengthPerp); } var top = mid + (Size)perp; var button = mid - (Size)perp; return(new Point[] { nst, top, ed, button }); }
private void drawSkill(PointF _center, Skill curr_skill, DrawStyle curr_style) { Point center = Point.Round(_center); int r = size_circle; int stx = center.X - r, sty = center.Y - r; int d = r * 2; Rectangle rect = new Rectangle(stx, sty, d, d); if (curr_style.SkillEdge.IsEmpty == false) { Pen edgePen; edgePen = new Pen(curr_style.SkillEdge); edgePen.Width = lineW; buffer.DrawEllipse(edgePen, rect); } if (curr_style.SkillFill.IsEmpty == false) { Brush fillBush = new SolidBrush(curr_style.SkillFill); buffer.FillEllipse(fillBush, rect); } Brush fontbush; fontbush = new SolidBrush(curr_style.Font); Point fontSize = (Point)getNameSize(curr_skill.name); Point DrawStringPoint = center; Geom.scale(ref fontSize, 1, 2); DrawStringPoint -= (Size)fontSize; buffer.DrawString(curr_skill.name, font_name, fontbush, DrawStringPoint); }
public static void scaleLine(ref Point st, ref Point ed, int size_circle) { Point vR = ed - (Size)st; // 从圆心到圆周的向量 int length = Geom.Distance(st, ed); Geom.scale(ref vR, size_circle, length); st += (Size)vR; ed -= (Size)vR; }
private void reName(int selectedId) { reNameBox.Font = font_name; string oldName = skillList[selectedId].name; Point sizeOfName = (Point)getNameSize(oldName); reNameBox.Size = (Size)sizeOfName; Geom.scale(ref sizeOfName, 1, 2); reNameBox.Location = Point.Round(circleCenter[selectedId]) - (Size)sizeOfName; reNameBox.Text = oldName; reNameBox.Show(); reNameBox.Focus(); reNameBox.SelectAll(); selectedId_renameBox = selectedId; }
private void scaleAllCenter(Point Anchor, Point before, Point after) { Point anc = Anchor; int zo = Geom.Length(before - (Size)Anchor); int zi = Geom.Length(after - (Size)Anchor); scaleOther(zi, zo); for (int i = 0; i < circleCenter.Count; i++) { circleCenter[i] = Geom.scale(circleCenter[i], zi, zo); } anc = Geom.scale(anc, zi, zo); anc -= (Size)Anchor; panAllCircle(anc); }