Ejemplo n.º 1
0
        /// <summary> 按键按压 </summary>
        /// <param name="e">按键信息</param>
        protected override void OnKeyPress(KeyPressEventArgs e)
        {
            if (HC.View.HC.IsKeyPressWant(e))
            {
                if (CanNotEdit())
                {
                    return;
                }

                if (FTrace)
                {
                    HCCustomData vData = this.ActiveSectionTopLevelData();
                    if (vData.SelectInfo.StartItemNo < 0)
                    {
                        return;
                    }

                    if (vData.SelectExists())
                    {
                        this.DisSelect();
                    }
                    else
                    {
                        InsertEmrTraceItem(e.KeyChar.ToString());
                    }

                    return;
                }

                base.OnKeyPress(e);
            }
        }
Ejemplo n.º 2
0
        private void mniDeleteProtect_Click(object sender, EventArgs e)
        {
            HCCustomData vTopData = FEmrView.ActiveSectionTopLevelData();

            if (vTopData.SelectExists())
            {
                string vS = vTopData.GetSelectText();
                vS = vS.Replace("\n", "").Replace("\t", "").Replace("\r", "");
                DeItem vDeItem = FEmrView.NewDeItem(vS);
                vDeItem.EditProtect = true;
                FEmrView.InsertDeItem(vDeItem);
            }
            else
            {
                DeItem vDeItem = vTopData.GetActiveItem() as DeItem;
                if (vDeItem.EditProtect)
                {
                    vDeItem.EditProtect = false;
                    FEmrView.ReAdaptActiveItem();
                }
            }
        }
Ejemplo n.º 3
0
        private void pmHCView_Opening(object sender, CancelEventArgs e)
        {
            if (FHCView.AnnotatePre.ActiveDrawAnnotateIndex >= 0)
            {
                for (int i = 0; i <= pmHCView.Items.Count - 1; i++)
                {
                    pmHCView.Items[i].Visible = false;
                }

                mniModAnnotate.Visible = true;
                mniDelAnnotate.Visible = true;

                return;
            }
            else
            {
                for (int i = 0; i <= pmHCView.Items.Count - 1; i++)
                {
                    pmHCView.Items[i].Visible = true;
                }

                mniModAnnotate.Visible = false;
                mniDelAnnotate.Visible = false;
            }

            HCCustomData vActiveData = FHCView.ActiveSection.ActiveData;
            HCCustomItem vActiveItem = vActiveData.GetActiveItem();

            HCCustomData vTopData = null;
            HCCustomItem vTopItem = vActiveItem;

            while (vTopItem is HCCustomRectItem)
            {
                if ((vTopItem as HCCustomRectItem).GetActiveData() != null)
                {
                    if (vTopData != null)
                    {
                        vActiveData = vTopData;
                        vActiveItem = vTopItem;
                    }

                    vTopData = (vTopItem as HCCustomRectItem).GetTopLevelData();
                    vTopItem = vTopData.GetActiveItem();
                }
                else
                {
                    break;
                }
            }

            if (vTopData == null)
            {
                vTopData = vActiveData;
            }

            mniTable.Enabled = vActiveItem.StyleNo == HCStyle.Table;
            if (mniTable.Enabled)
            {
                HCTableItem vTableItem = vActiveItem as HCTableItem;
                mniInsertRowTop.Enabled    = vTableItem.GetEditCell() != null;
                mniInsertRowBottom.Enabled = mniInsertRowTop.Enabled;
                mniInsertColLeft.Enabled   = mniInsertRowTop.Enabled;
                mniInsertColRight.Enabled  = mniInsertRowTop.Enabled;
                mniSplitRow.Enabled        = mniInsertRowTop.Enabled;
                mniSplitCol.Enabled        = mniInsertRowTop.Enabled;

                mniDeleteCurRow.Enabled = vTableItem.CurRowCanDelete();
                mniDeleteCurCol.Enabled = vTableItem.CurColCanDelete();
                mniMerge.Enabled        = vTableItem.SelectedCellCanMerge();

                if (vTableItem.BorderVisible)
                {
                    mniDisBorder.Text = "隐藏边框";
                }
                else
                {
                    mniDisBorder.Text = "显示边框";
                }
            }

            mniCut.Enabled  = (!FHCView.ActiveSection.ReadOnly && vTopData.SelectExists());
            mniCopy.Enabled = mniCut.Enabled;

            IDataObject vIData = Clipboard.GetDataObject();

            mniPaste.Enabled = ((!FHCView.ActiveSection.ReadOnly) &&
                                ((vIData.GetDataPresent(HC.View.HC.HC_EXT)) ||
                                 (vIData.GetDataPresent(DataFormats.Text)) ||
                                 (vIData.GetDataPresent(DataFormats.Bitmap))
                                ));
            mniControlItem.Visible = ((!FHCView.ActiveSection.ReadOnly) &&
                                      (!vTopData.SelectExists()) &&
                                      (vTopItem is HCControlItem) &&
                                      vTopItem.Active
                                      );
            if (mniControlItem.Visible)
            {
                mniControlItem.Text = "属性(" + (vTopItem as HCControlItem).GetType().Name + ")";
            }
        }
Ejemplo n.º 4
0
        private void pmView_Opening(object sender, CancelEventArgs e)
        {
            HCCustomData vActiveData = FEmrView.ActiveSection.ActiveData;
            HCCustomItem vActiveItem = vActiveData.GetActiveItem();

            HCCustomData vTopData = null;
            HCCustomItem vTopItem = vActiveItem;

            while (vTopItem is HCCustomRectItem)
            {
                if ((vTopItem as HCCustomRectItem).GetActiveData() != null)
                {
                    if (vTopData != null)
                    {
                        vActiveData = vTopData;
                        vActiveItem = vTopItem;
                    }

                    vTopData = (vTopItem as HCCustomRectItem).GetActiveData();
                    vTopItem = vTopData.GetActiveItem();
                }
                else
                {
                    break;
                }
            }

            if (vTopData == null)
            {
                vTopData = vActiveData;
            }

            mniTable.Enabled = vActiveItem.StyleNo == HCStyle.Table;
            if (mniTable.Enabled)
            {
                DeTable vTable = vActiveItem as DeTable;
                mniInsertRowTop.Enabled    = vTable.GetEditCell() != null;
                mniInsertRowBottom.Enabled = mniInsertRowTop.Enabled;
                mniInsertColLeft.Enabled   = mniInsertRowTop.Enabled;
                mniInsertColRight.Enabled  = mniInsertRowTop.Enabled;
                mniSplitRow.Enabled        = mniInsertRowTop.Enabled;
                mniSplitCol.Enabled        = mniInsertRowTop.Enabled;

                mniDeleteCurRow.Enabled = vTable.CurRowCanDelete();
                mniDeleteCurCol.Enabled = vTable.CurColCanDelete();
                mniMerge.Enabled        = vTable.SelectedCellCanMerge();
            }

            mniCut.Enabled  = (!FEmrView.ActiveSection.ReadOnly) && vTopData.SelectExists();
            mniCopy.Enabled = mniCut.Enabled;

            IDataObject vIData = Clipboard.GetDataObject();

            mniPaste.Enabled = ((!(vTopData as HCRichData).ReadOnly) &&
                                ((vIData.GetDataPresent(HC.View.HC.HC_EXT)) ||
                                 vIData.GetDataPresent(DataFormats.Text) ||
                                 (vIData.GetDataPresent(DataFormats.Bitmap))));

            mniControlItem.Visible = ((!(vTopData as HCRichData).ReadOnly) && (!vTopData.SelectExists()) &&
                                      (vTopItem is HCControlItem) && (vTopItem.Active));
            if (mniControlItem.Visible)
            {
                mniControlItem.Text = "属性(" + (vTopItem as HCControlItem).GetType().Name + ")";
            }

            mniDeItem.Visible        = false;
            mniDeleteProtect.Visible = false;

            if (vTopItem is DeItem)
            {
                if ((vTopItem as DeItem).IsElement)
                {
                    mniDeItem.Visible = true;
                    mniDeItem.Text    = (vTopItem as DeItem)[DeProp.Name];
                }

                if (FEmrView.DesignModeEx)  // 文档设计模式
                {
                    if (vTopData.SelectExists())
                    {
                        mniDeleteProtect.Text    = "只读";
                        mniDeleteProtect.Visible = true;
                    }
                    else
                    if ((vTopItem as DeItem).EditProtect)
                    {
                        mniDeleteProtect.Text    = "取消只读";
                        mniDeleteProtect.Visible = true;
                    }
                }
            }

            if ((vTopData as HCViewData).ActiveDomain.BeginNo >= 0)
            {
                mniDeGroup.Visible = true;
                mniDeGroup.Text    = (vTopData.Items[(vTopData as HCViewData).ActiveDomain.BeginNo] as DeGroup)[DeProp.Name];
            }
            else
            {
                mniDeGroup.Visible = false;
            }

            mniSplit.Visible = mniControlItem.Visible || mniDeItem.Visible || mniDeGroup.Visible;
        }