public int Count { get; }
The count of RasterSaveDialogBitsPerPixel items in the list.
using Leadtools;
using Leadtools.Codecs;
using Leadtools.WinForms.CommonDialogs.File;
public void RasterSaveDialogExample2()
{
RasterCodecs rasterCodecs = new RasterCodecs();
RasterSaveDialog saveDlg = new RasterSaveDialog(rasterCodecs);
RasterSaveDialogFileFormatsList defaultFormats = new RasterSaveDialogFileFormatsList(RasterDialogFileFormatDataContent.Default);
//Some languages use RasterSaveDialogFileFormatsList.Item property to access the list indexer. In C#, the square brackets [] are used
RasterSaveDialogFileFormat lastFormat = defaultFormats[defaultFormats.Count-1];
Console.WriteLine($"Default BPP of last format is: {lastFormat.DefaultBitsPerPixel}");
Console.WriteLine($"Extension of last format is: {lastFormat.Extension}");
RasterSaveDialogBitsPerPixelList bppList = lastFormat.BitsPerPixelList;
//Some languages use RasterSaveDialogBitsPerPixelList.Item property to access the list indexer. In C#, the square brackets [] are used
RasterSaveDialogBitsPerPixel lastBPP = bppList[bppList.Count - 1];
Console.WriteLine($"Default extension for last BPP value is : {lastBPP.DefaultExtension}");
Console.WriteLine($"Default SubFormat index for last BPP value is : {lastBPP.DefaultSubFormatIndex}");
Console.WriteLine($"Flags for last BPP value : {lastBPP.Flags}");
RasterSaveDialogSubTypesList subFormats = lastBPP.SubFormatsList;
//Some languages use RasterSaveDialogSubTypesList.Item property to access the list indexer. In C#, the square brackets [] are used
RasterSaveDialogFileSubType lastSubFormat = subFormats[subFormats.Count - 1];
Console.WriteLine($"Extension for last sub-format is : {lastSubFormat.Extension}");
Console.WriteLine($"Format Flags for last sub-format : {lastSubFormat.FormatFlags}");
saveDlg.FileFormatsList = defaultFormats;
saveDlg.ShowFileOptionsBasicJ2kOptions = true;
saveDlg.ShowFileOptionsJbig2Options = true;
saveDlg.ShowOptions = true;
if (saveDlg.ShowDialog(null) != DialogResult.OK)
return;
switch (saveDlg.Format)
{
case RasterImageFormat.Jbig2:
rasterCodecs.Options.Jbig2.Save.EnableDictionary = saveDlg.FileJbig2Options.EnableDictionary;
break;
case RasterImageFormat.J2k:
case RasterImageFormat.Jp2:
// also other formats that use wavelet compression such as Cmw, TifJ2k, TifJ2k and TifCmw
rasterCodecs.Options.Jpeg2000.Save.CompressionControl = saveDlg.FileJ2kOptions.CompressionControl;
break;
case RasterImageFormat.Gif:
rasterCodecs.Options.Gif.Save.Interlaced = saveDlg.Interlaced;
break;
}
}