Beispiel #1
0
 public void Draw(Graphics g)
 {
     DrawBorderHandler(g, PositionRect, backColor);
     if (selected)
     {
         //選中時邊框變
         CustomRectangle rect = new CustomRectangle(x - 4, y - 4, 8, 8);
         g.DrawRectangle(new Pen(Color.Black), rect.ToRectangle());
     }
 }
Beispiel #2
0
        private void timerCPU_Tick(object sender, EventArgs e)
        {
            float i;

            if (cpuCurAngle > cpuAimAngle)
            {
                float intRotateStep = (float)Math.Max(1, Math.Round(Math.Abs(Math.Abs(cpuAimAngle) - Math.Abs(cpuCurAngle)) / 10d));
                i = cpuCurAngle - intRotateStep;
                if (i <= cpuAimAngle)
                {
                    timerCPU.Enabled = false;
                    cpuCurAngle      = cpuAimAngle;
                }
                else
                {
                    cpuCurAngle = i;
                }
            }
            else
            {
                float intRotateStep = (float)Math.Max(1, Math.Round(Math.Abs(Math.Abs(cpuAimAngle) - Math.Abs(cpuCurAngle)) / 10d));
                i = cpuCurAngle + intRotateStep;
                if (i >= cpuAimAngle)
                {
                    timerCPU.Enabled = false;
                    cpuCurAngle      = cpuAimAngle;
                }
                else
                {
                    if ((i >= -360) && (i <= 360))
                    {
                        cpuCurAngle = i;
                    }
                }
            }
            this.Invalidate(positionRect.ToRectangle());
        }
Beispiel #3
0
 private void DrawBorderHandler(Graphics g, CustomRectangle rect, Color clr)
 {
     g.FillRectangle(new SolidBrush(clr), rect.ToRectangleF());
     g.DrawRectangle(new Pen(Color.Black), rect.ToRectangle());
 }