private void Activate() { Debug.Assert(this.active != true, "already active!"); this.active = true; this.handCursor = new Cursor(PdnResources.GetResourceStream("Cursors.PanToolCursor.cur")); this.handCursorMouseDown = new Cursor(PdnResources.GetResourceStream("Cursors.PanToolCursorMouseDown.cur")); this.handCursorInvalid = new Cursor(PdnResources.GetResourceStream("Cursors.PanToolCursorInvalid.cur")); this.panTracking = false; this.panMode = false; this.mouseDown = 0; this.savedTiles = null; this.saveRegion = null; this.scratchSurface = DocumentWorkspace.BorrowScratchSurface(this.GetType().Name + ": Tool.Activate()"); #if DEBUG this.haveClearedScratch = false; #endif Selection.Changing += new EventHandler(SelectionChangingHandler); Selection.Changed += new EventHandler(SelectionChangedHandler); HistoryStack.ExecutingHistoryMemento += new ExecutingHistoryMementoEventHandler(ExecutingHistoryMemento); HistoryStack.ExecutedHistoryMemento += new ExecutedHistoryMementoEventHandler(ExecutedHistoryMemento); HistoryStack.FinishedStepGroup += new EventHandler(FinishedHistoryStepGroup); this.trackingNub = new MoveNubRenderer(this.RendererList); this.trackingNub.Visible = false; this.trackingNub.Size = new SizeF(10, 10); this.trackingNub.Shape = MoveNubShape.Compass; this.RendererList.Add(this.trackingNub, false); OnActivate(); }
public void LoadIcons() { Type ourType = this.GetType(); FieldInfo[] fields = ourType.GetFields(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly); foreach (FieldInfo fi in fields) { if (fi.FieldType.IsSubclassOf(typeof(PdnMenuItem)) || fi.FieldType == typeof(PdnMenuItem)) { string iconFileName = "Icons." + fi.Name[0].ToString().ToUpper() + fi.Name.Substring(1) + "Icon.png"; PdnMenuItem mi = (PdnMenuItem)fi.GetValue(this); Stream iconStream = PdnResources.GetResourceStream(iconFileName); if (iconStream != null) { iconStream.Dispose(); mi.SetIcon(iconFileName); } else { Tracing.Ping(iconFileName + " not found"); } } } this.iconsLoaded = true; }
public AboutDialog() { // // Required for Windows Form Designer support // InitializeComponent(); this.richCreditsBox.BackColor = SystemColors.Window; string textFormat = PdnResources.GetString("AboutDialog.Text.Format"); this.Text = string.Format(textFormat, PdnInfo.GetBareProductName()); this.pdnBanner.BannerText = string.Empty;// PdnInfo.GetFriendlyVersionString(); this.richCreditsBox.LoadFile(PdnResources.GetResourceStream("Files.AboutCredits.rtf"), RichTextBoxStreamType.RichText); this.copyrightLabel.Text = PdnInfo.GetCopyrightString(); this.Icon = PdnInfo.AppIcon; this.okButton.Text = PdnResources.GetString("Form.OkButton.Text"); this.okButton.Location = new Point((this.ClientSize.Width - this.okButton.Width) / 2, this.okButton.Top); this.creditsLabel.Text = PdnResources.GetString("AboutDialog.CreditsLabel.Text"); Font bannerFont = this.pdnBanner.BannerFont; Font newBannerFont = Utility.CreateFont(bannerFont.Name, 8.0f, bannerFont.Style); this.pdnBanner.BannerFont = newBannerFont; newBannerFont.Dispose(); bannerFont.Dispose(); this.versionLabel.Text = PdnInfo.GetFullAppName(); }