Rick Brewster

CodeLab v4.2 (for advanced users) Released March 18, 2019

Recommended Posts

Hi @BoltBait, You should take some rest, Changes between Codelab 3.0 & 2.x is as drastic as between pdn 3.x and 4.0. I have a question how to use radio button from codelab.

Also, can you help how to use radio button, when there are more and one options. This time I did it using if-else since it was only two option, but can you explain how more options can be included in coding.

Share this post


Link to post
Share on other sites
5 minutes ago, Pratyush said:

Also, can you help how to use radio button, when there are more and one options. This time I did it using if-else since it was only two option, but can you explain how more options can be included in coding.

 

Use a switch.

switch (Amount3)
{
  case 0:
    // do something cool
    break;
  case 1:
    // do something cooler
    break;    
  case 2:
    // do something more cooler
    break;
  case 3:
    // do the coolest thing
    break;
}
  • Like 1

Share this post


Link to post
Share on other sites
2 minutes ago, toe_head2001 said:

Use a switch.

 

Thanks @toe_head2001. That's exactly what I needed. I was not sure so I simply copied 'Amount3 = 0' from UI on If else block, did my work. I was not sure what to use in switch case i.e. use "case first option, case 2nd option" or was it like "use case 1, case 2 or".

Many thank.

Share this post


Link to post
Share on other sites
On 2/2/2018 at 10:28 AM, BoltBait said:

After working on CodeLab v3.0-3.3 and v1.8f, user toe_head2001 and I are a little burned out on CodeLab development right now.  So, I imagine version 3.3 will live for a while.

 

Lies.

 

I purchased a new laptop last week.  It has a 4K screen which looks amazing.  However, it requires me to run at 200% (minimum, 300% comfortably).  This has uncovered some high DPI issues within CodeLab.

 

I fixed some of those and toe_head2001 is working on the others... plus a cool new feature.

 

So, expect a new build sometime soon.  (This week?)

  • Like 1
  • Upvote 2

Share this post


Link to post
Share on other sites
4 minutes ago, Ego Eram Reputo said:

 

It makes coffee??

 

I'll defer to toe_head2001 to post a screenshot.

  • Upvote 1

Share this post


Link to post
Share on other sites

Concerning variables declared in sequence... I got the variable parser to successfully detect them.

 

It even works on complex cases like this:

PointF selCenter = new PointF
{
    X = selection.Left + selection.Width / 2f,
    Y = selection.Top + selection.Height / 2f
},
VP = new PointF
{
    X = (float)(selCenter.X + Amount4.First * selCenter.X),
    Y = (float)(selCenter.Y + Amount4.Second * selCenter.Y),
};

selCenter and VP both detected, without any false positives. B)

 

@Pratyush

  • Like 1

Share this post


Link to post
Share on other sites

I have implemented proper detection of Method overloads.

 

Here are some screenshots:

Spoiler

First, here's how it works in v3.3.  It always shows the return type of the 1st overload, and lists no parameters.

oldOverloads.png

 

Here's how it will work in v3.4. It shows the proper return type, and lists parameters.

newOverloads.png

 

Here's another example showing two different overloads for Graphics.FillPolygon()

fillPolyOverloads.png

 

That was the last item on my ToDo list for CodeLab.  ✔️

  • Like 2

Share this post


Link to post
Share on other sites
14 hours ago, toe_head2001 said:

That was the last item on my ToDo list for CodeLab.  ✔️

 

Time for a request then :) I tried the new Switch/Case logic included with C#7.

 

switch (mystring.length)
{
    case int n when (n >= 0 && n <= 25):
    //do this
    break;

    case int n when (n >= 26 && n <= 50 ):
    //do this
    break;
}

 

Didn't work. Any chance this could be implemented please?

 

Thank you for all your work updating CodeLab!

 

 

Share this post


Link to post
Share on other sites
48 minutes ago, Ego Eram Reputo said:

Any chance this could be implemented please?

 

Nope.

 

Here's why:

 

CodeLab relies on the compiler that ships with the .NET framework and NOT the compiler that ships with Visual Studio.  This allows CodeLab to work on systems that do not have Visual Studio installed.

 

The .NET compiler (csc.exe) is stuck at C# version 5.0 or 6.0 (I can't remember which).

Share this post


Link to post
Share on other sites

I wanted to move a project to outside Codelab in my IDE but got following error

 

"The primary reference "PaintDotNet.Base" could not be resolved because it was built against the ".NETFramework,Version=v4.7" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.5.2". (MSB3274)"

Share this post


Link to post
Share on other sites
3 minutes ago, Pratyush said:

"The primary reference "PaintDotNet.Base" could not be resolved because it was built against the ".NETFramework,Version=v4.7" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.5.2". (MSB3274)"

 

In Visual Studio, you need to open the project properties, and change the Target Framework to .NET v4.7.

Share this post


Link to post
Share on other sites

When I start a project and device to choose a .NET version in latest visual studio, the latest .NET framework version I have is 4.6.2.  Seems some trouble shooting is needed before I start. 

Edited by Pratyush

Share this post


Link to post
Share on other sites

Also, in the Visual Studio project properties, as the last item in the list of frameworks, there's an entry "Install other frameworks..." As I recall, it just opens in your browser about the same thing that toe_head2001 linked to. I also recall it was kind of confusing, because there are two things I could do, and I wasn't sure which was the right one to install the framework.

Share this post


Link to post
Share on other sites
On 14/02/2018 at 11:04 AM, BoltBait said:

read this page: http://www.boltbait.com/pdn/CodeLab/help/tutorial5.asp where it says "Finally, right-click"

Not for the faint of heart.

I had a go with your lesson 5 and found it very difficult to create a new project in Visual Studio 2017. I finally got it to work by using your 2010 template. Not a big deal but I thought I would mention it.

The issue I was having was when I created a new project I couldn't link it to .net framework 4.7. It kept directing me to install. When I loaded your template - everything was linked fine.

Also the icon procedure wasn't successful. It would compile and create the DLL but Paint.Net wouldn't load the DLL.

 

Now if I could only understand the code....................B)

Share this post


Link to post
Share on other sites

Hi Andrew.

I also struggled with the same problems at first time, but I downloaded some source codes and studied them to find the solution.

 

I use Visual Studio Community 2015 with NET Framework 4.7 and I don't have any problems.

I can make a video for you if you wish.

Edited by xod

Share this post


Link to post
Share on other sites

Hi @xod

Thanks for the offer but I have a long way to go to understand the coding.

Knowing I can take something out of codelab and bring it into Visual Basic was enough for me.

Having that 2010 template was instrumental in getting it to work. B)

Share this post


Link to post
Share on other sites

Join the conversation

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

Guest
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.