// обработка событий контролов
        private void rbtnSwivelBearing_CheckedChanged(object sender, EventArgs e)
        {
            CleanResultTextboxes();

            if (rbtnSwivelBearing.Checked)
            {
                framePropertiesOfColumnWithIncompleteCoupling = framePropertiesOfColumnWithIncompleteCoupling & ~FramePropertiesOfColumnWithIncompleteCoupling.BearingOfColumn;   // xxxx xxx0 | см. описание unum FrameProperties
            }
            else
            {
                framePropertiesOfColumnWithIncompleteCoupling = framePropertiesOfColumnWithIncompleteCoupling | FramePropertiesOfColumnWithIncompleteCoupling.BearingOfColumn;    // xxxx xxx1 | см. описание unum FrameProperties
            }
            DrawPictures();
        }
        public void SetLastControlState()   // метод, "восстанавливающий" последнее сохраненное состояние юзерконтрола. Используется при инициализации
        {
            designOfEffectiveLengthOfColumnWithIncompleteCoupling.ReadEffectiveLength();
            {
                framePropertiesOfColumnWithIncompleteCoupling = designOfEffectiveLengthOfColumnWithIncompleteCoupling.framePropertiesOfColumnWithIncompleteCoupling;
                if ((framePropertiesOfColumnWithIncompleteCoupling & FramePropertiesOfColumnWithIncompleteCoupling.BearingOfColumn) == 0)
                {
                    rbtnSwivelBearing.Checked = true;
                }
                else
                {
                    rbtnRigidBearing.Checked = true;
                }
                if ((framePropertiesOfColumnWithIncompleteCoupling & FramePropertiesOfColumnWithIncompleteCoupling.PositionOfCrossbrace) == 0)
                {
                    rbtnCrossbraceOnBottom.Checked = true;
                }
                else
                {
                    rbtnCrossbraceOnTop.Checked = true;
                }

                SetTextboxLastValue(tbHeightBottom, designOfEffectiveLengthOfColumnWithIncompleteCoupling.heightBottom);
                SetTextboxLastValue(tbHeightFree, designOfEffectiveLengthOfColumnWithIncompleteCoupling.heightFree);
                SetTextboxLastValue(tbMomInertBottom, designOfEffectiveLengthOfColumnWithIncompleteCoupling.momInertBottom);
                SetTextboxLastValue(tbForceBottom, designOfEffectiveLengthOfColumnWithIncompleteCoupling.forceBottom);
                SetTextboxLastValue(tbHeightTop, designOfEffectiveLengthOfColumnWithIncompleteCoupling.heightTop);
                SetTextboxLastValue(tbMomInertTop, designOfEffectiveLengthOfColumnWithIncompleteCoupling.momInertTop);
                SetTextboxLastValue(tbForceTop, designOfEffectiveLengthOfColumnWithIncompleteCoupling.forceTop);
                SetTextboxLastValue(tbMuBottom, Math.Round(designOfEffectiveLengthOfColumnWithIncompleteCoupling.muBottom, 3));
                SetTextboxLastValue(tbEffectLengthBottom, Math.Round(designOfEffectiveLengthOfColumnWithIncompleteCoupling.effectLengthBottom, 3));
                SetTextboxLastValue(tbMuTop, Math.Round(designOfEffectiveLengthOfColumnWithIncompleteCoupling.muTop, 3));
                SetTextboxLastValue(tbEffectLengthTop, Math.Round(designOfEffectiveLengthOfColumnWithIncompleteCoupling.effectLengthTop, 3));

                if (tbMuBottom.Text == String.Empty && tbEffectLengthBottom.Text == String.Empty)
                {
                    actualResults = false;
                }
                else
                {
                    actualResults = true;
                }
            }
        }
 public void ReadEffectiveLength()  // Ф-ция восстанавливающая состояние контролов и их значения
 {
     if (File.Exists(fileName))
     {
         using (BinaryReader reader = new BinaryReader(File.Open(fileName, FileMode.Open)))
         {
             _framePropertiesOfColumnWithIncompleteCoupling = (FramePropertiesOfColumnWithIncompleteCoupling)reader.ReadByte();
             _heightBottom       = reader.ReadDouble();
             _heightFree         = reader.ReadDouble();
             _momInertBottom     = reader.ReadDouble();
             _forceBottom        = reader.ReadDouble();
             _heightTop          = reader.ReadDouble();
             _momInertTop        = reader.ReadDouble();
             _forceTop           = reader.ReadDouble();
             _muBottom           = reader.ReadDouble();
             _muTop              = reader.ReadDouble();
             _effectLengthBottom = reader.ReadDouble();
             _effectLengthTop    = reader.ReadDouble();
         }
     }
 }
        private void rbtnCrossbraceOnBottom_CheckedChanged(object sender, EventArgs e)
        {
            CleanResultTextboxes();
            if (rbtnCrossbraceOnBottom.Checked)
            {
                framePropertiesOfColumnWithIncompleteCoupling = framePropertiesOfColumnWithIncompleteCoupling & ~FramePropertiesOfColumnWithIncompleteCoupling.PositionOfCrossbrace;   // xxxx xx0x | см. описание unum FrameProperties
                grbxParamOfTopPart.Visible   = false;
                grbxResultsOfTopPart.Visible = false;

                tlpParamOfBottomPart.RowStyles[0].SizeType = SizeType.Percent;
                tlpParamOfBottomPart.RowStyles[0].Height   = 50;

                tlpParamOfBottomPart.RowStyles[1].SizeType = SizeType.Percent;
                tlpParamOfBottomPart.RowStyles[1].Height   = 50;

                lblTxtHeightFree.Visible  = true;
                lblIndHeightFree.Visible  = true;
                tbHeightFree.Visible      = true;
                lblUnitHeightFree.Visible = true;

                tlpParamOfBottomPart.RowStyles[2].SizeType = SizeType.AutoSize;
                lblTxtMomInertBottom.Visible  = false;
                lblIndMomInertBottom.Visible  = false;
                tbMomInertBottom.Visible      = false;
                lblUnitMomInertBottom.Visible = false;

                tlpParamOfBottomPart.RowStyles[3].SizeType = SizeType.AutoSize;
                lblTxtForce.Visible        = false;
                lblIndForceBottom.Visible  = false;
                tbForceBottom.Visible      = false;
                lblUnitForceBottom.Visible = false;

                grbxParamOfBottomPart.Text    = GeneralRes.ParamOfColumn;
                lblTxtHeight.Text             = GeneralRes.FullHeight;
                lblIndHeightBottom.Text       = GeneralRes.h;
                grbxResultsOfBottomPart.Text  = GeneralRes.Results;
                lblIndMuBottom.Text           = GeneralRes.mu;
                lblTxtEffectLength.Text       = GeneralRes.EffectLengthMuOnH;
                lblIndEffectLengthBottom.Text = GeneralRes.lef;

                tbHeightBottom.Text   = string.Empty;
                tbMomInertBottom.Text = string.Empty;
                tbForceBottom.Text    = string.Empty;
                tbHeightTop.Text      = string.Empty;
                tbMomInertTop.Text    = string.Empty;
                tbForceTop.Text       = string.Empty;
            }
            else
            {
                framePropertiesOfColumnWithIncompleteCoupling = framePropertiesOfColumnWithIncompleteCoupling | FramePropertiesOfColumnWithIncompleteCoupling.PositionOfCrossbrace;    // xxxx xx1x | см. описание unum FrameProperties
                grbxParamOfTopPart.Visible   = true;
                grbxResultsOfTopPart.Visible = true;

                tlpParamOfBottomPart.RowStyles[0].SizeType = SizeType.Percent;
                tlpParamOfBottomPart.RowStyles[0].Height   = 34;

                tlpParamOfBottomPart.RowStyles[1].SizeType = SizeType.AutoSize;
                lblTxtHeightFree.Visible  = false;
                lblIndHeightFree.Visible  = false;
                tbHeightFree.Visible      = false;
                lblUnitHeightFree.Visible = false;

                tlpParamOfBottomPart.RowStyles[2].SizeType = SizeType.Percent;
                tlpParamOfBottomPart.RowStyles[2].Height   = 33;
                lblTxtMomInertBottom.Visible  = true;
                lblIndMomInertBottom.Visible  = true;
                tbMomInertBottom.Visible      = true;
                lblUnitMomInertBottom.Visible = true;

                tlpParamOfBottomPart.RowStyles[3].SizeType = SizeType.Percent;
                tlpParamOfBottomPart.RowStyles[3].Height   = 33;
                lblTxtForce.Visible        = true;
                lblIndForceBottom.Visible  = true;
                tbForceBottom.Visible      = true;
                lblUnitForceBottom.Visible = true;

                grbxParamOfBottomPart.Text    = GeneralRes.ParamOfBottomPart;
                lblTxtHeight.Text             = GeneralRes.Height;
                lblIndHeightBottom.Text       = GeneralRes.h1;
                grbxResultsOfBottomPart.Text  = GeneralRes.ResultsOfBottomPart;
                lblIndMuBottom.Text           = GeneralRes.mu1;
                lblTxtEffectLength.Text       = GeneralRes.EffectLength;
                lblIndEffectLengthBottom.Text = GeneralRes.lef1;

                tbHeightBottom.Text = string.Empty;
                tbHeightFree.Text   = string.Empty;
            }
            DrawPictures();
        }