Beispiel #1
0
        public void SetHCView(HCView aHCView)
        {
            DeItem vDeItem = aHCView.ActiveSectionTopLevelData().GetActiveItem() as DeItem;

            dgvProperty.RowCount = vDeItem.Propertys.Count + 1;

            int vRow = 0;

            foreach (KeyValuePair <string, string> keyValuePair in vDeItem.Propertys)
            {
                dgvProperty.Rows[vRow].Cells[0].Value = keyValuePair.Key;
                dgvProperty.Rows[vRow].Cells[1].Value = keyValuePair.Value;
                vRow++;
            }

            cbxCanEdit.Checked     = !vDeItem.EditProtect;
            cbxCanCopy.Checked     = !vDeItem.CopyProtect;
            cbxDeleteAllow.Checked = vDeItem.DeleteAllow;
            cbxAllocOnly.Checked   = vDeItem.AllocOnly;

            this.ShowDialog();
            if (this.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                string vsValue = "";

                vDeItem.Propertys.Clear();
                for (int i = 0; i < dgvProperty.RowCount; i++)
                {
                    if (dgvProperty.Rows[i].Cells[0].Value == null)
                    {
                        continue;
                    }

                    if (dgvProperty.Rows[i].Cells[1].Value == null)
                    {
                        vsValue = "";
                    }
                    else
                    {
                        vsValue = dgvProperty.Rows[i].Cells[1].Value.ToString();
                    }

                    if (dgvProperty.Rows[i].Cells[0].Value.ToString().Trim() != "")
                    {
                        vDeItem.Propertys.Add(dgvProperty.Rows[i].Cells[0].Value.ToString(), vsValue);
                    }
                }

                vDeItem.EditProtect = !cbxCanEdit.Checked;
                vDeItem.CopyProtect = !cbxCanCopy.Checked;
                vDeItem.DeleteAllow = cbxDeleteAllow.Checked;
                vDeItem.AllocOnly   = cbxAllocOnly.Checked;
            }

            //Close();
        }
 private void frmHCViewDemo_Load(object sender, EventArgs e)
 {
     this.Text = "HCViewDemo " + Application.ProductVersion.ToString();
     FHCView   = new HCView();
     //FHCView.OnCaretChange := DoCaretChange;
     //FHCView.OnVerScroll := DoVerScroll;
     //FHCView.PopupMenu := pmRichEdit;
     this.Controls.Add(FHCView);
     FHCView.Dock = DockStyle.Fill;
     FHCView.BringToFront();
     //this.ResumeLayout(true);
 }
Beispiel #3
0
        public void SetView(HCView aHCView)
        {
            cbbSpaceMode.SelectedIndex = (byte)aHCView.Style.ParaStyles[aHCView.CurParaNo].LineSpaceMode;
            switch (aHCView.Style.ParaStyles[aHCView.CurParaNo].LineSpaceMode)
            {
            case ParaLineSpaceMode.plsFix:
                tbxLineSpace.Text = string.Format("{0:0.#}", aHCView.Style.ParaStyles[aHCView.CurParaNo].LineSpace);
                break;

            case ParaLineSpaceMode.plsMult:
                tbxLineSpace.Text = string.Format("{0:0.#}", aHCView.Style.ParaStyles[aHCView.CurParaNo].LineSpace);
                break;
            }
            cbbAlignHorz.SelectedIndex = (byte)aHCView.Style.ParaStyles[aHCView.CurParaNo].AlignHorz;
            cbbAlignVert.SelectedIndex = (byte)aHCView.Style.ParaStyles[aHCView.CurParaNo].AlignVert;
            pnlBackColor.BackColor     = aHCView.Style.ParaStyles[aHCView.CurParaNo].BackColor;
            cbxBreakRough.Checked      = aHCView.Style.ParaStyles[aHCView.CurParaNo].BreakRough;

            this.ShowDialog();
            if (this.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                aHCView.BeginUpdate();
                try
                {
                    Single vFloat = 12;
                    if (cbbSpaceMode.SelectedIndex > 4)
                    {
                        if (Single.TryParse(tbxLineSpace.Text, out vFloat))
                        {
                            aHCView.ApplyParaLineSpace((ParaLineSpaceMode)cbbSpaceMode.SelectedIndex, vFloat);
                        }
                    }
                    else
                    {
                        aHCView.ApplyParaLineSpace((ParaLineSpaceMode)cbbSpaceMode.SelectedIndex, vFloat);
                    }

                    aHCView.ApplyParaAlignHorz((ParaAlignHorz)cbbAlignHorz.SelectedIndex);
                    aHCView.ApplyParaAlignVert((ParaAlignVert)cbbAlignVert.SelectedIndex);
                    aHCView.ApplyParaBackColor(pnlBackColor.BackColor);
                    aHCView.ApplyParaBreakRough(cbxBreakRough.Checked);
                }
                finally
                {
                    aHCView.EndUpdate();
                }
            }
        }
        public void SetView(HCView aView)
        {
            FTableItem = aView.ActiveSection.ActiveData.GetActiveItem() as HCTableItem;
            GetTableProperty();

            this.ShowDialog();
            if (this.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                aView.BeginUpdate();
                try
                {
                    SetTableProperty();
                    aView.Style.UpdateInfoRePaint();
                }
                finally
                {
                    aView.EndUpdate();
                }
            }
        }
        private void frmHCViewDemo_Load(object sender, EventArgs e)
        {
            System.Drawing.Text.InstalledFontCollection fonts = new System.Drawing.Text.InstalledFontCollection();
            foreach (System.Drawing.FontFamily family in fonts.Families)
            {
                cbbFont.Items.Add(family.Name);
            }
            cbbFont.Text          = "宋体";
            cbbFontSize.Text      = "五号";
            cbbZoom.SelectedIndex = 3;

            this.Text                = "HCViewDemo " + Application.ProductVersion.ToString();
            FHCView                  = new HCView();
            FHCView.OnCaretChange    = DoCaretChange;
            FHCView.OnZoomChanged    = DoZoomChanged;
            FHCView.OnVerScroll      = DoVerScroll;
            FHCView.ContextMenuStrip = pmHCView;
            this.Controls.Add(FHCView);
            FHCView.Dock = DockStyle.Fill;
            FHCView.BringToFront();
            //this.ResumeLayout(true);
        }
Beispiel #6
0
        public void SetView(HCView aHCView)
        {
            cbbSpaceMode.SelectedIndex = (byte)aHCView.Style.ParaStyles[aHCView.CurParaNo].LineSpaceMode;
            cbbAlignHorz.SelectedIndex = (byte)aHCView.Style.ParaStyles[aHCView.CurParaNo].AlignHorz;
            cbbAlignVert.SelectedIndex = (byte)aHCView.Style.ParaStyles[aHCView.CurParaNo].AlignVert;
            pnlBackColor.BackColor     = aHCView.Style.ParaStyles[aHCView.CurParaNo].BackColor;

            this.ShowDialog();
            if (this.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                aHCView.BeginUpdate();
                try
                {
                    aHCView.ApplyParaLineSpace((ParaLineSpaceMode)cbbSpaceMode.SelectedIndex);
                    aHCView.ApplyParaAlignHorz((ParaAlignHorz)cbbAlignHorz.SelectedIndex);
                    aHCView.ApplyParaAlignVert((ParaAlignVert)cbbAlignVert.SelectedIndex);
                    aHCView.ApplyParaBackColor(pnlBackColor.BackColor);
                }
                finally
                {
                    aHCView.EndUpdate();
                }
            }
        }
        public void SetHCView(HCView aHCView)
        {
            FHCView = aHCView;
            HCRichData vData  = FHCView.ActiveSection.ActiveData;
            DeTable    vTable = vData.GetActiveItem() as DeTable;

            // 表格
            tbxCellHPadding.Text     = vTable.CellHPadding.ToString();
            tbxCellVPadding.Text     = vTable.CellVPadding.ToString();
            cbxBorderVisible.Checked = vTable.BorderVisible;
            tbxBorderWidth.Text      = vTable.BorderWidth.ToString();

            tbxFixRowFirst.Text = (vTable.FixRow + 1).ToString();
            tbxFixRowLast.Text  = (vTable.FixRow + vTable.FixRowCount).ToString();
            tbxFixColFirst.Text = (vTable.FixCol + 1).ToString();
            tbxFixColLast.Text  = (vTable.FixCol + vTable.FixColCount).ToString();

            // 行
            if (vTable.SelectCellRang.StartRow >= 0)
            {
                tabRow.Text = "行(" + (vTable.SelectCellRang.StartRow + 1).ToString() + ")";
                if (vTable.SelectCellRang.EndRow > 0)
                {
                    tabRow.Text += " - (" + (vTable.SelectCellRang.EndRow + 1).ToString() + ")";
                }

                tbxRowHeight.Text = vTable.Rows[vTable.SelectCellRang.StartRow].Height.ToString();  // 行高
            }
            else
            {
                tabTableInfo.TabPages.Remove(tabRow);
            }

            // 单元格
            if ((vTable.SelectCellRang.StartRow >= 0) && (vTable.SelectCellRang.StartCol >= 0))
            {
                HCAlignVert vAlignVer = HCAlignVert.cavTop;

                if (vTable.SelectCellRang.EndRow >= 0)  // 多选
                {
                    vAlignVer    = vTable[vTable.SelectCellRang.StartRow, vTable.SelectCellRang.StartCol].AlignVert;
                    tabCell.Text = "单元格(" + (vTable.SelectCellRang.StartRow + 1).ToString() + ","
                                   + (vTable.SelectCellRang.StartCol + 1).ToString() + ") - ("
                                   + (vTable.SelectCellRang.EndRow + 1).ToString() + ","
                                   + (vTable.SelectCellRang.EndCol + 1).ToString() + ")";
                }
                else
                {
                    vAlignVer    = vTable.GetEditCell().AlignVert;
                    tabCell.Text = "单元格(" + (vTable.SelectCellRang.StartRow + 1).ToString() + ","
                                   + (vTable.SelectCellRang.StartCol + 1).ToString() + ")";
                }

                cbbCellAlignVert.SelectedIndex = (int)vAlignVer;
            }
            else
            {
                tabTableInfo.TabPages.Remove(tabCell);
            }

            dgvTable.RowCount = vTable.Propertys.Count + 1;
            if (vTable.Propertys.Count > 0)
            {
                int vRow = 0;
                foreach (KeyValuePair <string, string> keyValuePair in vTable.Propertys)
                {
                    dgvTable.Rows[vRow].Cells[0].Value = keyValuePair.Key;
                    dgvTable.Rows[vRow].Cells[1].Value = keyValuePair.Value;
                    vRow++;
                }
            }

            this.ShowDialog();
            if (this.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                FHCView.BeginUpdate();
                try
                {
                    // 表格
                    vTable.CellHPadding  = byte.Parse(tbxCellHPadding.Text);
                    vTable.CellVPadding  = byte.Parse(tbxCellVPadding.Text);
                    vTable.BorderWidth   = byte.Parse(tbxBorderWidth.Text);
                    vTable.BorderVisible = cbxBorderVisible.Checked;

                    vTable.FixRow      = (sbyte)(int.Parse(tbxFixRowFirst.Text, 0) - 1);
                    vTable.FixRowCount = (byte)(int.Parse(tbxFixRowLast.Text, 0) - vTable.FixRow);
                    vTable.FixCol      = (sbyte)(int.Parse(tbxFixColFirst.Text, 0) - 1);
                    vTable.FixColCount = (byte)(int.Parse(tbxFixColLast.Text, 0) - vTable.FixCol);

                    // 行
                    if (vTable.SelectCellRang.StartRow >= 0)
                    {
                        int viValue = int.Parse(tbxRowHeight.Text);
                        if (vTable.SelectCellRang.EndRow > 0)
                        {
                            for (int vR = vTable.SelectCellRang.StartRow; vR <= vTable.SelectCellRang.EndRow; vR++)
                            {
                                vTable.Rows[vR].Height = viValue;
                            }
                        }
                        else
                        {
                            vTable.Rows[vTable.SelectCellRang.StartRow].Height = viValue;
                        }
                    }

                    // 单元格
                    if ((vTable.SelectCellRang.StartRow >= 0) && (vTable.SelectCellRang.StartCol >= 0))
                    {
                        if (vTable.SelectCellRang.EndCol > 0)
                        {
                            for (int vR = vTable.SelectCellRang.StartRow; vR <= vTable.SelectCellRang.EndRow; vR++)
                            {
                                for (int vC = vTable.SelectCellRang.StartCol; vC <= vTable.SelectCellRang.EndCol; vC++)
                                {
                                    vTable[vR, vC].AlignVert = (HCAlignVert)cbbCellAlignVert.SelectedIndex;
                                }
                            }
                        }
                        else
                        {
                            vTable.GetEditCell().AlignVert = (HCAlignVert)cbbCellAlignVert.SelectedIndex;
                        }
                    }

                    vTable.Propertys.Clear();
                    string vsValue = "";
                    for (int i = 0; i < dgvTable.RowCount; i++)
                    {
                        if (dgvTable.Rows[i].Cells[0].Value == null)
                        {
                            continue;
                        }

                        if (dgvTable.Rows[i].Cells[1].Value == null)
                        {
                            vsValue = "";
                        }
                        else
                        {
                            vsValue = dgvTable.Rows[i].Cells[1].Value.ToString();
                        }

                        if (dgvTable.Rows[i].Cells[0].Value.ToString().Trim() != "")
                        {
                            vTable.Propertys.Add(dgvTable.Rows[i].Cells[0].Value.ToString(), vsValue);
                        }
                    }

                    if (FReFormat)
                    {
                        FHCView.ActiveSection.ReFormatActiveItem();
                    }
                }
                finally
                {
                    FHCView.EndUpdate();
                }
            }
        }
Beispiel #8
0
        public void SetHCView(HCView aHCView, DeCombobox aCombobox)
        {
            if (aCombobox[DeProp.Name] != "")
            {
                this.Text = aCombobox[DeProp.Name];
            }

            cbxAutoSize.Checked = aCombobox.AutoSize;
            tbxWidth.Enabled    = !cbxAutoSize.Checked;
            tbxHeight.Enabled   = !cbxAutoSize.Checked;

            tbxWidth.Text            = aCombobox.Width.ToString();
            tbxHeight.Text           = aCombobox.Height.ToString();
            tbxText.Text             = aCombobox.Text;
            cbxPrintOnlyText.Checked = aCombobox.PrintOnlyText;
            cbxDeleteAllow.Checked   = aCombobox.DeleteAllow;
            cbxBorderLeft.Checked    = aCombobox.BorderSides.Contains((byte)BorderSide.cbsLeft);
            cbxBorderTop.Checked     = aCombobox.BorderSides.Contains((byte)BorderSide.cbsTop);
            cbxBorderRight.Checked   = aCombobox.BorderSides.Contains((byte)BorderSide.cbsRight);
            cbxBorderBottom.Checked  = aCombobox.BorderSides.Contains((byte)BorderSide.cbsBottom);

            dgvCombobox.RowCount = aCombobox.Propertys.Count + 1;
            if (aCombobox.Propertys.Count > 0)
            {
                int vRow = 0;
                foreach (KeyValuePair <string, string> keyValuePair in aCombobox.Propertys)
                {
                    dgvCombobox.Rows[vRow].Cells[0].Value = keyValuePair.Key;
                    dgvCombobox.Rows[vRow].Cells[1].Value = keyValuePair.Value;
                    vRow++;
                }
            }

            cbxSaveItem.Checked = aCombobox.SaveItem;
            dgvItem.Enabled     = cbxSaveItem.Checked;
            dgvItem.RowCount    = aCombobox.Items.Count + 1;
            if (aCombobox.Items.Count > 0)
            {
                for (int i = 0; i < aCombobox.Items.Count; i++)
                {
                    dgvItem.Rows[i].Cells[0].Value = aCombobox.Items[i].Text;
                    if (i < aCombobox.ItemValues.Count)
                    {
                        dgvItem.Rows[i].Cells[1].Value = aCombobox.ItemValues[i].Text;
                    }
                }
            }

            this.ShowDialog();
            if (this.DialogResult == DialogResult.OK)
            {
                aCombobox.AutoSize = cbxAutoSize.Checked;
                if (!cbxAutoSize.Checked)  // 自定义大小
                {
                    int vi = aCombobox.Width;
                    if (int.TryParse(tbxWidth.Text, out vi))
                    {
                        aCombobox.Width = vi;
                    }

                    vi = aCombobox.Height;
                    if (int.TryParse(tbxHeight.Text, out vi))
                    {
                        aCombobox.Height = vi;
                    }
                }

                aCombobox.Text = tbxText.Text;

                if (cbxBorderLeft.Checked)
                {
                    aCombobox.BorderSides.InClude((byte)BorderSide.cbsLeft);
                }
                else
                {
                    aCombobox.BorderSides.ExClude((byte)BorderSide.cbsLeft);
                }

                if (cbxBorderTop.Checked)
                {
                    aCombobox.BorderSides.InClude((byte)BorderSide.cbsTop);
                }
                else
                {
                    aCombobox.BorderSides.ExClude((byte)BorderSide.cbsTop);
                }

                if (cbxBorderRight.Checked)
                {
                    aCombobox.BorderSides.InClude((byte)BorderSide.cbsRight);
                }
                else
                {
                    aCombobox.BorderSides.ExClude((byte)BorderSide.cbsRight);
                }

                if (cbxBorderBottom.Checked)
                {
                    aCombobox.BorderSides.InClude((byte)BorderSide.cbsBottom);
                }
                else
                {
                    aCombobox.BorderSides.ExClude((byte)BorderSide.cbsBottom);
                }

                aCombobox.PrintOnlyText = cbxPrintOnlyText.Checked;
                aCombobox.DeleteAllow   = cbxDeleteAllow.Checked;

                string vsValue = "";
                aCombobox.Propertys.Clear();
                for (int i = 0; i < dgvCombobox.RowCount; i++)
                {
                    if (dgvCombobox.Rows[i].Cells[0].Value == null)
                    {
                        continue;
                    }

                    if (dgvCombobox.Rows[i].Cells[1].Value == null)
                    {
                        vsValue = "";
                    }
                    else
                    {
                        vsValue = dgvCombobox.Rows[i].Cells[1].Value.ToString();
                    }

                    if (dgvCombobox.Rows[i].Cells[0].Value.ToString().Trim() != "")
                    {
                        aCombobox.Propertys.Add(dgvCombobox.Rows[i].Cells[0].Value.ToString(), vsValue);
                    }
                }

                aCombobox.SaveItem = cbxSaveItem.Checked;
                aCombobox.Items.Clear();
                aCombobox.ItemValues.Clear();
                for (int i = 0; i < dgvItem.RowCount; i++)
                {
                    if (dgvItem.Rows[i].Cells[0].Value == null)
                    {
                        continue;
                    }

                    if (dgvItem.Rows[i].Cells[1].Value == null)
                    {
                        vsValue = "";
                    }
                    else
                    {
                        vsValue = dgvItem.Rows[i].Cells[1].Value.ToString();
                    }

                    if (dgvItem.Rows[i].Cells[0].Value.ToString() != "")
                    {
                        aCombobox.Items.Add(new HCCbbItem(dgvItem.Rows[i].Cells[0].Value.ToString()));
                        aCombobox.ItemValues.Add(new HCCbbItem(vsValue));
                    }
                }

                aHCView.BeginUpdate();
                try
                {
                    aHCView.ActiveSection.ReFormatActiveItem();
                }
                finally
                {
                    aHCView.EndUpdate();
                }
            }
        }
Beispiel #9
0
        public void SetHCView(HCView aHCView)
        {
            cbxPaper.SelectedIndex = cbxPaper.Items.IndexOf(HC.View.HC.GetPaperSizeStr((int)aHCView.ActiveSection.PaperSize));
            if (cbxPaper.SelectedIndex < 0)
            {
                cbxPaper.SelectedIndex = 0;
            }

            tbxWidth.ReadOnly  = cbxPaper.SelectedIndex > 0;
            tbxHeight.ReadOnly = cbxPaper.SelectedIndex > 0;

            if (aHCView.ActiveSection.PaperOrientation == PaperOrientation.cpoPortrait)
            {
                cbxPaperOrientation.SelectedIndex = 0;
                tbxWidth.Text  = string.Format("{0:0.#}", aHCView.ActiveSection.PaperWidth);
                tbxHeight.Text = string.Format("{0:0.#}", aHCView.ActiveSection.PaperHeight);
            }
            else
            {
                cbxPaperOrientation.SelectedIndex = 1;
                tbxWidth.Text  = string.Format("{0:0.#}", aHCView.ActiveSection.PaperHeight);
                tbxHeight.Text = string.Format("{0:0.#}", aHCView.ActiveSection.PaperWidth);
            }

            tbxTop.Text    = string.Format("{0:0.#}", aHCView.ActiveSection.PaperMarginTop);
            tbxLeft.Text   = string.Format("{0:0.#}", aHCView.ActiveSection.PaperMarginLeft);
            tbxRight.Text  = string.Format("{0:0.#}", aHCView.ActiveSection.PaperMarginRight);
            tbxBottom.Text = string.Format("{0:0.#}", aHCView.ActiveSection.PaperMarginBottom);

            cbxSymmetryMargin.Checked = aHCView.ActiveSection.SymmetryMargin;

            cbxPageNoVisible.Checked      = aHCView.ActiveSection.PageNoVisible;
            cbxParaLastMark.Checked       = aHCView.Style.ShowParaLastMark;
            cbxShowLineNo.Checked         = aHCView.ShowLineNo;
            cbxShowLineActiveMark.Checked = aHCView.ShowLineActiveMark;
            cbxShowUnderLine.Checked      = aHCView.ShowUnderLine;

            this.ShowDialog();
            if (this.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                aHCView.BeginUpdate();
                try
                {
                    int vIndex = GetPaperInfoIndexByName(cbxPaper.Text);
                    if (vIndex == 0)  // 自定义尺寸
                    {
                        aHCView.ActiveSection.PaperSize = System.Drawing.Printing.PaperKind.Custom;
                    }
                    else
                    {
                        aHCView.ActiveSection.PaperSize = (System.Drawing.Printing.PaperKind)FPaperInfos[vIndex].Size;
                    }

                    if (cbxPaperOrientation.SelectedIndex == 0)  // 纵向
                    {
                        aHCView.ActiveSection.PaperOrientation = PaperOrientation.cpoPortrait;
                    }
                    else
                    {
                        aHCView.ActiveSection.PaperOrientation = PaperOrientation.cpoLandscape;
                    }

                    if (vIndex == 0)                                // 自定义
                    {
                        if (cbxPaperOrientation.SelectedIndex == 0) // 纵向
                        {
                            aHCView.ActiveSection.PaperWidth  = float.Parse(tbxWidth.Text);
                            aHCView.ActiveSection.PaperHeight = float.Parse(tbxHeight.Text);
                        }
                        else  // 横向
                        {
                            aHCView.ActiveSection.PaperWidth  = float.Parse(tbxHeight.Text);
                            aHCView.ActiveSection.PaperHeight = float.Parse(tbxWidth.Text);
                        }
                    }
                    else
                    {
                        if (cbxPaperOrientation.SelectedIndex == 0)  // 纵向
                        {
                            aHCView.ActiveSection.PaperWidth  = FPaperInfos[vIndex].Width;
                            aHCView.ActiveSection.PaperHeight = FPaperInfos[vIndex].Height;
                        }
                        else  // 横向
                        {
                            aHCView.ActiveSection.PaperWidth  = FPaperInfos[vIndex].Height;
                            aHCView.ActiveSection.PaperHeight = FPaperInfos[vIndex].Width;
                        }
                    }

                    aHCView.ActiveSection.PaperMarginTop    = float.Parse(tbxTop.Text);
                    aHCView.ActiveSection.PaperMarginLeft   = float.Parse(tbxLeft.Text);
                    aHCView.ActiveSection.PaperMarginRight  = float.Parse(tbxRight.Text);
                    aHCView.ActiveSection.PaperMarginBottom = float.Parse(tbxBottom.Text);

                    aHCView.ActiveSection.SymmetryMargin = cbxSymmetryMargin.Checked;

                    aHCView.ActiveSection.PageNoVisible = cbxPageNoVisible.Checked;
                    aHCView.Style.ShowParaLastMark      = cbxParaLastMark.Checked;
                    aHCView.ShowLineNo         = cbxShowLineNo.Checked;
                    aHCView.ShowLineActiveMark = cbxShowLineActiveMark.Checked;
                    aHCView.ShowUnderLine      = cbxShowUnderLine.Checked;
                    aHCView.ResetActiveSectionMargin();
                }
                finally
                {
                    aHCView.EndUpdate();
                }
            }
        }
Beispiel #10
0
        public void SetHCView(HCView aHCView, DeRadioGroup aRadioGroup)
        {
            if (aRadioGroup[DeProp.Name] != "")
            {
                this.Text = aRadioGroup[DeProp.Name];
            }

            cbxAutoSize.Checked = aRadioGroup.AutoSize;
            tbxWidth.Enabled    = !cbxAutoSize.Checked;
            tbxHeight.Enabled   = !cbxAutoSize.Checked;

            tbxWidth.Text  = aRadioGroup.Width.ToString();
            tbxHeight.Text = aRadioGroup.Height.ToString();

            if (aRadioGroup.RadioStyle == HCRadioStyle.Radio)
            {
                cbbRadioStyle.SelectedIndex = 0;
            }
            else
            {
                cbbRadioStyle.SelectedIndex = 1;
            }

            cbxMulSelect.Checked   = aRadioGroup.MultSelect;
            cbxDeleteAllow.Checked = aRadioGroup.DeleteAllow;

            dgvRadioGroup.RowCount = aRadioGroup.Propertys.Count + 1;
            int vRow = 0;

            if (aRadioGroup.Propertys.Count > 0)
            {
                foreach (KeyValuePair <string, string> keyValuePair in aRadioGroup.Propertys)
                {
                    dgvRadioGroup.Rows[vRow].Cells[0].Value = keyValuePair.Key;
                    dgvRadioGroup.Rows[vRow].Cells[1].Value = keyValuePair.Value;
                    vRow++;
                }
            }

            dgvItem.RowCount = aRadioGroup.Items.Count + 1;
            vRow             = 0;
            foreach (HCRadioButton vItem in aRadioGroup.Items)
            {
                dgvItem.Rows[vRow].Cells[0].Value = vItem.Text;
                dgvItem.Rows[vRow].Cells[1].Value = vItem.TextValue;
                vRow++;
            }

            this.ShowDialog();
            if (this.DialogResult == DialogResult.OK)
            {
                aRadioGroup.AutoSize = cbxAutoSize.Checked;
                if (!cbxAutoSize.Checked)  // 自定义大小
                {
                    int vi = aRadioGroup.Width;
                    if (int.TryParse(tbxWidth.Text, out vi))
                    {
                        aRadioGroup.Width = vi;
                    }

                    vi = aRadioGroup.Height;
                    if (int.TryParse(tbxHeight.Text, out vi))
                    {
                        aRadioGroup.Height = vi;
                    }
                }

                if (cbbRadioStyle.SelectedIndex == 0)
                {
                    aRadioGroup.RadioStyle = HCRadioStyle.Radio;
                }
                else
                {
                    aRadioGroup.RadioStyle = HCRadioStyle.CheckBox;
                }

                aRadioGroup.MultSelect  = cbxMulSelect.Checked;
                aRadioGroup.DeleteAllow = cbxDeleteAllow.Checked;

                string vsValue = "";
                aRadioGroup.Propertys.Clear();
                for (int i = 0; i < dgvRadioGroup.RowCount; i++)
                {
                    if (dgvRadioGroup.Rows[i].Cells[0].Value == null)
                    {
                        continue;
                    }

                    if (dgvRadioGroup.Rows[i].Cells[1].Value == null)
                    {
                        vsValue = "";
                    }
                    else
                    {
                        vsValue = dgvRadioGroup.Rows[i].Cells[1].Value.ToString();
                    }

                    if (dgvRadioGroup.Rows[i].Cells[0].Value.ToString().Trim() != "")
                    {
                        aRadioGroup.Propertys.Add(dgvRadioGroup.Rows[i].Cells[0].Value.ToString(), vsValue);
                    }
                }

                aRadioGroup.Items.Clear();
                for (int i = 0; i < dgvItem.RowCount; i++)
                {
                    if (dgvItem.Rows[i].Cells[0].Value == null)
                    {
                        continue;
                    }

                    if (dgvItem.Rows[i].Cells[1].Value == null)
                    {
                        vsValue = "";
                    }
                    else
                    {
                        vsValue = dgvItem.Rows[i].Cells[1].Value.ToString();
                    }

                    if (dgvItem.Rows[i].Cells[0].Value.ToString().Trim() != "")
                    {
                        aRadioGroup.AddItem(dgvItem.Rows[i].Cells[0].Value.ToString(), vsValue);
                    }
                }

                aHCView.BeginUpdate();
                try
                {
                    aHCView.ActiveSection.ReFormatActiveItem();
                }
                finally
                {
                    aHCView.EndUpdate();
                }
            }
        }