Jump to content

midora

Members
  • Posts

    1,782
  • Joined

  • Last visited

  • Days Won

    26

Posts posted by midora

  1. Never detected a possibility in VS2019 to switch forth and back from 4.7.2 (and lower) to 5 (and upper). So to I'm just replacing the content of the 4.7.2 project file with a 5 variant. 

     

    <Project Sdk="Microsoft.NET.Sdk">

      <PropertyGroup>
        <TargetFramework>net5.0-windows</TargetFramework>
        <UseWindowsForms>true</UseWindowsForms>
      </PropertyGroup>

      <ItemGroup>
        <Reference Include="PaintDotNet.Base">
          <HintPath>..\..\..\paint.net.portable\PaintDotNet.Base.dll</HintPath>
        </Reference>
        <Reference Include="PaintDotNet.Core">
          <HintPath>..\..\..\paint.net.portable\PaintDotNet.Core.dll</HintPath>
        </Reference>
        <Reference Include="PaintDotNet.Data">
          <HintPath>..\..\..\paint.net.portable\PaintDotNet.Data.dll</HintPath>
        </Reference>
      </ItemGroup>

    </Project>

     

    You have to adapt the paths to your paint.net 4.3 installation (absolute paths are ok) or remove them from the project file and add them again in the SolutionExplorer/dependencies/assemblies

    In the properties of the project you may select Resources and add a new one if you like to add an icon.

    • Like 1
  2. You just have to do it step by step.

     

    So first you should think about the readonly conditions:

     

                 Mode.Readonly = Gray

                 CustomColor.Readonly = Gray || (Mode != CustomColor)

     

    We can not handle '!=' as far as I know so just rewrite the condition

     

                 CustomColor.Readonly = Gray || (Mode == None) || (Mode == Primary) || (Mode == Secondary)

     

    Now create the rules

     

                List<PropertyCollectionRule> propRules = new List<PropertyCollectionRule>()
                {
                    new ReadOnlyBoundToBooleanRule(PropertyNames.Mode, PropertyNames.Gray, false),
                    new ReadOnlyBoundToNameValuesRule(PropertyNames.CustomColor, false, new TupleStruct<object, object>[] {
                            new TupleStruct<object, object>(PropertyNames.Gray, true),
                            new TupleStruct<object, object>(PropertyNames.Mode, ModeOptions.None),
                            new TupleStruct<object, object>(PropertyNames.Mode, ModeOptions.Primary),
                            new TupleStruct<object, object>(PropertyNames.Mode, ModeOptions.Secondary),
                    }),
                };

     

    or use the new syntax variant provided in 4.3.2

     

                List<PropertyCollectionRule> propRules = new List<PropertyCollectionRule>()
                {
                    new ReadOnlyBoundToBooleanRule(PropertyNames.Mode, PropertyNames.Gray, false),
                    new ReadOnlyBoundToNameValuesRule(PropertyNames.CustomColor, false,
                            (PropertyNames.Gray, true),
                            (PropertyNames.Mode, ModeOptions.None),
                            (PropertyNames.Mode, ModeOptions.Primary),
                            (PropertyNames.Mode, ModeOptions.Secondary)
                    ),
                };

     

    • Upvote 1
×
×
  • Create New...