#region Yaw graphics.ResetTransform(); //增加Yaw背景 var yawBg = new RectangleF(0, 0, Width, Height / 2f / 7.5f); using (var brush = new SolidBrush(Color.FromArgb(128, 255, 255, 255))) { graphics.FillRectangle(brush, yawBg); } //只顯示+-60度 var start = Yaw - 60f; var end = Yaw + 60f; var boundaryWidth = Width / 15f;//邊界(10) var space = (Width - boundaryWidth) / 120f;//間隔(剩餘空間分配給120度) var lineHeight = yawBg.Height * 2 / 5f;//刻度長度 //畫刻度 for (var a = start; a <= end; a++) { if (a % 5 == 0) { //每5度畫一次 using (var pen = new Pen(Color.White, 2f)) { var posX = yawBg.Left + boundaryWidth / 2f + (a - start) * space; var posY = yawBg.Bottom - lineHeight / 2f; graphics.DrawLine(pen, posX, posY, posX, posY - lineHeight); } } } //刻度底線 using (var pen = new Pen(Color.White, 2f)) { graphics.DrawLine(pen, yawBg.Left + boundaryWidth / 2f, yawBg.Bottom - lineHeight / 2f, yawBg.Right - boundaryWidth / 2f, yawBg.Bottom - lineHeight / 2f); } #endregion
2022年4月14日 星期四
[Window Form] 繪製地面站姿態儀(四) Yaw刻度
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言