/// <include file='doc\StyleBuilderPage.uex' path='docs/doc[@for="StyleBuilderPage.ActivatePage"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> protected virtual void ActivatePage() { if (uiCreated == false) { uiCreated = true; // first set up the font appropriately ISite site = Site; if (site != null) { StyleBuilderSite builderSite = (StyleBuilderSite)site.GetService(typeof(StyleBuilderSite)); Font = builderSite.GetUIFont(); } // allow the page to create its ui CreateUI(); if (!autoScaleBaseSize.IsEmpty) { // now apply the scaling ratio to resize the ui based on the ui font SizeF realSize = Form.GetAutoScaleSize(Font); Size newVar = new Size((int)Math.Round(realSize.Width), (int)Math.Round(realSize.Height)); float percY = ((float)newVar.Height) / ((float)autoScaleBaseSize.Height); float percX = ((float)newVar.Width) / ((float)autoScaleBaseSize.Width); Control.ControlCollection controls = Controls; int controlCount = controls.Count; for (int i = 0; i < controlCount; i++) { controls[i].Scale(percX, percY); } autoScaleBaseSize = Size.Empty; } } Visible = true; if (firstActivate) { Debug.Assert(selectedStyles != null, "Page activated before SetObjects was called"); LoadStyles(); firstActivate = false; } }
/// <include file='doc\StyleBuilderForm.uex' path='docs/doc[@for="StyleBuilderForm.InitForm"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> protected void InitForm() { pageImageList = new ImageList(); pageImageList.ImageSize = new Size(16, 16); defaultImageIndex = pageImageList.Images.Count; using (Icon defaultIcon = new Icon(typeof(StyleBuilderForm), "Empty.ico")) { pageImageList.Images.Add(defaultIcon); } pageSelector = new PageSelector(); pageSelector.TabIndex = 0; pageSelector.ImageList = pageImageList; pageSelector.AfterSelect += new TreeViewEventHandler(this.OnSelChangePageSelector); grayStrip = new Label(); grayStrip.BackColor = SystemColors.ControlDark; grayStrip.TabIndex = 1; grayStrip.TabStop = false; mshtmlControl = new MSHTMLHost(); mshtmlControl.Visible = false; mshtmlControl.TabIndex = 3; mshtmlControl.TabStop = false; mshtmlControl.HandleDestroyed += new EventHandler(this.OnHandleDestroyedMSHTMLControl); Size buttonSize = new Size(UI_BTN_WIDTH, UI_BTN_HEIGHT); okButton = new Button(); okButton.TabIndex = 4; okButton.Text = SR.GetString(SR.SB_OK); okButton.Size = buttonSize; okButton.FlatStyle = FlatStyle.System; okButton.Click += new EventHandler(this.OnClickBtnOK); cancelButton = new Button(); cancelButton.TabIndex = 5; cancelButton.Text = SR.GetString(SR.SB_Cancel); cancelButton.Size = buttonSize; cancelButton.FlatStyle = FlatStyle.System; cancelButton.Click += new EventHandler(this.OnClickBtnCancel); helpButton = new Button(); helpButton.TabIndex = 6; helpButton.Text = SR.GetString(SR.SB_Help); helpButton.Size = buttonSize; helpButton.FlatStyle = FlatStyle.System; helpButton.Click += new EventHandler(this.OnClickBtnHelp); this.Text = SR.GetString(SR.SB_Caption); this.AcceptButton = okButton; this.CancelButton = cancelButton; this.AutoScale = false; this.AutoScaleBaseSize = new Size(5, 14); this.FormBorderStyle = FormBorderStyle.FixedDialog; this.ClientSize = new Size(UI_DEFSIZE_WIDTH, UI_DEFSIZE_HEIGHT); this.MaximizeBox = false; this.MinimizeBox = false; this.ShowInTaskbar = false; this.Font = builderSite.GetUIFont(); this.Icon = null; this.StartPosition = FormStartPosition.CenterParent; this.Controls.Clear(); this.Controls.AddRange(new Control[] { helpButton, cancelButton, okButton, mshtmlControl, grayStrip, pageSelector }); }