9월, 2017의 게시물 표시

A line drawing with two positions (x1, y1) and (x2, y2) with TLine.

이미지
A line drawing with two positions(x1, y1) and (x2, y2) with TLine. TLine's attributes are height and width, and TLine's coordinates are x, y position at the top left, so it is not easy to draw lines by specifying (x1, y1) and (x2, y2). I have created a method that draws two positions using TLine's Rotation Angle attribute. The principle is to find only the line width and rotation angle value with two postion. First, you can specify the properties of TLine as shown in the figure. The important thing is RotationCenter. If RotationCenter has default values ​​of 0.5 and 0.5, it rotates around the center of the line. RotationCenter should be changed to (0,0) to rotate around the end point of the line (x1.y1). The line width and rotation angle designation can be calculated as shown in the figure. Red color line is a TLine. I wrote the sample code using the above method. The position.X values is x2>x1 when the rotation angle range is 0 ~ 180. If the SIN...