Hide

SftDirectory 3.5 - ActiveX File/Folder Control

Display
Print

ControlStyles Sample (C#)

This sample demonstrates the control styles (ControlStyle property).

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

private void CheckTreeLines_CheckedChanged(object sender, System.EventArgs e) {
    SftDirectoryTreeLineStyleConstants style;

    if (CheckTreeLines.CheckState == CheckState.Checked)
        style = SftDirectoryTreeLineStyleConstants.treeLineStyleSftDirectoryDotted;
    else
        style = SftDirectoryTreeLineStyleConstants.treeLineStyleSftDirectoryNone;
    axSftDirectoryTV.TreeLineStyle = style;
    axSftDirectoryDL.TreeLineStyle = style;
    axSftDirectoryTV_Combo.TreeLineStyle = style;
    axSftDirectoryDL_Combo.TreeLineStyle = style;
}

private void CheckCheckBoxes_CheckedChanged(object sender, System.EventArgs e) {
    SftDirectoryCheckBoxDisplayConstants style;

    if (CheckCheckBoxes.CheckState == CheckState.Checked)
        style = SftDirectoryCheckBoxDisplayConstants.checkboxDisplaySftDirectoryAll;
    else
        style = SftDirectoryCheckBoxDisplayConstants.checkboxDisplaySftDirectoryNone;
    axSftDirectoryTV.ShowCheckBoxes = style;
    axSftDirectoryDL.ShowCheckBoxes = style;
    axSftDirectoryTV_Combo.ShowCheckBoxes = style;
    axSftDirectoryDL_Combo.ShowCheckBoxes = style;
}

private void CheckShowHeaders_CheckedChanged(object sender, System.EventArgs e) {
    SftDirectoryHeadersStyleConstants style;

    if (CheckShowHeaders.CheckState == CheckState.Checked)
        style = SftDirectoryHeadersStyleConstants.headersSftDirectoryButton;
    else
        style = SftDirectoryHeadersStyleConstants.headersSftDirectoryNone;
    axSftDirectoryTV.Headers.Style = style;
    axSftDirectoryDL.Headers.Style = style;
    axSftDirectoryTV_Combo.Headers.Style = style;
    axSftDirectoryDL_Combo.Headers.Style = style;
}

private void axSftDirectoryTV_CheckBoxClicked(object sender, AxSftDirectoryLib30._ISftDirectoryEvents_CheckBoxClickedEvent e) {
    if (e.newValue != SftDirectoryCheckBoxValueConstants.checkboxSftDirectoryNo &&
            e.newValue != SftDirectoryCheckBoxValueConstants.checkboxSftDirectoryYes) {
        e.newValue = SftDirectoryCheckBoxValueConstants.checkboxSftDirectoryYes;
    }
    axSftDirectoryTV.CurrentFolder.SetSubFolderCheckBoxes(e.newValue, true);
    axSftDirectoryTV.CurrentFolder.CheckBox = e.newValue;
    axSftDirectoryTV.RootFolder.EvaluateSubFolderCheckBoxes(true);
}

private void axSftDirectoryTV_Combo_CheckBoxClicked(object sender, AxSftDirectoryLib30._ISftDirectoryEvents_CheckBoxClickedEvent e) {
    if (e.newValue != SftDirectoryCheckBoxValueConstants.checkboxSftDirectoryNo &&
            e.newValue != SftDirectoryCheckBoxValueConstants.checkboxSftDirectoryYes) {
        e.newValue = SftDirectoryCheckBoxValueConstants.checkboxSftDirectoryYes;
    }
    axSftDirectoryTV_Combo.CurrentFolder.SetSubFolderCheckBoxes(e.newValue, true);
    axSftDirectoryTV_Combo.CurrentFolder.CheckBox = e.newValue;
    axSftDirectoryTV_Combo.RootFolder.EvaluateSubFolderCheckBoxes(true);
}

private void Form1_Load(object sender, System.EventArgs e) {
    CheckTreeLines.CheckState = CheckState.Checked;
}

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

Last Updated 08/13/2020 - (email)
© 2024 Softel vdm, Inc.