public static ContextMenuStrip CreatePickerMenu(bool addDynamics, ISurface surface, ICaptureDetails captureDetails, IEnumerable <IDestination> destinations) { ContextMenuStrip menu = new ContextMenuStrip(); menu.Closing += delegate(object source, ToolStripDropDownClosingEventArgs eventArgs) { LOG.DebugFormat("Close reason: {0}", eventArgs.CloseReason); if (eventArgs.CloseReason != ToolStripDropDownCloseReason.ItemClicked && eventArgs.CloseReason != ToolStripDropDownCloseReason.CloseCalled) { eventArgs.Cancel = true; } }; foreach (IDestination destination in destinations) { // Fix foreach loop variable for the delegate ToolStripMenuItem item = destination.GetMenuItem(addDynamics, delegate(object sender, EventArgs e) { ToolStripMenuItem toolStripMenuItem = sender as ToolStripMenuItem; if (toolStripMenuItem == null) { return; } IDestination clickedDestination = (IDestination)toolStripMenuItem.Tag; if (clickedDestination == null) { return; } // Make sure the menu is closed menu.Close(); bool result = clickedDestination.ExportCapture(true, surface, captureDetails); // TODO: Find some better way to detect that we exported to the editor if (!EditorDestination.DESIGNATION.Equals(clickedDestination.Designation) || result == false) { LOG.DebugFormat("Disposing as Destination was {0} and result {1}", clickedDestination.Description, result); // Cleanup surface surface.Dispose(); } } ); if (item != null) { menu.Items.Add(item); } } // Close menu.Items.Add(new ToolStripSeparator()); ToolStripMenuItem closeItem = new ToolStripMenuItem(Language.GetString(LangKey.editor_close)); closeItem.Image = ((System.Drawing.Image)(new System.ComponentModel.ComponentResourceManager(typeof(ImageEditorForm)).GetObject("closeToolStripMenuItem.Image"))); closeItem.Click += delegate { // This menu entry is the close itself, we can dispose the surface menu.Close(); // Dispose as the close is clicked surface.Dispose(); }; menu.Items.Add(closeItem); return(menu); }
protected override void Dispose(bool disposing) { ClearObjects(); selectionBorderL.Dispose(); selectionBorderR.Dispose(); base.Dispose(disposing); }
public void RemoveDocumentWorkspace(DocumentWorkspace removeMe) { this.VerifyThreadAccess(); removeMe.CompositionUpdated -= new EventHandler(this.OnWorkspaceCompositionUpdated); if (this.selectedDocument == removeMe) { this.selectedDocument = null; } removeMe.DocumentChanging -= new ValueEventHandler <Document>(this.OnWorkspaceDocumentChanging); removeMe.DocumentChanged -= new EventHandler(this.OnWorkspaceDocumentChanged); if (removeMe.Document != null) { removeMe.Document.DirtyChanged -= new EventHandler(this.OnDocumentDirtyChanged); } this.documents.Remove(removeMe); this.thumbnailManager.RemoveFromQueue(removeMe); ImageStrip.Item item = this.dw2button[removeMe]; base.RemoveItem(item); this.dw2button.Remove(removeMe); this.documentButtons.Remove(item); if (this.thumbs.ContainsKey(removeMe)) { RenderArgs args = this.thumbs[removeMe]; ISurface <ColorBgra> iSurface = args.ISurface; args.Dispose(); this.thumbs.Remove(removeMe); iSurface.Dispose(); } this.OnDocumentListChanged(); }
void DrawSurface() { tk.Begin(); tk.StrokeColor = tk.FillColor = Color.Blue1; tk.DrawRectangle(new Point(400, 200), 300, 200); IContext oldContext = tk.Context; ISurface surface = tk.CreateSurface(200, 200, TestImage); using (IContext surfaceContext = surface.Context) { tk.Context = surfaceContext; tk.StrokeColor = tk.FillColor = Color.Black; tk.FontSize = 16; tk.DrawText(new Point(10, 90), 180, 20, "This is a surface"); tk.FillColor = new Color(0, 0, 0, 0); tk.StrokeColor = Color.Blue; tk.DrawRectangle(new Point(0, 0), 198, 198); tk.Context = oldContext; tk.End(); tk.DrawSurface(surface, new Point(500, 200)); } tk.Begin(); tk.TranslateAndScale(new Point(400, 200), new Point(0.5, 0.5)); tk.DrawSurface(surface); tk.End(); surface.Dispose(); }
protected void ResetBackbuffer() { if (backBufferSurface != null) { backBufferSurface.Dispose(); backBufferSurface = null; } }
protected override void DisposeManagedResources() { base.DisposeManagedResources(); if (backbuffer != null) { backbuffer.Dispose(); } backbuffer = null; }
protected override void Dispose(bool disposing) { base.Dispose(disposing); if (needle != null) { needle.Dispose(); needle = null; } }
protected override void DisposeManagedResources() { base.DisposeManagedResources(); if (needle != null) { needle.Dispose(); needle = null; } TimeNode = null; }
private void CreateTextureAndCleanup(ISurface surface) { IntPtr unsafeHandle = CreateTextureFromSurface(surface); safeHandle = new SafeTextureHandle(unsafeHandle); // We are done with the in memory surface surface.Dispose(); QueryTexture(unsafeHandle); }
protected override void Dispose(bool disposing) { if (disposing) { if (backbuffer != null) { backbuffer.Dispose(); } backbuffer = null; } base.Dispose(disposing); }
private void InitializeSurface(ref ISurface surface, IImageRead image) { surface?.Dispose(); surface = _drawing?.CreateSurface(image); }
/// <summary> /// This method will create and show the destination picker menu /// </summary> /// <param name="addDynamics">Boolean if the dynamic values also need to be added</param> /// <param name="surface">The surface which can be exported</param> /// <param name="captureDetails">Details for the surface</param> /// <param name="destinations">The list of destinations to show</param> /// <returns></returns> public ExportInformation ShowPickerMenu(bool addDynamics, ISurface surface, ICaptureDetails captureDetails, IEnumerable<IDestination> destinations) { // Generate an empty ExportInformation object, for when nothing was selected. ExportInformation exportInformation = new ExportInformation(Designation, Language.GetString("settings_destination_picker")); ContextMenuStrip menu = new ContextMenuStrip(); menu.ImageScalingSize = configuration.IconSize; menu.Tag = null; menu.Closing += delegate(object source, ToolStripDropDownClosingEventArgs eventArgs) { LOG.DebugFormat("Close reason: {0}", eventArgs.CloseReason); switch (eventArgs.CloseReason) { case ToolStripDropDownCloseReason.AppFocusChange: if (menu.Tag == null) { // Do not allow the close if the tag is not set, this means the user clicked somewhere else. eventArgs.Cancel = true; } else { LOG.DebugFormat("Letting the menu 'close' as the tag is set to '{0}'", menu.Tag); } break; case ToolStripDropDownCloseReason.ItemClicked: case ToolStripDropDownCloseReason.CloseCalled: // The ContextMenuStrip can be "closed" for these reasons. break; case ToolStripDropDownCloseReason.Keyboard: // Dispose as the close is clicked if (!captureDetails.HasDestination("Editor")) { surface.Dispose(); surface = null; } break; default: eventArgs.Cancel = true; break; } }; menu.MouseEnter += delegate(object source, EventArgs eventArgs) { // in case the menu has been unfocused, focus again so that dropdown menus will still open on mouseenter if(!menu.ContainsFocus) menu.Focus(); }; foreach (IDestination destination in destinations) { // Fix foreach loop variable for the delegate ToolStripMenuItem item = destination.GetMenuItem(addDynamics, menu, delegate(object sender, EventArgs e) { ToolStripMenuItem toolStripMenuItem = sender as ToolStripMenuItem; if (toolStripMenuItem == null) { return; } IDestination clickedDestination = (IDestination)toolStripMenuItem.Tag; if (clickedDestination == null) { return; } menu.Tag = clickedDestination.Designation; // Export exportInformation = clickedDestination.ExportCapture(true, surface, captureDetails); if (exportInformation != null && exportInformation.ExportMade) { LOG.InfoFormat("Export to {0} success, closing menu", exportInformation.DestinationDescription); // close menu if the destination wasn't the editor menu.Close(); // Cleanup surface, only if there is no editor in the destinations and we didn't export to the editor if (!captureDetails.HasDestination("Editor") && !"Editor".Equals(clickedDestination.Designation)) { surface.Dispose(); surface = null; } } else { LOG.Info("Export cancelled or failed, showing menu again"); // Make sure a click besides the menu don't close it. menu.Tag = null; // This prevents the problem that the context menu shows in the task-bar ShowMenuAtCursor(menu); } } ); if (item != null) { menu.Items.Add(item); } } // Close menu.Items.Add(new ToolStripSeparator()); ToolStripMenuItem closeItem = new ToolStripMenuItem(Language.GetString("editor_close")); closeItem.Image = GreenshotResources.getImage("Close.Image"); closeItem.Click += delegate { // This menu entry is the close itself, we can dispose the surface menu.Close(); if (!captureDetails.HasDestination("Editor")) { surface.Dispose(); surface = null; } }; menu.Items.Add(closeItem); ShowMenuAtCursor(menu); return exportInformation; }
/// <summary> /// This method will create and show the destination picker menu /// </summary> /// <param name="addDynamics">Boolean if the dynamic values also need to be added</param> /// <param name="surface">The surface which can be exported</param> /// <param name="captureDetails">Details for the surface</param> /// <param name="destinations">The list of destinations to show</param> /// <returns></returns> public ExportInformation ShowPickerMenu(bool addDynamics, ISurface surface, ICaptureDetails captureDetails, IEnumerable <IDestination> destinations) { // Generate an empty ExportInformation object, for when nothing was selected. ExportInformation exportInformation = new ExportInformation(Designation, Language.GetString("settings_destination_picker")); var menu = new ContextMenuStrip { ImageScalingSize = CoreConfig.IconSize, Tag = null, TopLevel = true }; menu.Closing += delegate(object source, ToolStripDropDownClosingEventArgs eventArgs) { Log.DebugFormat("Close reason: {0}", eventArgs.CloseReason); switch (eventArgs.CloseReason) { case ToolStripDropDownCloseReason.AppFocusChange: if (menu.Tag == null) { // Do not allow the close if the tag is not set, this means the user clicked somewhere else. eventArgs.Cancel = true; } else { Log.DebugFormat("Letting the menu 'close' as the tag is set to '{0}'", menu.Tag); } break; case ToolStripDropDownCloseReason.ItemClicked: case ToolStripDropDownCloseReason.CloseCalled: // The ContextMenuStrip can be "closed" for these reasons. break; case ToolStripDropDownCloseReason.Keyboard: // Dispose as the close is clicked if (!captureDetails.HasDestination("Editor")) { surface.Dispose(); surface = null; } break; default: eventArgs.Cancel = true; break; } }; menu.MouseEnter += delegate { // in case the menu has been unfocused, focus again so that dropdown menus will still open on mouseenter if (!menu.ContainsFocus) { menu.Focus(); } }; foreach (IDestination destination in destinations) { // Fix foreach loop variable for the delegate ToolStripMenuItem item = destination.GetMenuItem(addDynamics, menu, delegate(object sender, EventArgs e) { ToolStripMenuItem toolStripMenuItem = sender as ToolStripMenuItem; IDestination clickedDestination = (IDestination)toolStripMenuItem?.Tag; if (clickedDestination == null) { return; } menu.Tag = clickedDestination.Designation; // Export exportInformation = clickedDestination.ExportCapture(true, surface, captureDetails); if (exportInformation != null && exportInformation.ExportMade) { Log.InfoFormat("Export to {0} success, closing menu", exportInformation.DestinationDescription); // close menu if the destination wasn't the editor menu.Close(); // Cleanup surface, only if there is no editor in the destinations and we didn't export to the editor if (!captureDetails.HasDestination("Editor") && !"Editor".Equals(clickedDestination.Designation)) { surface.Dispose(); surface = null; } } else { Log.Info("Export cancelled or failed, showing menu again"); // Make sure a click besides the menu don't close it. menu.Tag = null; // This prevents the problem that the context menu shows in the task-bar ShowMenuAtCursor(menu); } } ); if (item != null) { menu.Items.Add(item); } } // Close menu.Items.Add(new ToolStripSeparator()); ToolStripMenuItem closeItem = new ToolStripMenuItem(Language.GetString("editor_close")) { Image = GreenshotResources.getImage("Close.Image") }; closeItem.Click += delegate { // This menu entry is the close itself, we can dispose the surface menu.Close(); if (!captureDetails.HasDestination("Editor")) { surface.Dispose(); surface = null; } }; menu.Items.Add(closeItem); ShowMenuAtCursor(menu); return(exportInformation); }
protected override void DisposeManagedResources() { base.DisposeManagedResources(); backgroundSurface?.Dispose(); backgroundSurface = null; }
protected override void DisposeManagedResources() { base.DisposeManagedResources(); selectionBorderL?.Dispose(); selectionBorderR?.Dispose(); }
/// <summary> /// This method will create and show the destination picker menu /// </summary> /// <param name="addDynamics">Boolean if the dynamic values also need to be added</param> /// <param name="surface">The surface which can be exported</param> /// <param name="captureDetails">Details for the surface</param> /// <param name="destinations">The list of destinations to show</param> /// <returns></returns> protected ExportInformation ShowPickerMenu(bool addDynamics, ISurface surface, ICaptureDetails captureDetails, IEnumerable <IDestination> destinations) { var menu = new ContextMenuStrip { Tag = null, TopLevel = true }; var dpiHandler = menu.AttachDpiHandler(); var bitmapScaleHandler = BitmapScaleHandler.Create <IDestination>( dpiHandler, (destination, dpi) => destination.GetDisplayIcon(dpi), (bitmap, d) => bitmap.ScaleIconForDisplaying(d)); dpiHandler.OnDpiChanged.Subscribe(dpi => { var width = DpiHandler.ScaleWithDpi(CoreConfiguration.IconSize.Width, dpi); var size = new Size(width, width); menu.ImageScalingSize = size; }); // Generate an empty ExportInformation object, for when nothing was selected. var exportInformation = new ExportInformation("", GreenshotLanguage.SettingsDestinationPicker); menu.Closing += (source, eventArgs) => { Log.Debug().WriteLine("Close reason: {0}", eventArgs.CloseReason); switch (eventArgs.CloseReason) { case ToolStripDropDownCloseReason.AppFocusChange: if (menu.Tag == null) { // Do not allow the close if the tag is not set, this means the user clicked somewhere else. eventArgs.Cancel = true; } else { Log.Debug().WriteLine("Letting the menu 'close' as the tag is set to '{0}'", menu.Tag); } break; case ToolStripDropDownCloseReason.ItemClicked: case ToolStripDropDownCloseReason.CloseCalled: // The ContextMenuStrip can be "closed" for these reasons. break; case ToolStripDropDownCloseReason.Keyboard: // Dispose as the close is clicked if (!captureDetails.HasDestination("Editor")) { surface.Dispose(); surface = null; } break; default: eventArgs.Cancel = true; break; } }; menu.MouseEnter += (sender, args) => { // in case the menu has been unfocused, focus again so that dropdown menus will still open on mouseenter if (!menu.ContainsFocus) { menu.Focus(); } }; foreach (var destination in destinations) { // Fix foreach loop variable for the delegate var item = destination.GetMenuItem(addDynamics, menu, async(sender, e) => { var toolStripMenuItem = sender as ToolStripMenuItem; var clickedDestination = (IDestination)toolStripMenuItem?.Tag; if (clickedDestination == null) { return; } menu.Tag = clickedDestination.Designation; // Export exportInformation = await clickedDestination.ExportCaptureAsync(true, surface, captureDetails); if (exportInformation != null && exportInformation.ExportMade) { Log.Info().WriteLine("Export to {0} success, closing menu", exportInformation.DestinationDescription); // close menu menu.Close(); menu.Dispose(); // Cleanup surface, only if there is no editor in the destinations and we didn't export to the editor if (!captureDetails.HasDestination("Editor") && !"Editor".Equals(clickedDestination.Designation)) { surface.Dispose(); surface = null; } } else { Log.Info().WriteLine("Export cancelled or failed, showing menu again"); // Make sure a click besides the menu don't close it. menu.Tag = null; // This prevents the problem that the context menu shows in the task-bar ShowMenuAtCursor(menu); } }, bitmapScaleHandler ); if (item != null) { menu.Items.Add(item); } } // Close menu.Items.Add(new ToolStripSeparator()); var closeItem = new ToolStripMenuItem(GreenshotLanguage.Close) { Image = GreenshotResources.GetBitmap("Close.Image") }; closeItem.Click += (sender, args) => { // This menu entry is the close itself, we can dispose the surface menu.Close(); menu.Dispose(); // Only dispose if there is a destination which keeps the capture if (captureDetails.HasDestination("Editor")) { return; } surface.Dispose(); surface = null; }; menu.Items.Add(closeItem); ShowMenuAtCursor(menu); return(exportInformation); }
private void OnDispose(Guid key, ISurface surface) { surface?.Dispose(); }
private void DrawToGraphics(Graphics g) { PointF tf4; Size clientSize = base.ClientSize; PointF tf = new PointF((this.position.X * this.dragAreaRect.Width) / ((float)clientSize.Width), (this.position.Y * this.dragAreaRect.Height) / ((float)clientSize.Height)); PointF tf2 = new PointF(((float)clientSize.Width) / 2f, ((float)clientSize.Height) / 2f); PointF tf3 = new PointF(((1f + tf.X) * clientSize.Width) / 2f, ((1f + tf.Y) * clientSize.Height) / 2f); if (((-1f <= tf.X) && (tf.X <= 1f)) && ((-1f <= tf.Y) && (tf.Y <= 1f))) { tf4 = new PointF(((1f + tf.X) * clientSize.Width) / 2f, ((1f + tf.Y) * clientSize.Height) / 2f); } else { tf4 = new PointF(((1f + tf.X) * clientSize.Width) / 2f, ((1f + tf.Y) * clientSize.Height) / 2f); float introduced26 = Math.Abs(tf.X); if (introduced26 > Math.Abs(tf.Y)) { if (tf.X > 0f) { tf4.X = clientSize.Width - 1; tf4.Y = ((1f + (tf.Y / tf.X)) * clientSize.Height) / 2f; } else { tf4.X = 0f; tf4.Y = ((1f - (tf.Y / tf.X)) * clientSize.Height) / 2f; } } else if (tf.Y > 0f) { tf4.X = ((1f + (tf.X / tf.Y)) * clientSize.Width) / 2f; tf4.Y = clientSize.Height - 1; } else { tf4.X = ((1f - (tf.X / tf.Y)) * clientSize.Width) / 2f; tf4.Y = 0f; } } using (g.UseCompositingMode(CompositingMode.SourceCopy)) { g.Clear(this.BackColor); } using (g.UseCompositingMode(CompositingMode.SourceOver)) { SizeInt32 num; Rectangle rectangle; if (this.staticImageUnderlay == null) { goto Label_05A8; } if (this.cachedUnderlay != null) { num = new SizeInt32(this.cachedUnderlay.Width, this.cachedUnderlay.Height); goto Label_052E; } Image reference = this.staticImageUnderlay.Reference; Rectangle srcRect = new Rectangle(0, 0, reference.Width, reference.Height); SizeInt32 num2 = new SizeInt32(Math.Max(1, Math.Min(clientSize.Width - 4, srcRect.Width)), Math.Max(1, Math.Min(clientSize.Height - 4, srcRect.Height))); num = ThumbnailHelpers.ComputeThumbnailSize(reference.Size.ToSizeInt32(), Math.Min(num2.Width, num2.Height)); this.cachedUnderlay = new Bitmap(num.Width, num.Height, PixelFormat.Format24bppRgb); ISurface <ColorBgra> surface = RendererBgra.Checkers(num).ToSurface(); Bitmap image = surface.CreateAliasedGdipBitmap(); Rectangle destRect = new Rectangle(0, 0, this.cachedUnderlay.Width, this.cachedUnderlay.Height); using (Graphics graphics = Graphics.FromImage(this.cachedUnderlay)) { graphics.CompositingMode = CompositingMode.SourceOver; graphics.DrawImage(image, destRect, new Rectangle(0, 0, image.Width, image.Height), GraphicsUnit.Pixel); Bitmap bitmap2 = reference as Bitmap; if ((bitmap2 != null) && (bitmap2.PixelFormat == PixelFormat.Format32bppArgb)) { BitmapData bitmapdata = bitmap2.LockBits(new Rectangle(new Point(0, 0), bitmap2.Size), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); try { using (SharedSurface <ColorBgra> surface2 = new SharedSurface <ColorBgra>(bitmapdata.Scan0, bitmapdata.Width, bitmapdata.Height, bitmapdata.Stride)) { using (ISurface <ColorBgra> surface3 = surface2.ResizeSuperSampling(num).Parallelize <ColorBgra>(TilingStrategy.HorizontalSlices, 3, WorkItemQueuePriority.Normal).ToSurface()) { using (Bitmap bitmap3 = surface3.CreateAliasedGdipBitmap()) { graphics.DrawImage(bitmap3, destRect, surface3.Bounds <ColorBgra>().ToGdipRectangle(), GraphicsUnit.Pixel); goto Label_051A; } } } } finally { bitmap2.UnlockBits(bitmapdata); } } graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; RectangleF ef = RectangleF.Inflate(destRect, 0.5f, 0.5f); graphics.DrawImage(reference, ef, srcRect, GraphicsUnit.Pixel); } Label_051A: image.Dispose(); image = null; surface.Dispose(); surface = null; Label_052E: rectangle = new Rectangle((clientSize.Width - num.Width) / 2, (clientSize.Height - num.Height) / 2, num.Width, num.Height); g.DrawImage(this.cachedUnderlay, rectangle, new Rectangle(0, 0, this.cachedUnderlay.Width, this.cachedUnderlay.Height), GraphicsUnit.Pixel); DropShadow.DrawOutside(g, rectangle, 2); } Label_05A8: using (g.UsePixelOffsetMode(PixelOffsetMode.Half)) { using (g.UseSmoothingMode(SmoothingMode.HighQuality)) { using (Pen pen = (Pen)Pens.Black.Clone()) { pen.SetLineCap(LineCap.Round, LineCap.DiamondAnchor, DashCap.Flat); pen.EndCap = LineCap.ArrowAnchor; pen.Width = 2f; pen.Color = SystemColors.ControlDark; g.DrawLine(pen, tf2, tf4); } using (Pen pen2 = new Pen(Color.White)) { pen2.SetLineCap(LineCap.DiamondAnchor, LineCap.DiamondAnchor, DashCap.Flat); pen2.Width = 3f; pen2.Color = Color.White; g.DrawLine(pen2, tf3.X - 5f, tf3.Y, tf3.X + 5f, tf3.Y); g.DrawLine(pen2, tf3.X, tf3.Y - 5f, tf3.X, tf3.Y + 5f); pen2.Width = 2f; pen2.Color = Color.Black; g.DrawLine(pen2, tf3.X - 5f, tf3.Y, tf3.X + 5f, tf3.Y); g.DrawLine(pen2, tf3.X, tf3.Y - 5f, tf3.X, tf3.Y + 5f); } } } }
public static ContextMenuStrip CreatePickerMenu(bool addDynamics, ISurface surface, ICaptureDetails captureDetails, IEnumerable<IDestination> destinations) { ContextMenuStrip menu = new ContextMenuStrip(); menu.Closing += delegate(object source, ToolStripDropDownClosingEventArgs eventArgs) { LOG.DebugFormat("Close reason: {0}", eventArgs.CloseReason); if (eventArgs.CloseReason != ToolStripDropDownCloseReason.ItemClicked && eventArgs.CloseReason != ToolStripDropDownCloseReason.CloseCalled) { eventArgs.Cancel = true; } }; foreach (IDestination destination in destinations) { // Fix foreach loop variable for the delegate ToolStripMenuItem item = destination.GetMenuItem(addDynamics, delegate(object sender, EventArgs e) { ToolStripMenuItem toolStripMenuItem = sender as ToolStripMenuItem; if (toolStripMenuItem == null) { return; } IDestination clickedDestination = (IDestination)toolStripMenuItem.Tag; if (clickedDestination == null) { return; } // Make sure the menu is closed menu.Close(); bool result = clickedDestination.ExportCapture(true, surface, captureDetails); // TODO: Find some better way to detect that we exported to the editor if (!EditorDestination.DESIGNATION.Equals(clickedDestination.Designation) || result == false) { LOG.DebugFormat("Disposing as Destination was {0} and result {1}", clickedDestination.Description, result); // Cleanup surface surface.Dispose(); } } ); if (item != null) { menu.Items.Add(item); } } // Close menu.Items.Add(new ToolStripSeparator()); ToolStripMenuItem closeItem = new ToolStripMenuItem(Language.GetString(LangKey.editor_close)); closeItem.Image = ((System.Drawing.Image)(new System.ComponentModel.ComponentResourceManager(typeof(ImageEditorForm)).GetObject("closeToolStripMenuItem.Image"))); closeItem.Click += delegate { // This menu entry is the close itself, we can dispose the surface menu.Close(); // Dispose as the close is clicked surface.Dispose(); }; menu.Items.Add(closeItem); return menu; }
private void OnResourceTilesetUnload(string fileName, ISurface surface) { surface?.Dispose(); }
public void Dispose() { _surfaceFont?.Dispose(); _surfaceFont2?.Dispose(); _surfaceIcon?.Dispose(); }