public XYIntLocation(NormalLocation normLoc, XYIntLocation[] field)
        {
            if (!SetField(field))
            {
                throw (new Exception("Invalid Field in XYIntLocation"));
            }
            else
            {
                XYIntLocation[] tempField = (XYIntLocation[])this.Field;
                int dX = tempField[1].X - tempField[0].X;
                int dY = tempField[1].Y - tempField[0].Y;

                double X = dX * normLoc.X;
                double Y = dY * normLoc.Y;

                this.x = (int)(X + tempField[0].X);
                this.y = (int)(Y + tempField[0].Y);
            }
        }
예제 #2
0
        private void Panel_SizeChanged(object sender, EventArgs e)
        {
            // Every time the panel's size changes, this occurs...
            int x = Panel.Width; int y = Panel.Height;                   // get width & height
            //PanelX.Text = x.ToString(); PanelY.Text = y.ToString();      // Set width/height debug fields
            //PanelAspect.Text = ((float)x / (float)y).ToString("0.0000"); // Set Aspect Ration debug field

            panelDrawField[0] = new XYIntLocation(0, 0);                 // Set Field for new Panel size
            panelDrawField[1] = new XYIntLocation(x, y);

            this.Panel.Invalidate();                                     // Invalidate Panel (force redraw)
        }
        // Assume Aspect Ratio fixed
        public void ConvertTo(XYIntLocation[] field)
        {
            XYIntLocation pt1 = new XYIntLocation(loc1.Normalize(), field);
            loc1 = pt1;

            isPointConverted = true;
        }
        // Assume Aspect Ratio fixed
        public void ConvertTo(XYIntLocation[] field)
        {
            XYIntLocation pt1 = new XYIntLocation(loc1.Normalize(), field);
            XYIntLocation pt2 = new XYIntLocation(loc2.Normalize(), field);
            loc1 = pt1;
            loc2 = pt2;

            isPointConverted = true;
            isDrawable = true;   // Normally this would occur in ConvertTo(double FieldMultiplier)
        }