반응형
통통한 화살표 그리기
화살표 몸통 조절은 현재 8분의 2 굵기
8분의 4 굵기로 할거면 0.375 -> 0.25, 0.625 -> 0.75
버그있음
resize 시 잘못 표시되는 경우 발생
- 삼각형 헤드 크기를 조절하는 로직에서 발생하는걸로 생각됨
- 조절로직: [머리 폭의 절반만큼을 머리 길이로 사용하면서, 머리 폭의 절반이 화살표 길이의 절반보다 큰 경우 화살표 길이의 절반으로 머리 길이를 정한다]
resize 시 화살표 방향 전환
- onResize override해서 마우스 놓는 위치에 따라 방향 다시 설정하도록?
private void DrawArrowLeft(Graphics g) { float mid_Y = (this._boundingBox[0].Y + this._boundingBox[3].Y) / 2; float headLine_X; float body_Y_Left = this._boundingBox[0].Y * 0.375f + this._boundingBox[3].Y * 0.625f; float body_Y_Right = this._boundingBox[0].Y * 0.625f + this._boundingBox[3].Y * 0.375f; if (this.Size.Width > this.Size.Height) { headLine_X = this._boundingBox[0].X + this.Size.Height/2f; } else { headLine_X = (this._boundingBox[0].X + this._boundingBox[1].X) / 2; } PointF[] vertexs = { new PointF(this._boundingBox[0].X, mid_Y) , new PointF(headLine_X , this._boundingBox[0].Y ) , new PointF(headLine_X , body_Y_Right) , new PointF(this._boundingBox[1].X, body_Y_Right) , new PointF(this._boundingBox[2].X, body_Y_Left) , new PointF(headLine_X , body_Y_Left) , new PointF(headLine_X , this._boundingBox[3].Y ) }; if (this.SymbolItem.BackColor != Color.Empty) { g.FillPolygon(new SolidBrush(this.SymbolItem.BackColor), vertexs); } g.DrawPolygon(new Pen(this.SymbolItem.ForeColor, this.Attribute.LineThick), vertexs); } private void DrawArrowRight(Graphics g) { float right_mid = (this._boundingBox[1].Y + this._boundingBox[2].Y) / 2; float headLine_X; float body_Y_Left = this._boundingBox[0].Y * 0.625f + this._boundingBox[3].Y * 0.375f; float body_Y_Right = this._boundingBox[0].Y * 0.375f + this._boundingBox[3].Y * 0.625f; if(this.Size.Width > this.Size.Height ){ headLine_X = this._boundingBox[1].X - this.Size.Height/2f; } else{ headLine_X = (this._boundingBox[1].X + this._boundingBox[0].X) / 2; } PointF[] vertexs = { new PointF(this._boundingBox[0].X, body_Y_Left) , new PointF(headLine_X, body_Y_Left) , new PointF(headLine_X, this._boundingBox[1].Y) , new PointF(this._boundingBox[1].X, right_mid) , new PointF(headLine_X, this._boundingBox[2].Y) , new PointF(headLine_X, body_Y_Right) , new PointF(this._boundingBox[3].X, body_Y_Right)}; if (this.SymbolItem.BackColor != Color.Empty) { g.FillPolygon(new SolidBrush(this.SymbolItem.BackColor), vertexs); } g.DrawPolygon(new Pen(this.SymbolItem.ForeColor, this.Attribute.LineThick), vertexs); } private void DrawArrowUp(Graphics g) { float top_mid = (this._boundingBox[0].X + this._boundingBox[1].X) / 2; float headLine_Y; float body_X_Left = this._boundingBox[0].X * 0.625f + this._boundingBox[1].X * 0.375f; float body_X_Right = this._boundingBox[0].X * 0.375f + this._boundingBox[1].X * 0.625f; if (this.Size.Width < this.Size.Height) { headLine_Y = this._boundingBox[1].Y + this.Size.Width / 2f; } else { headLine_Y = (this._boundingBox[0].Y + this._boundingBox[3].Y) / 2; } PointF[] vertexs = { new PointF(top_mid, this._boundingBox[0].Y) , new PointF(this._boundingBox[1].X, headLine_Y) , new PointF(body_X_Right, headLine_Y) , new PointF(body_X_Right, this._boundingBox[2].Y) , new PointF(body_X_Left, this._boundingBox[3].Y) , new PointF(body_X_Left, headLine_Y) , new PointF(this._boundingBox[3].X, headLine_Y)}; if (this.SymbolItem.BackColor != Color.Empty) { g.FillPolygon(new SolidBrush(this.SymbolItem.BackColor), vertexs); } g.DrawPolygon(new Pen(this.SymbolItem.ForeColor, this.Attribute.LineThick), vertexs); } private void DrawArrowDown(Graphics g) { float bottom_mid = (this._boundingBox[0].X + this._boundingBox[1].X) / 2; float headLine_Y; float body_X_Left = this._boundingBox[0].X * 0.375f + this._boundingBox[1].X * 0.625f; float body_X_Right = this._boundingBox[0].X * 0.625f + this._boundingBox[1].X * 0.375f; if (this.Size.Width < this.Size.Height) { headLine_Y = this._boundingBox[3].Y - this.Size.Width / 2f; } else { headLine_Y = (this._boundingBox[0].Y + this._boundingBox[3].Y) / 2; } PointF[] vertexs = { new PointF(bottom_mid, this._boundingBox[3].Y) , new PointF(this._boundingBox[0].X, headLine_Y) , new PointF(body_X_Right, headLine_Y) , new PointF(body_X_Right, this._boundingBox[0].Y) , new PointF(body_X_Left, this._boundingBox[0].Y) , new PointF(body_X_Left, headLine_Y) , new PointF(this._boundingBox[1].X, headLine_Y)}; if (this.SymbolItem.BackColor != Color.Empty) { g.FillPolygon(new SolidBrush(this.SymbolItem.BackColor), vertexs); } g.DrawPolygon(new Pen(this.SymbolItem.ForeColor, this.Attribute.LineThick), vertexs); }
반응형
'백엔드 > C#' 카테고리의 다른 글
Collection 캐스팅하기 (0) | 2019.02.27 |
---|---|
Color <-> String 변환 (0) | 2019.02.21 |
RichTextBox 입력할 때 주의할점(또는 컴포넌트 접근은 Load 이벤트 안에서) (0) | 2019.02.14 |
[디버깅] 특정 버전 가져오기 (0) | 2019.01.08 |
설치파일 만들기 (0) | 2018.12.19 |
댓글