Hide

SftButton/OCX 3.0 - Button Control

Display
Print

Special Sample (C#)

This sample illustrates special effects.

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

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

private void axSftButton1_HoverOn(object sender, System.EventArgs e)
{
    // The cursor is over the button, change the font
    // and button text
    axSftButton1.Font = new Font(axSftButton1.Font, FontStyle.Underline);
    axSftButton1.Text = "Click Me, Please";
}

private void axSftButton1_HoverOff(object sender, System.EventArgs e)
{
    // The cursor has left the button, change the font
    // and button text back to their original settings
    axSftButton1.Font = new Font(axSftButton1.Font, FontStyle.Regular);
    axSftButton1.Text = "Click Me";
}

private int m_WorldIndex = 0;

private void SetImage()
{
    // Update the button with the next image in the image list
    // to get the spinning globe effect
    axSftButton2.Image1.NETImageObject = imageList1.Images[m_WorldIndex];
    ++m_WorldIndex;
    if (m_WorldIndex >= imageList1.Images.Count) m_WorldIndex = 0;
}

private void timer1_Tick(object sender, System.EventArgs e)
{
    // Update the button bitmap every so often to get the
    // spinning globe effect
    SetImage();
}

private void borderTimer_Tick(object sender, System.EventArgs e)
{
    // Change the button border
    if (axSftButton3.Pressed || axSftButton3.DarkEdgeColor != SystemColors.ControlDarkDark)
    {
        axSftButton3.DarkEdgeColor = SystemColors.ControlDarkDark;
        axSftButton3.ShadowEdgeColor = SystemColors.ControlDark;
        axSftButton3.LightEdgeColor = SystemColors.ControlLight;
        axSftButton3.WhiteEdgeColor = SystemColors.ControlLightLight;
    } else {
        axSftButton3.DarkEdgeColor = SystemColors.ControlLightLight;
        axSftButton3.ShadowEdgeColor = SystemColors.ControlLightLight;
        axSftButton3.LightEdgeColor = SystemColors.ControlLightLight;
        axSftButton3.WhiteEdgeColor = SystemColors.ControlLightLight;
    }
}

private void pressedTimer_Tick(object sender, System.EventArgs e)
{
    // Toggle the button and drop down button state
    if (axSftButton4.Pressed)
    {
        if (axSftButton4.DropDownPressed)
            axSftButton4.Pressed = false;
        else
            axSftButton4.DropDownPressed = true;
    } else {
        if (axSftButton4.DropDownPressed)
            axSftButton4.DropDownPressed = false;
        else
            axSftButton4.Pressed = true;
    }
}

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