HeaderPane
Main
Hide

SftTree/OCX 8.0 - ActiveX Tree Control

Share Link
Print

Pictures Sample (C#)

This sample illustrates using bitmaps, images, imagelists, checkboxes, radiobuttons, color samples, progress bars and more.

The source code is located at C:\Program Files (x86)\Softelvdm\SftTree OCX 8.0\Samples\Visual Studio - CSharp\Pictures\Form1.cs or C:\Program Files\Softelvdm\SftTree OCX 8.0\Samples\Visual Studio - CSharp\Pictures\Form1.cs (on 32-bit Windows versions).


        private void menuExit_Click(object sender, System.EventArgs e) {
            Application.Exit();
        }

        private void CopyImageFromCurrentItem()
        {
            int itemIndex;
            SftPictureObject img;

            itemIndex = axSftTree1.Items.Current;
            if (itemIndex < 0)
                return;

            // don't use images that are too large in the other areas
            img = axSftTree1.get_Cell(itemIndex, 0).Image;
            if (img.ActualHeight <= 20 && img.ActualWidth <= 20) {
                axSftTree1.RowColumnHeader.Image = img;
                axSftTree1.get_Header(1).Image = img;
            } else {
                axSftTree1.RowColumnHeader.Image.Clear();
                axSftTree1.get_Header(1).Image.Clear();
            }
        }

        private void ToggleImage(SftPictureObject img)
        {
            switch (img.Appearance) {
            case SftPictureImageConstants.sftImageCheckboxNo:
                img.Appearance = SftTreeLib80.SftPictureImageConstants.sftImageCheckboxYes;
                break;
            case SftPictureImageConstants.sftImageCheckboxYes:
                img.Appearance = SftTreeLib80.SftPictureImageConstants.sftImageCheckboxNo;
                break;
            case SftPictureImageConstants.sftImageCheckboxUnknown:
                img.Appearance = SftTreeLib80.SftPictureImageConstants.sftImageCheckboxNo;
                break;
            case SftPictureImageConstants.sftImageCheckboxNoDisabled:
                img.Appearance = SftTreeLib80.SftPictureImageConstants.sftImageCheckboxYesDisabled;
                break;
            case SftPictureImageConstants.sftImageCheckboxYesDisabled:
                img.Appearance = SftTreeLib80.SftPictureImageConstants.sftImageCheckboxNoDisabled;
                break;
            case SftPictureImageConstants.sftImageCheckboxUnknownDisabled:
                img.Appearance = SftTreeLib80.SftPictureImageConstants.sftImageCheckboxNoDisabled;
                break;
            case SftPictureImageConstants.sftImageRadioButtonNo:
                img.Appearance = SftTreeLib80.SftPictureImageConstants.sftImageRadioButtonYes;
                break;
            case SftPictureImageConstants.sftImageRadioButtonYes:
                img.Appearance = SftTreeLib80.SftPictureImageConstants.sftImageRadioButtonNo;
                break;
            case SftPictureImageConstants.sftImageRadioButtonNoDisabled:
                img.Appearance = SftTreeLib80.SftPictureImageConstants.sftImageRadioButtonYesDisabled;
                break;
            case SftPictureImageConstants.sftImageRadioButtonYesDisabled:
                img.Appearance = SftTreeLib80.SftPictureImageConstants.sftImageRadioButtonNoDisabled;
                break;
            case SftPictureImageConstants.sftImageUp:
                img.Appearance = SftTreeLib80.SftPictureImageConstants.sftImageDown;
                break;
            case SftPictureImageConstants.sftImageUpDisabled:
                img.Appearance = SftTreeLib80.SftPictureImageConstants.sftImageDownDisabled;
                break;
            case SftPictureImageConstants.sftImageDown:
                img.Appearance = SftTreeLib80.SftPictureImageConstants.sftImageUp;
                break;
            case SftPictureImageConstants.sftImageDownDisabled:
                img.Appearance = SftTreeLib80.SftPictureImageConstants.sftImageUpDisabled;
                break;
            case SftPictureImageConstants.sftImageSortAsc:
                img.Appearance = SftTreeLib80.SftPictureImageConstants.sftImageSortDesc;
                break;
            case SftPictureImageConstants.sftImageSortAscDisabled:
                img.Appearance = SftTreeLib80.SftPictureImageConstants.sftImageSortDescDisabled;
                break;
            case SftPictureImageConstants.sftImageSortDesc:
                img.Appearance = SftTreeLib80.SftPictureImageConstants.sftImageSortAsc;
                break;
            case SftPictureImageConstants.sftImageSortDescDisabled:
                img.Appearance = SftTreeLib80.SftPictureImageConstants.sftImageSortAscDisabled;
                break;
            }
        }

        private void PropagateImage(int itemIndex, SftPictureObject img)
        {
            // don't use images that are too large in the other areas
            if (img.ActualHeight <= 20 && img.ActualWidth < 20) {
                axSftTree1.get_Item(itemIndex).Image = img;
                axSftTree1.get_Item(itemIndex).LabelImage = img;
                axSftTree1.get_Item(itemIndex).RowHeader.Image = img;
            }
        }

        private void UpdatePictures(int itemIndex, stdole.IPictureDisp iPic, SftTreeHAlignConstants align)
        {
            SftTreeCell c = axSftTree1.get_Cell(itemIndex, 0);
            c.Image.Picture = iPic;
            c.ImageHAlign = align;
            PropagateImage(itemIndex, c.Image);
        }

        private void UpdateImages(int itemIndex, Image img, SftTreeHAlignConstants align)
        {
            SftTreeCell c = axSftTree1.get_Cell(itemIndex, 0);
            c.Image.NETImageObject = img;
            c.ImageHAlign = align;
            PropagateImage(itemIndex, c.Image);
        }

        private void UpdateImageList(int itemIndex, ImageList imageListControl, int i, SftTreeHAlignConstants align)
        {
            SftTreeCell c = axSftTree1.get_Cell(itemIndex, 0);
            c.Image.SetImageListH((int) imageListControl.Handle, (short) i);
            c.ImageHAlign = align;
            PropagateImage(itemIndex, c.Image);
        }

        private void UpdateColor(int itemIndex, System.Drawing.Color clr, SftTreeHAlignConstants align)
        {
            SftTreeCell c = axSftTree1.get_Cell(itemIndex, 0);
            c.Image.SetColorSample((uint) ColorTranslator.ToOle(clr), (uint) ColorTranslator.ToOle(Color.Black));
            c.Image.Width = 12;
            c.Image.Height = 12;
            c.ImageHAlign = align;
            PropagateImage(itemIndex, c.Image);
        }

        private void AddColor(string text, Color clr)
        {
            int i;
            i = axSftTree1.Items.Add(text);
            axSftTree1.get_Item(i).Level = 2;
            UpdateColor(i, clr, SftTreeHAlignConstants.halignSftTreeRight);
        }

        private void UpdateBuiltinImage(int itemIndex, SftPictureImageConstants style, int wPix, int hPix, SftTreeHAlignConstants align)
        {
            SftTreeCell c = axSftTree1.get_Cell(itemIndex, 0);
            c.Image.Appearance = style;
            c.Image.Width = wPix;
            c.Image.Height = hPix;
            c.ImageHAlign = align;
            PropagateImage(itemIndex, c.Image);
        }

        private void AddBuiltinImage(string text, SftPictureImageConstants style, int wPix, int hPix)
        {
            int i = axSftTree1.Items.Add(text);
            axSftTree1.get_Item(i).Level = 2;
            UpdateBuiltinImage(i, style, wPix, hPix, SftTreeHAlignConstants.halignSftTreeRight);
        }

        private void ShowSortDirection(bool ascending)
        {
            if (ascending)
                axSftTree1.get_Header(0).Image.Appearance = SftPictureImageConstants.sftImageSortAsc;
            else
                axSftTree1.get_Header(0).Image.Appearance = SftPictureImageConstants.sftImageSortDesc;
            m_SortDirection = ascending;
        }

        private void SetSortDirection(bool newDirection)
        {
            ShowSortDirection(newDirection);
            if (newDirection)
                axSftTree1.Items.SortDependents(-1, 0, SftTreeSortTypeConstants.sortSftTreeAscending);
            else
                axSftTree1.Items.SortDependents(-1, 0, SftTreeSortTypeConstants.sortSftTreeDescending);
        }

        private void Form1_Load(object sender, System.EventArgs e) {
            axSftTree1.Dock = DockStyle.Fill;

            int itemIndex = axSftTree1.Items.Add("Progress Bars");
            axSftTree1.get_Cell(itemIndex, 1).Text = "SftTree/OCX supports progress bars as cell background (partial or full size).";

            int i = axSftTree1.Items.Add("Progress Bar - Full Size");
            axSftTree1.get_Item(i).Level = 1;
            axSftTree1.get_Cell(i, 0).ProgressMax = 100;  // maximum value 0-100
            axSftTree1.get_Cell(i, 0).ProgressValue = 33; // current value

            i = axSftTree1.Items.Add("Progress Bar - Partial");
            axSftTree1.get_Item(i).Level = 1;
            axSftTree1.get_Cell(i, 0).ProgressColorOrientation = SftTreeOrientationDefaultConstants.horizontalDefaultOrientationSftTree;
            axSftTree1.get_Cell(i, 0).ProgressStyle = SftTreeProgressStyleDefaultConstants.smallDefaultProgressStyleSftTree;
            axSftTree1.get_Cell(i, 0).ProgressMax = 200;  // maximum value 0-200
            axSftTree1.get_Cell(i, 0).ProgressValue = 33; // current value

            i = axSftTree1.Items.Add("Progress Bar - with gradient fill");
            axSftTree1.get_Item(i).Level = 1;
            axSftTree1.get_Cell(i, 0).ProgressColorOrientation = SftTreeOrientationDefaultConstants.horizontalDefaultOrientationSftTree;
            axSftTree1.get_Cell(i, 0).ProgressStyle = SftTreeProgressStyleDefaultConstants.smallDefaultProgressStyleSftTree;
            axSftTree1.get_Cell(i, 0).ProgressColor = (uint) ColorTranslator.ToOle(Color.FromArgb(128, 128, 0));
            axSftTree1.get_Cell(i, 0).ProgressColorEnd = (uint) ColorTranslator.ToOle(Color.FromArgb(255, 255, 0));
            axSftTree1.get_Cell(i, 0).ProgressMax = 50;   // maximum value 0-50
            axSftTree1.get_Cell(i, 0).ProgressValue = 40; // current value

            i = axSftTree1.Items.Add("Progress Bar - customizable colors");
            axSftTree1.get_Item(i).Level = 1;
            axSftTree1.get_Cell(i, 0).ProgressColorOrientation = SftTreeOrientationDefaultConstants.verticalDefaultOrientationSftTree;
            axSftTree1.get_Cell(i, 0).ProgressStyle = SftTreeProgressStyleDefaultConstants.smallDefaultProgressStyleSftTree;
            axSftTree1.get_Cell(i, 0).ProgressColor = (uint) ColorTranslator.ToOle(Color.FromArgb(128, 128, 0));
            axSftTree1.get_Cell(i, 0).ProgressColorEnd = (uint) ColorTranslator.ToOle(Color.FromArgb(255, 255, 0));
            axSftTree1.get_Cell(i, 0).ProgressMax = 150;   // maximum value 0-150
            axSftTree1.get_Cell(i, 0).ProgressValue = 40; // current value
            axSftTree1.get_Cell(i, 0).BackColor = (uint) ColorTranslator.ToOle(Color.FromKnownColor(KnownColor.Window));
            axSftTree1.get_Cell(i, 0).BackColorEnd = (uint)ColorTranslator.ToOle(Color.FromArgb(255, 0, 0));
            axSftTree1.get_Cell(i, 0).BackColorOrientation = SftTreeOrientationDefaultConstants.horizontalDefaultOrientationSftTree;


            itemIndex = axSftTree1.Items.Add("Supported Picture Types");
            axSftTree1.get_Cell(itemIndex, 1).Text = "SftTree/OCX supports numerous image types, such as GDI+, bitmaps, icons, ImageLists and also offers numerous built-in images.";

            // add GDI+ samples

            itemIndex = axSftTree1.Items.Add("GDI+ Images");
            axSftTree1.get_Item(itemIndex).Level = 1;
            axSftTree1.get_Cell(itemIndex, 1).Text = "All GDI+ images are supported, like GIF, JPEG, Exif, PNG, TIFF and device-independent bitmaps (up to 64bpp) with semi-transparent and translucent areas.";

            i = axSftTree1.Items.Add("PNG Sample with alpha-channel for translucent edges");
            axSftTree1.get_Item(i).Level = 2;
            UpdateImages(i, picturePNG1.Image, SftTreeHAlignConstants.halignSftTreeRight);

            i = axSftTree1.Items.Add("Another PNG Sample with alpha-channel for translucent edges");
            axSftTree1.get_Item(i).Level = 2;
            UpdateImages(i, picturePNG2.Image, SftTreeHAlignConstants.halignSftTreeRight);

            // add bitmap samples

            itemIndex = axSftTree1.Items.Add("Bitmaps");
            axSftTree1.get_Item(itemIndex).Level = 1;
            axSftTree1.get_Cell(itemIndex, 1).Text = "Bitmaps can be of varying sizes and also support Bitmap Transparency, which allows the background to show through the image (in areas selected by the bitmap designer).";

            i = axSftTree1.Items.Add("Large Bitmap");
            axSftTree1.get_Item(i).Level = 2;
            UpdateImages(i, PictureLogo.Image, SftTreeHAlignConstants.halignSftTreeRight);
            // or, could also use the following (which is COM-style)
            // UpdatePictures(i, OLECvt.ToIPictureDisp(PictureLogo.Image), SftTreeHAlignConstants.halignSftTreeRight);

            i = axSftTree1.Items.Add("Various bitmap sizes");
            axSftTree1.get_Item(i).Level = 2;
            UpdateImages(i, PictureSmallBitmap.Image, SftTreeHAlignConstants.halignSftTreeRight);
            // or, could also use the following (which is COM-style)
            // UpdatePictures(i, OLECvt.ToIPictureDisp(PictureSmallBitmap.Image), SftTreeHAlignConstants.halignSftTreeRight);

            // add icon samples

            itemIndex = axSftTree1.Items.Add("Icons");
            axSftTree1.get_Item(itemIndex).Level = 1;
            axSftTree1.get_Cell(itemIndex, 1).Text = "The supported icons can be standard size icons (32x32) or any other size supported by the operating system.";

            i = axSftTree1.Items.Add("Standard Icon (32x32)");
            axSftTree1.get_Item(i).Level = 2;
            UpdateImages(i, PictureIcon.Image, SftTreeHAlignConstants.halignSftTreeRight);
            // or, could also use the following (which is COM-style)
            // UpdatePictures(i, OLECvt.ToIPictureDisp(PictureIcon.Image), SftTreeHAlignConstants.halignSftTreeRight);

            i = axSftTree1.Items.Add("Any other size");
            axSftTree1.get_Item(i).Level = 2;
            UpdateImages(i, PictureIconSmall.Image, SftTreeHAlignConstants.halignSftTreeRight);
            // or, could also use the following (which is COM-style)
            // UpdatePictures(i, OLECvt.ToIPictureDisp(PictureIconSmall.Image), SftTreeHAlignConstants.halignSftTreeRight);

            // add imagelist samples

            itemIndex = axSftTree1.Items.Add("ImageLists");
            axSftTree1.get_Item(itemIndex).Level = 1;
            axSftTree1.get_Cell(itemIndex, 1).Text = "Complete ImageList support simplifies bitmap handling and can avoid the limited resource availability on earlier Windows versions.";

            for (int c = 0 ; c < imageList1.Images.Count ; ++c) {
                i = axSftTree1.Items.Add("Image " + c.ToString());
                axSftTree1.get_Item(i).Level = 2;
                UpdateImageList(i, imageList1, c, SftTreeHAlignConstants.halignSftTreeRight);
            }

            // add color samples

            itemIndex = axSftTree1.Items.Add("Color Samples");
            axSftTree1.get_Item(itemIndex).Level = 1;
            axSftTree1.get_Cell(itemIndex, 1).Text = "Using the built-in color sample image, simple color selection can easily be implemented.  Color samples can display all colors available.";

            AddColor("Black", System.Drawing.Color.Black);
            AddColor("Blue", System.Drawing.Color.Blue);
            AddColor("Cyan", System.Drawing.Color.Cyan);
            AddColor("Green", System.Drawing.Color.Lime);
            AddColor("Magenta", System.Drawing.Color.Magenta);
            AddColor("Red", System.Drawing.Color.Red);
            AddColor("White", System.Drawing.Color.White);
            AddColor("Yellow", System.Drawing.Color.Yellow);

            AddColor("3DDKSHADOW - Dark shadow for 3D elements", System.Drawing.SystemColors.ControlDarkDark);
            AddColor("3DFACE - Face color for 3D elements", System.Drawing.SystemColors.Control);
            AddColor("3DHILIGHT - Edges facing the light source", System.Drawing.SystemColors.ControlLightLight);
            AddColor("3DLIGHT - Edges facing the light source", System.Drawing.SystemColors.ControlLight);
            AddColor("3DSHADOW - Edges facing away from the light source", System.Drawing.SystemColors.ControlDark);
            AddColor("INFOBK - Background color for tooltip controls", System.Drawing.SystemColors.Info);
            AddColor("INFOTEXT - text color for tooltip controls", System.Drawing.SystemColors.InfoText);
            AddColor("MENUTEXT - text in menus", System.Drawing.SystemColors.MenuText);
            AddColor("ACTIVEBORDER - Active window border", System.Drawing.SystemColors.ActiveBorder);
            AddColor("ACTIVECAPTION - Active window caption", System.Drawing.SystemColors.ActiveCaption);
            AddColor("APPWORKSPACE - Background color MDI applications", System.Drawing.SystemColors.AppWorkspace);
            AddColor("BACKGROUND - Desktop", System.Drawing.SystemColors.Desktop);
            AddColor("BTNFACE - Face shading on push buttons", System.Drawing.SystemColors.Control);
            AddColor("BTNHILIGHT - Highlight color for buttons", System.Drawing.SystemColors.ControlLightLight);
            AddColor("BTNSHADOW - Edge shading on push buttons", System.Drawing.SystemColors.ControlDark);
            AddColor("BTNTEXT - text on push buttons", System.Drawing.SystemColors.ControlText);
            AddColor("CAPTIONTEXT - text in caption", System.Drawing.SystemColors.ActiveCaptionText);
            AddColor("GRAYTEXT - Grayed (disabled); text", System.Drawing.SystemColors.GrayText);
            AddColor("HIGHLIGHT - Selected Item(s)", System.Drawing.SystemColors.Highlight);
            AddColor("HIGHLIGHTTEXT - text of selected item(s)", System.Drawing.SystemColors.HighlightText);
            AddColor("INACTIVEBORDER - Inactive window border", System.Drawing.SystemColors.InactiveBorder);
            AddColor("INACTIVECAPTION - Inactive window caption", System.Drawing.SystemColors.InactiveCaption);
            AddColor("INACTIVECAPTIONTEXT - Inactive caption text color", System.Drawing.SystemColors.InactiveCaptionText);
            AddColor("MENU - Menu background", System.Drawing.SystemColors.Menu);
            AddColor("SCROLLBAR - Scroll bar gray area", System.Drawing.SystemColors.ScrollBar);
            AddColor("WINDOW - Window background", System.Drawing.SystemColors.Window);
            AddColor("WINDOWFRAME - Window frame", System.Drawing.SystemColors.WindowFrame);
            AddColor("WINDOWTEXT - text in windows", System.Drawing.SystemColors.WindowText);

            // add predefined image samples

            itemIndex = axSftTree1.Items.Add("Predefined (Built-in) Pictures");
            axSftTree1.get_Cell(itemIndex, 1).Text = "Predefined images are available for commonly used items, such as check boxes, radio buttons, sort direction indicators and more...";

            itemIndex = axSftTree1.Items.Add("Check Boxes - Honors Windows Themes");
            axSftTree1.get_Item(itemIndex).Level = 1;

            AddBuiltinImage("Enabled, Selected Check Box", SftTreeLib80.SftPictureImageConstants.sftImageCheckboxYes, 14, 14);
            AddBuiltinImage("Disabled, Selected Check Box", SftTreeLib80.SftPictureImageConstants.sftImageCheckboxYesDisabled, 14, 14);
            AddBuiltinImage("Enabled Check Box", SftTreeLib80.SftPictureImageConstants.sftImageCheckboxNo, 14, 14);
            AddBuiltinImage("Disabled Check Box", SftTreeLib80.SftPictureImageConstants.sftImageCheckboxNoDisabled, 14, 14);
            AddBuiltinImage("Enabled, Unknown Check Box", SftTreeLib80.SftPictureImageConstants.sftImageCheckboxUnknown, 14, 14);
            AddBuiltinImage("Disabled, Unknown Check Box", SftTreeLib80.SftPictureImageConstants.sftImageCheckboxUnknownDisabled, 14, 14);

            itemIndex = axSftTree1.Items.Add("Radio Buttons - Honors Windows Themes");
            axSftTree1.get_Item(itemIndex).Level = 1;

            AddBuiltinImage("Enabled, Selected Radio Button", SftTreeLib80.SftPictureImageConstants.sftImageRadioButtonYes, 14, 14);
            AddBuiltinImage("Disabled, Selected Radio Button", SftTreeLib80.SftPictureImageConstants.sftImageRadioButtonYesDisabled, 14, 14);
            AddBuiltinImage("Enabled Radio Button", SftTreeLib80.SftPictureImageConstants.sftImageRadioButtonNo, 14, 14);
            AddBuiltinImage("Disabled Radio Button", SftTreeLib80.SftPictureImageConstants.sftImageRadioButtonNoDisabled, 14, 14);

            itemIndex = axSftTree1.Items.Add("Up/Down Buttons - Honors Windows Themes");
            axSftTree1.get_Item(itemIndex).Level = 1;

            AddBuiltinImage("Enabled Up Button", SftTreeLib80.SftPictureImageConstants.sftImageUp, 14, 14);
            AddBuiltinImage("Disabled Up Button", SftTreeLib80.SftPictureImageConstants.sftImageUpDisabled, 14, 14);
            AddBuiltinImage("Enabled Down Button", SftTreeLib80.SftPictureImageConstants.sftImageDown, 14, 14);
            AddBuiltinImage("Disabled Down Button", SftTreeLib80.SftPictureImageConstants.sftImageDownDisabled, 14, 14);

            itemIndex = axSftTree1.Items.Add("Sort Direction Indicator");
            axSftTree1.get_Item(itemIndex).Level = 1;

            AddBuiltinImage("Enabled ascending Indicator", SftTreeLib80.SftPictureImageConstants.sftImageSortAsc, 8, 8);
            AddBuiltinImage("Disabled ascending Indicator", SftTreeLib80.SftPictureImageConstants.sftImageSortAscDisabled, 8, 8);
            AddBuiltinImage("Enabled Descending Indicator", SftTreeLib80.SftPictureImageConstants.sftImageSortDesc, 8, 8);
            AddBuiltinImage("Disabled Descending Indicator", SftTreeLib80.SftPictureImageConstants.sftImageSortDescDisabled, 8, 8);


            axSftTree1.RowHeaders.MakeOptimal(); // make the row headers optimal
            axSftTree1.get_Column(0).MakeOptimal(); // make the first column optimal
            axSftTree1.Items.RecalcHorizontalExtent(); // update horizontal scroll bar

            axSftTree1.get_Item(0).Selected = true;
            axSftTree1.Items.Current = 0;

            CopyImageFromCurrentItem();
        }

        private void axSftTree1_ItemClick(object sender, AxSftTreeLib80._DSftTreeEvents_ItemClickEvent e)
        {
            SftTreeAreaTypeConstants areaType = (SftTreeAreaTypeConstants) e.areaType;
            if (areaType == SftTreeAreaTypeConstants.constSftTreeExpandAll)
                axSftTree1.get_Item(e.itemIndex).Expand(true, true);
            else if (areaType == SftTreeAreaTypeConstants.constSftTreeColumn && e.colIndex == 0)
                SetSortDirection(!m_SortDirection);
            else if (areaType == SftTreeAreaTypeConstants.constSftTreeCellGraphic)
                ToggleImage(axSftTree1.get_Cell(e.itemIndex, e.colIndex).Image);
            else if (areaType == SftTreeAreaTypeConstants.constSftTreeItem)
                ToggleImage(axSftTree1.get_Item(e.itemIndex).Image);
            else if (areaType == SftTreeAreaTypeConstants.constSftTreeLabel)
                ToggleImage(axSftTree1.get_Item(e.itemIndex).LabelImage);
        }

        private void axSftTree1_ItemDblClick(object sender, AxSftTreeLib80._DSftTreeEvents_ItemDblClickEvent e) {
            SftTreeAreaTypeConstants areaType = (SftTreeAreaTypeConstants) e.areaType;
            if (areaType == SftTreeAreaTypeConstants.constSftTreeColumnRes) {
                axSftTree1.get_Column(e.colIndex).MakeOptimal(); // Make column width optimal
                axSftTree1.Items.RecalcHorizontalExtent(); // Update horizontal scroll bar
            } else if (areaType == SftTreeAreaTypeConstants.constSftTreeColumn && e.colIndex == 0) 
                SetSortDirection(!m_SortDirection);
            else if (areaType == SftTreeAreaTypeConstants.constSftTreeCellGraphic)
                ToggleImage(axSftTree1.get_Cell(e.itemIndex, e.colIndex).Image);
        }

        private void axSftTree1_SelectionChange(object sender, System.EventArgs e) {
            CopyImageFromCurrentItem();
        }

        private void timer1_Tick(object sender, EventArgs e) {
            // update all cells that have a progress bar by incrementing the progress value
            int items = axSftTree1.Items.Count;
            int cols = axSftTree1.ColumnsObj.Count;
            for (int item = 0; item < items; ++item) {
                ISftTreeCell cellObj;
                cellObj = axSftTree1.get_Cell(item, 0);
                if (cellObj.ProgressMax > 0)
                    cellObj.ProgressValue = (cellObj.ProgressValue + 4) % cellObj.ProgressMax;
            }
        }
    }
}

Last Updated 05/24/2026 - (email)
© 2026 Softel vdm, Inc.