예제 #1
0
        static public Screw CreateScrew(double x, double y, int size, bool pixels)
        {
            int top, left;

            if (pixels)
            {
                top  = (int)Math.Round(y - 4);
                left = (int)Math.Round(x - 4);
            }
            else
            {
                top  = (int)(y * form.pxPrLine) + form.padding_top + 4;
                left = (int)((x * form.pxPrChar) + form.padding_left) - 1;
            }

            Screw screw = new Screw();

            screw.Location = new Point(left, top);
            screw.Size     = new Size(size + 8, size + 8);
            screw.angle    = Helper.random() * 180;

            form.Controls.Add(screw);
            return(screw);
        }