Jump to content

CodeLab v6.4 (for advanced users) Released November 20, 2021

Recommended Posts

Here's some commentary for the items that may not be obvious:


Snippet Manager


This can be accessed from the toolbar. The icon for it is on the far right.


Snippets can be shared. They are Imported and Exported in the JSON format.

Here's an example you can import:

  "preRender": "void PreRender(Surface dst, Surface src)\r\n{\r\n    $\r\n}",
  "dw": "Debug.WriteLine($);",
  "curPal": "IReadOnlyList<ColorBgra> currentPalette = Services.GetService<IPalettesService>().CurrentPalette;"


A dollar sign ($) can used to control the placement of the text caret.


RadioButtonControl<TEnum> and ListBoxControlControl<TEnum>


This is kind of a hidden feature, since the UI Designer doesn't generate them for you.  If you want to take advantage of this feature, you just need to know it exists and how to use it.

Here's an example:

#region UICode
RadioButtonControl<Positions> position = Positions.Center; // Image Position|On the Left|In the Center|On the Right

enum Positions

void Render(Surface dst, Surface src, Rectangle rect)
    switch (position)
        case Positions.Left:
            // Code Here
        case Positions.Center:
            // Code Here
        case Positions.Right:
            // Code Here

    dst.CopySurface(src, rect.Location, rect);


Q. Doesn't this just add more code to my plugin, since it now has to include an extra Enum and the RadioButtonControl<TEnum> generic class?

A. No.

1) CodeLab would have to generated an Enum behind-the-scenes anyway. Your user-defined Enum negates the need for CodeLab to generate one.

2) A RadioButtonControl<TEnum> generic class doesn't exist. This is implemented as "syntax sugar". When the code is compiled, RadioButtonControl<> is stripped away leaving just your enum.


Argument Constraints for Generics in Tooltips


Not too many of the Generics you see in CodeLab have constraints, so here's a screenshot:



Edited by toe_head2001
  • Upvote 3
Link to comment
Share on other sites

Excellent update! Thanks guys.


I have to say I'm also a BIG fan of the icon in the installer! It looks great!

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...

CodeLab 5.0 Released

This is only for Paint.NET 4.2+!


HUGE update today...


▪ Added TXT file support (toe_head2001)
▪ Added File Type plugin development support (toe_head2001)
▪ Added Shape (xaml) editing support (toe_head2001)
▪ File New Templates completely rewritten to allow multi-effect pipeline (BoltBait)
▪ Lots of bug fixes, refactorings, and optimizations

Grab the CodeLab DLL here:





How to access the new features we added to CodeLab:



New Effect screen:



It is now possible to string together as many Effects, Pixel Ops, Blend Modes, Surface Fills, and Surface Copies as you want. CodeLab will then write the code for you to combine all this into an effect.


Now, we understand that this is going to lead to an explosion of new plugins that just throw everything together into one UI.  As mods, we will be reviewing plugins posted in the Plugin Forum and deleting those that just aren't up to standards.  We don't want to discourage everyone from making their own plugins for their own machine. But, let's keep the quality up in our plugin forum. (Remember, noobs should be using plugins, not writing them.)


New Shape screen:



This is not an inclusion of the Shape Maker plugin. This is simply an editor for the actual .xaml shape files that Paint.NET uses.

It includes syntax highlighting and code completion.  CodeLab is now a complete replacement for the KAXAML editor in this tutorial.



Editing text files (nothing special, no syntax highlighting, just a place to keep notes, etc.):




Designing and Implementing File Type Plugins:




And, with this release, MY wish list for CodeLab is complete.


Enjoy! 😎 :beer: 


  • Like 2
  • Upvote 4

Click to play:
Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game

Link to comment
Share on other sites

  • BoltBait changed the title to CodeLab v5.0 (for advanced users) Released January 9, 2020
27 minutes ago, ReMake said:

we have another error


Yes we do!


Thanks, I will fix it right now.


Keep looking for errors!  When I rewrote the File New screen it was over 2,000 lines of all new code. So, finding an error or two in that section is not surprising.

Click to play:
Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game

Link to comment
Share on other sites

Codelab has had an astonishing overhaul. BoltBait and toe_head2001 have made an awesome tool into something quite incredible.


I still want them to write a book on it....

  • Like 1
Link to comment
Share on other sites

Working title  "learn to code in C# using...Codelab and paint.net!" :mrgreen:


Link to comment
Share on other sites

7 hours ago, Ego Eram Reputo said:

Working title  "learn to code in C# using...Codelab and paint.net!" :mrgreen:


I'd read it @BoltBait


Link to comment
Share on other sites

1 hour ago, anon3 said:

The new version removed the ability to open a file and build a dll. Now the only way to do it is to copy the file content into the editor and save it to a file to be allowed to build a dll, preview the plugin and etc.


It works for me.  Can you give the specific steps that demonstrate the issue?


1 hour ago, anon3 said:

Is there possibility to be added character for identation and space width of it (like 1 tab with width of 2 spaces)?


A tab width of 2 spaces instead of 4 spaces?  Yes, it would be very easy to add that option.


1 hour ago, anon3 said:

Could you add ability to save the dll directly and to a directory instead to zipping it to the desktop?


Possible? Yes.

Please explain why you would want to do that.


1 hour ago, anon3 said:

Can you allow reloading of a tab if you edit it from outside the editor, because now reopening it will cause a creation of a new tab?




1 hour ago, anon3 said:

The last one is a bit tricky probably, but I see the generated code in the region "User Entered Code". Can you add ability to see the full source in the editor and directly change it. It can be done easily with user regions inside the generated code or vice versa.


Absolutely not. That would defeat the purpose of using CodeLab. If you want the full source code, you should be using Visual Studio.

Link to comment
Share on other sites

Thank you for giving us this great tool for free!


Another useful thing would be, in my opinion, the insertion of a space after a comma when formatting the code.


For example the next line:

using (Pen pen = new Pen(Color.FromArgb(80,0,0,255)))

it will look like this:

using (Pen pen = new Pen(Color.FromArgb(80, 0, 0, 255)))




Link to comment
Share on other sites

  • BoltBait changed the title to CodeLab v6.3 (for advanced users) Released September 27, 2021
  • Rick Brewster changed the title to CodeLab v6.4 (for advanced users) Released November 20, 2021

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...