コード例 #1
0
        /// <summary>
        /// 获取设计器的预览框
        /// </summary>
        //public WebBrowser WebBrowser
        //{
        //    get { return previewBrowser; }
        //}

        #endregion

        #region 构造函数与Form的初始化

        /// <summary>
        /// 页面片设计器
        /// </summary>
        public MdiSnipDesignerForm(string tmpltID, string snipID)
        {
            ///赋初值
            ///
            _snipId  = snipID;
            _tmpltID = tmpltID;

            InitializeComponent();

            ///从所属的模板窗体里获取当前页面片的XmlElement。
            _ownerTmpltForm = Service.Workbench.GetWorkDocumentById(tmpltID, WorkDocumentType.TmpltDesigner) as MdiTmpltDesignForm;
            if (_ownerTmpltForm == null)
            {
                Debug.Fail("此页面片对应的模板窗口不存在。");
                return;
            }

            ///通过所属的模板窗口和传入的SnipID,获得SnipXmlElement
            SnipElement = _ownerTmpltForm.TmpltDoc.GetSnipElementById(_snipId);

            ///通过SnipXmlElement创建DesignerPanel(DesignerPanel构造函数将创建SnipPageDesigner)
            this._designerPanel = new DesignerPanel(_ownerTmpltForm.TmpltDoc.HasAutoKeyWordsSequenceType);

            this._designerPanel.BackColor = SoftwareOption.SnipDesigner.FormBackColor;// System.Drawing.Color.DarkGray;
            this._designerPanel.Dock      = System.Windows.Forms.DockStyle.Fill;
            this._designerPanel.Location  = new System.Drawing.Point(0, 0);
            this._designerPanel.Name      = "workPanel";
            this._designerPanel.Size      = new System.Drawing.Size(747, 528);
            this._designerPanel.TabIndex  = 0;
            this._designerPanel.Text      = "designerPanel1";

            this.SnipPageDesigner.MouseDoubleClick     += new MouseEventHandler(SnipPageDesigner_MouseDoubleClick);
            this.SnipPageDesigner.SelectedPartsChanged += new EventHandler(SnipPageDesigner_SelectedPartsChanged);

            this.Controls.Add(this._designerPanel);

            ///导航栏的初始化
            this.BottomNavigation                = new NavigationStrip();
            this.BottomNavigation.Dock           = DockStyle.Bottom;
            this.BottomNavigation.NavigateTarget = this.SnipPageDesigner;
            this.Controls.Add(this.BottomNavigation);

            this.ShowIcon = true;
            this.Icon     = Icon.FromHandle(ResourceService.GetResourceImage("tree.img.SnipPage2").GetHicon());

            _timer.Interval = 100;
            _timer.Tick    += new EventHandler(_timer_Tick);

            SnipPageDesigner.Load(SnipElement);
            Text = SnipPageDesigner.Text;
            SnipPageDesigner.DesignerReseted += new EventHandler(SnipPageDesigner_DesignerReseted);
            SnipPageDesigner.PartsLayouted   += new EventHandler(SnipPageDesigner_PartsLayouted);
            this.SizeChanged += new EventHandler(MdiSnipDesignerForm_SizeChanged);

            // add by fenggy 2006-06-13 增加处理PART定位的函数
            SdsiteXmlDocument.OrientationPart += new EventHandler <EventArgs <string[]> >(SdsiteXmlDocument_OrientationPart);

            // add by fenggy 2006-06-17 更改FORM的TEXT
            SdsiteXmlDocument.SnipDesignerFormTextChange += new EventHandler <EventArgs <string[]> >(SdsiteXmlDocument_SnipDesignerFormTextChange);
        }
コード例 #2
0
        /// <summary>
        /// 根据样式名显示当前的样式
        /// </summary>
        /// <param name="p"></param>
        private void DisplayStyle()
        {
            if (_currenDoc == null)
            {
                return;
            }
            StyleXmlElement styleEle = _currenDoc.StyleElement;

            if (styleEle == null)
            {
                _designerIsNull = true;
                return;
            }
            Designer.Load(styleEle);
            _designerIsNull = false;
        }