Пример #1
0
        private void UpdateThicknesses(object sender, EventArgs e)
        {
            UCtrlTriDouble uCtrlDim = sender as UCtrlTriDouble;

            if (null != uCtrlDim)
            {
                double thickness = UnitsManager.ConvertLengthFrom(5.0, UnitsManager.UnitSystem.UNIT_METRIC1);
                if (uCtrlDimensionsOuter == uCtrlDim && CapLength > thickness)
                {
                    CapInnerLength = CapLength - thickness;
                }
                if (uCtrlDimensionsOuter == uCtrlDim && CapWidth > thickness)
                {
                    CapInnerWidth = CapWidth - thickness;
                }
                if (uCtrlDimensionsOuter == uCtrlDim && CapHeight > thickness)
                {
                    CapInnerHeight = CapHeight - thickness;
                }
            }
            // update
            UpdateStatus(string.Empty);
            // draw cap
            graphCtrl.Invalidate();
        }
Пример #2
0
        private void onBoxPropertyChanged(object sender, EventArgs e)
        {
            // maintain inside dimensions
            UCtrlTriDouble uCtrlDimOut = sender as UCtrlTriDouble;

            if (null != uCtrlDimOut && uCtrlDimensionsOuter == uCtrlDimOut)
            {
                InsideLength = BoxLength - _thicknessLength;
                InsideWidth  = BoxWidth - _thicknessWidth;
                InsideHeight = BoxHeight - _thicknessHeight;
            }
            UCtrlOptTriDouble uCtrlDimIn = sender as UCtrlOptTriDouble;

            if (null != uCtrlDimIn && uCtrlDimensionsInner == uCtrlDimIn)
            {
                if (BoxLength < InsideLength)
                {
                    BoxLength = InsideLength + _thicknessLength;
                }
                if (BoxWidth < InsideWidth)
                {
                    BoxWidth = InsideWidth + _thicknessWidth;
                }
                if (BoxHeight <= InsideHeight)
                {
                    BoxHeight = InsideHeight + _thicknessHeight;
                }
            }
            uCtrlNetWeight.Enabled = !uCtrlDimensionsInner.Checked;

            // update thicknesses
            UpdateThicknesses();
            // update ok button status
            UpdateButtonOkStatus();
            // update box drawing
            graphCtrl.Invalidate();
        }