geist_ Posted January 6 Share Posted January 6 // Name: // Submenu: // Author: // Title: // Version: // Desc: // Keywords: // URL: // Help: #region UICode #endregion class MyForm : Form { public MyForm() { this.InitializeComponent(); } System.ComponentModel.IContainer components = null; protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } private void InitializeComponent() { //UI stuff this.components = new System.ComponentModel.Container(); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(800, 450); this.Text = "MyForm"; } } void Render(Surface dst, Surface src, Rectangle rect) { global::System.Windows.Forms.Application.EnableVisualStyles(); global::System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false); global::System.Windows.Forms.Application.SetHighDpiMode(HighDpiMode.SystemAware); Application.Run(new MyForm()); } Tried it like this, and it works only the first 3-4 times you call the effect, after the 3-4 time, paint.net crashes the it displays the following exception: Quote Exception details: System.InvalidOperationException: SetCompatibleTextRenderingDefault must be called before the first IWin32Window object is created in the application. In the code above I am calling Application.SetCompatibleTextRenderingDefault() before i call Application.Run, so why is it not working if you keep using the effect more than 3 or 4 times? I am running this in a Single Render Call effect plugin Quote the usual Link to comment Share on other sites More sharing options...
midora Posted January 6 Share Posted January 6 Your are developing a plugin and not an application. Derive you effect plugin from PaintDotNet.Effects.Effect and override CreateConfigDialog. There you should return a new dialog derived from EffectConfigDialog. This is the dialog you can populate with your own controls. 1 Quote Link to comment Share on other sites More sharing options...
Rick Brewster Posted January 6 Share Posted January 6 What @midora said. Those calls into System.Windows.Forms.Application are not for plugin use. Paint.NET already configures those at application startup. You do not use Application.Run() in a plugin. Paint.NET calls your CreateConfigDialog() method and then displays the Form you return. 1 Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to comment Share on other sites More sharing options...
Ego Eram Reputo Posted January 7 Share Posted January 7 Seen these? I'm not sure if @toe_head2001 is maintaining them, but they are a great starting point to creating effects with a custom UI. 1 Quote ebook: Mastering Paint.NET | resources: Plugin Index | Stereogram Tut | proud supporter of Codelab plugins: EER's Plugin Pack | Planetoid | StickMan | WhichSymbol+ | Dr Scott's Markup Renderer | CSV Filetype | dwarf horde plugins: Plugin Browser | ShapeMaker Link to comment Share on other sites More sharing options...
toe_head2001 Posted January 7 Share Posted January 7 57 minutes ago, Ego Eram Reputo said: I'm not sure if @toe_head2001 is maintaining them They haven't been updated in a long time. It's been a low priority. And they need to be rewritten for the brand new Effect system in Paint.NET 5. 2 Quote My Gallery | My Plugin Pack Layman's Guide to CodeLab Link to comment Share on other sites More sharing options...
geist_ Posted January 11 Author Share Posted January 11 On 1/7/2023 at 5:13 AM, Ego Eram Reputo said: Seen these? I'm not sure if @toe_head2001 is maintaining them, but they are a great starting point to creating effects with a custom UI. Thank you! This is exactly what I needed, I have been struggling til now to get ConfigDialog and ConfigToken to work. Quote the usual Link to comment Share on other sites More sharing options...
Foxxey Posted May 13 Share Posted May 13 On 1/7/2023 at 5:15 AM, toe_head2001 said: They haven't been updated in a long time. It's been a low priority. And they need to be rewritten for the brand new Effect system in Paint.NET 5. Hello! Is there any update on this? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.