MichaelVinther Posted February 18, 2015 Share Posted February 18, 2015 Is it in any was possible to control the progress bar or make your own in a PropertyBasedEffect? I have an effect where I need to do some time consuming pre-processing before I can deliver the first pixel but after that the rest can be delivered in no time. This means that the default progress bar based on the calls to OnRender will stall at 0% for some a long time and then immediately go to 100% which is not very useful. If this is not possible then I would suggest that if the effect sets EffectFlags.SingleRenderCall then PDN would just show the standard indeterminate progress bar while it is processing as it has no progress info anyway. Quote Michael Vinther Link to comment Share on other sites More sharing options...
Rick Brewster Posted February 18, 2015 Share Posted February 18, 2015 Nope, you can't control the progress bar directly. 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 February 18, 2015 Share Posted February 18, 2015 With a custom Winform UI you can have your own progress bar. Planetoid uses an animation as a progress bar. Most of TechnoRobbo's plugins have custom progress bars too. 2 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...
BoltBait Posted February 19, 2015 Share Posted February 19, 2015 I have a plugin that I think does what you want. Try using my Effects > Steganography > Encode from file: http://forums.getpaint.net/index.php?/topic/4786- When you click the browse button and choose a file, a progress bar shows. Is that what you want? If so, here's what the code looks like: public static Bitmap Process(Bitmap image) { using (Form form = new Form()) { // Show a popup loading bar because processing is sooooo slow. form.Text = "Loading image..."; form.AutoSize = true; form.AutoSizeMode = AutoSizeMode.GrowAndShrink; form.FormBorderStyle = FormBorderStyle.FixedToolWindow; form.ShowInTaskbar = false; form.StartPosition = FormStartPosition.CenterScreen; ProgressBar progress = new ProgressBar(); progress.Location = new System.Drawing.Point(5, 5); progress.Width = 252; progress.Minimum = 0; progress.Value = 0; progress.Maximum = image.Height + 1; form.Controls.Add(progress); form.Show(); Bitmap resultBitmap = new Bitmap(image.Width, image.Height); for (int y = 0; y < image.Height; y++) { progress.Value = y + 1; // update the progress bar for (int x = 0; x < image.Width; x++) { // Do your processing here, etc. } } form.Close(); // hide progress bar return resultBitmap; } } 1 Quote Download: BoltBait's Plugin Pack | CodeLab | and a Free Computer Dominos Game Link to comment Share on other sites More sharing options...
MichaelVinther Posted February 21, 2015 Author Share Posted February 21, 2015 (edited) Thanks for the code. I was hoping to be able to use PDN's standard progress bar but since that is not possible I'll use your solution. By the way, I found that it looks better if the progress form does not take focus and cause PDN do be displayed as inactive. That can be achieved by making the form like this: class ProgressForm : Form { protected override bool ShowWithoutActivation { get { return true; } } } ... using (Form form = new ProgressForm()) Edited February 21, 2015 by MichaelVinther 2 Quote Michael Vinther Link to comment Share on other sites More sharing options...
BoltBait Posted February 21, 2015 Share Posted February 21, 2015 Glad I could help. You may want to change the start position to CenterParent instead of CenterScreen. Thanks for the code. If I ever touch that plugin again I'll fix it up as you suggest. Quote Download: BoltBait's Plugin Pack | CodeLab | and a Free Computer Dominos Game 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.