Hide

SftTree/OCX 7.5 - ActiveX Tree Control

Display
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 7.5\Samples\Visual Studio - CSharp\Pictures\Form1.cs or C:\Program Files\Softelvdm\SftTree OCX 7.5\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 = SftTreeLib75.SftPictureImageConstants.sftImageCheckboxYes;
                break;
            case SftPictureImageConstants.sftImageCheckboxYes:
                Img.Appearance = SftTreeLib75.SftPictureImageConstants.sftImageCheckboxNo;
                break;
            case SftPictureImageConstants.sftImageCheckboxUnknown:
                Img.Appearance = SftTreeLib75.SftPictureImageConstants.sftImageCheckboxNo;
                break;
            case SftPictureImageConstants.sftImageCheckboxNoDisabled:
                Img.Appearance = SftTreeLib75.SftPictureImageConstants.sftImageCheckboxYesDisabled;
                break;
            case SftPictureImageConstants.sftImageCheckboxYesDisabled:
                Img.Appearance = SftTreeLib75.SftPictureImageConstants.sftImageCheckboxNoDisabled;
                break;
            case SftPictureImageConstants.sftImageCheckboxUnknownDisabled:
                Img.Appearance = SftTreeLib75.SftPictureImageConstants.sftImageCheckboxNoDisabled;
                break;
            case SftPictureImageConstants.sftImageRadioButtonNo:
                Img.Appearance = SftTreeLib75.SftPictureImageConstants.sftImageRadioButtonYes;
                break;
            case SftPictureImageConstants.sftImageRadioButtonYes:
                Img.Appearance = SftTreeLib75.SftPictureImageConstants.sftImageRadioButtonNo;
                break;
            case SftPictureImageConstants.sftImageRadioButtonNoDisabled:
                Img.Appearance = SftTreeLib75.SftPictureImageConstants.sftImageRadioButtonYesDisabled;
                break;
            case SftPictureImageConstants.sftImageRadioButtonYesDisabled:
                Img.Appearance = SftTreeLib75.SftPictureImageConstants.sftImageRadioButtonNoDisabled;
                break;
            case SftPictureImageConstants.sftImageUp:
                Img.Appearance = SftTreeLib75.SftPictureImageConstants.sftImageDown;
                break;
            case SftPictureImageConstants.sftImageUpDisabled:
                Img.Appearance = SftTreeLib75.SftPictureImageConstants.sftImageDownDisabled;
                break;
            case SftPictureImageConstants.sftImageDown:
                Img.Appearance = SftTreeLib75.SftPictureImageConstants.sftImageUp;
                break;
            case SftPictureImageConstants.sftImageDownDisabled:
                Img.Appearance = SftTreeLib75.SftPictureImageConstants.sftImageUpDisabled;
                break;
            case SftPictureImageConstants.sftImageSortAsc:
                Img.Appearance = SftTreeLib75.SftPictureImageConstants.sftImageSortDesc;
                break;
            case SftPictureImageConstants.sftImageSortAscDisabled:
                Img.Appearance = SftTreeLib75.SftPictureImageConstants.sftImageSortDescDisabled;
                break;
            case SftPictureImageConstants.sftImageSortDesc:
                Img.Appearance = SftTreeLib75.SftPictureImageConstants.sftImageSortAsc;
                break;
            case SftPictureImageConstants.sftImageSortDescDisabled:
                Img.Appearance = SftTreeLib75.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", SftTreeLib75.SftPictureImageConstants.sftImageCheckboxYes, 14, 14);
            AddBuiltinImage("Disabled, Selected Check Box", SftTreeLib75.SftPictureImageConstants.sftImageCheckboxYesDisabled, 14, 14);
            AddBuiltinImage("Enabled Check Box", SftTreeLib75.SftPictureImageConstants.sftImageCheckboxNo, 14, 14);
            AddBuiltinImage("Disabled Check Box", SftTreeLib75.SftPictureImageConstants.sftImageCheckboxNoDisabled, 14, 14);
            AddBuiltinImage("Enabled, Unknown Check Box", SftTreeLib75.SftPictureImageConstants.sftImageCheckboxUnknown, 14, 14);
            AddBuiltinImage("Disabled, Unknown Check Box", SftTreeLib75.SftPictureImageConstants.sftImageCheckboxUnknownDisabled, 14, 14);

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

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

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

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

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

            AddBuiltinImage("Enabled Ascending Indicator", SftTreeLib75.SftPictureImageConstants.sftImageSortAsc, 8, 8);
            AddBuiltinImage("Disabled Ascending Indicator", SftTreeLib75.SftPictureImageConstants.sftImageSortAscDisabled, 8, 8);
            AddBuiltinImage("Enabled Descending Indicator", SftTreeLib75.SftPictureImageConstants.sftImageSortDesc, 8, 8);
            AddBuiltinImage("Disabled Descending Indicator", SftTreeLib75.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, AxSftTreeLib75._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, AxSftTreeLib75._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 08/13/2020 - (email)
© 2024 Softel vdm, Inc.