ThinkGeo.com    |     Documentation    |     Premium Support

Built-in Styles

Hi,

In version 10, there were some built-in styles in the Style objects. I used the following code to access them and add them to a symbology grid control.

However, in v14 I now get errors from reflection not being able to convert to the type of item when trying to GetValue().

How do I access built-in styles in v14?

            if (styleType.GetType() == typeof(LineStyle))
        {
            foreach (var style in typeof(LineStyle).GetProperties())
            {
                LineStyle thisStyle = style.GetValue(style, null) as LineStyle;
                galleryControl1.Gallery.Groups[1].Items.Add(new GalleryItem(DrawSampleImage(new Bitmap(width, height), thisStyle),
                    style.Name, ""));
            }
        }

Regards,
Damian

Hi Damian,

It’s removed since v12. Here you can find the v10 source code, which you can easily use to recreate them in your project.

Predefined Styles in WinForms 14 - ThinkGeo UI for Desktop / WinForms - ThinkGeo Discussion Forums

Thanks,
Ben

Okay, but there is some syntax issue. StyleClass does not exist in v14. What should this be now?

        public static AreaStyle BaseLand()
    {
        AreaStyle areaStyle = new AreaStyle(new GeoPen(GeoColors.Transparent), new GeoSolidBrush(new GeoColor(255, 250, 247, 243)));
        areaStyle.StyleClass = "WorldStreetsAreaStyles.BaseLand";
        return areaStyle;
    }

Regards,
Damian

And what is PclSystem and where are all these .png’s located for the points? This is giving errors as well.

The old hard coded WorldStreets Styles were removed, as we are now using StyleJson for the WorldStreets. PclSystem were something we did internally for multiplatform support before .NET Core was released. It’s not available since v12.

So do I just get rid of the lines that say areaStyle.StyleClass?

I realize you got rid of PclSystem, but I need to know a replacement option (possibly System.IO.Path). This code is all over the place, particularly in the Points Styles. Where do these icons exist?

    public static PointStyle AmenityCasino(string iconPath)
    {
        return ImagePointStyle(PclSystem.Path.Combine(iconPath, "amenitycasino.16.png"));
    }

Those icons are no longer included in the ThinkGeo assembly.

You have a couple of options:

  1. Update your old code to run against the legacy assembly, extract the embedded images, and save them to disk. You can then reference those images in the new assembly.
  2. Alternatively, I can try to locate those icons on my side (though they may not exactly match the versions you were using) and share them with you.

If you could send the icons, it would be appreciated.

Regards,
Damian

Here it is: Icons.zip (287.8 KB)