コード例 #1
0
        /// <summary>
        /// 右侧张拉CheckBox点击事件
        /// </summary>
        /// <param name="sender">右侧张拉对应CheckBox</param>
        /// <param name="e">右侧张拉对应CheckBox的事件参数</param>
        private void checkBoxRightDraw_Click(object sender, RoutedEventArgs e)
        {
            SyncData.SyncTdGenParasToDlg(this);//将tdGenParas对象与对话框数据同步
            Database db   = HostApplicationServices.WorkingDatabase;
            Editor   ed   = db.GetEditor();
            int      iRow = dataGridTdInfo.SelectedIndex;

            using (Transaction trans = db.TransactionManager.StartTransaction())
            {
                //获得当前行
                ObjectId     tdId = tdIdsInTable[(dataGridTdInfo.Columns[10].GetCellContent(dataGridTdInfo.Items[iRow]) as TextBlock).Text]; //获取本行钢束线的ObjectId
                AcadPolyline td   = tdId.GetObject(OpenMode.ForRead) as AcadPolyline;                                                        //获取本行钢束线
                if ((sender as CheckBox).IsChecked == false)                                                                                 //如果右侧为不张拉状态,左侧必须张拉
                {
                    (dataGridTdInfo.GetControl(iRow, 4, "checkBoxLeftDraw") as CheckBox).IsChecked = true;                                   //左侧则必须为张拉状态
                    //左侧引伸量
                    (dataGridTdInfo.Columns[6].GetCellContent(dataGridTdInfo.Items[iRow]) as TextBlock).Text =
                        td.SingleDrawAmount(
                            TendonGeneralParameters.CtrlStress,
                            TendonGeneralParameters.Kii,
                            TendonGeneralParameters.Miu,
                            1,
                            TendonGeneralParameters.Ep).ToString("F0");
                    //右侧引伸量
                    (dataGridTdInfo.Columns[7].GetCellContent(dataGridTdInfo.Items[iRow]) as TextBlock).Text = "0";
                }
                else if ((sender as CheckBox).IsChecked == true)//右侧目前为张拉状态
                {
                    //左侧引伸量
                    (dataGridTdInfo.Columns[6].GetCellContent(dataGridTdInfo.Items[iRow]) as TextBlock).Text
                        = td.BothDrawAmount(
                              TendonGeneralParameters.CtrlStress,
                              TendonGeneralParameters.Kii,
                              TendonGeneralParameters.Miu,
                              TendonGeneralParameters.Ep)[0].ToString("F0");
                    //右侧引伸量
                    (dataGridTdInfo.Columns[7].GetCellContent(dataGridTdInfo.Items[iRow]) as TextBlock).Text
                        = td.BothDrawAmount(
                              TendonGeneralParameters.CtrlStress,
                              TendonGeneralParameters.Kii,
                              TendonGeneralParameters.Miu,
                              TendonGeneralParameters.Ep)[1].ToString("F0");
                }
                trans.Commit();
            }
        }