WinForms

Code Examples Upgrade Guide User Guide Demos Support Forums Download
  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class CalculatorControl

    Show / Hide Table of Contents

    Class CalculatorControl

    Calculator control encapsulates the functionality of a calculator with the ability to perform arithmetic calculations.

    Inheritance
    System.Object
    CalculatorControl
    Implements
    ICalculatorEngineParent
    ICalculatorButtonParent
    IThemeProvider
    IVisualStyle
    Namespace: Syncfusion.Windows.Forms.Tools
    Assembly: Syncfusion.Tools.Windows.dll
    Syntax
    public class CalculatorControl : ContainerControl, ICalculatorEngineParent, ICalculatorButtonParent, IThemeProvider, IVisualStyle
    Remarks

    The calculator control can be used in two different layouts. See CalculatorLayoutTypes for more information.

    The default property of the Calculator Control class is the Value property. This property is of type CalculatorValue.

    The Calculator Control uses a Syncfusion.Windows.Forms.Tools.CalculatorControl.CalculatorEngine object to perform the calculations and maintain the state of the calculations. The CalculatorControl implements the ICalculatorEngineParent interface to receive notifications from the Calculator Engine.

    The calculator buttons are of type Syncfusion.Windows.Forms.Tools.CalculatorButton and the buttons maintain their own information about the action that is to be performed when clicked.

    Examples
    //InitializeComponent
    // Create the Calculator Control
    this.calculatorControl1 = new CalculatorControl();
    this.textBox1 = new TextBox();
    // Set the value of the calculator control
    this.calculatorControl1.DoubleValue = 0;
    // Set the border style for the control
     this.calculatorControl1.BorderStyle = Border3DStyle.Raised;
    // The flat style for the buttons
    this.calculatorControl1.FlatStyle = FlatStyle.Standard;
    // Set the size of the calculator
    this.calculatorControl1.Size = new System.Drawing.Size(288, 232);
    // Add a event handler for the ValueCalculated event of the child button
    this.calculatorControl1.ValueCalculated += new Syncfusion.Windows.Forms.Tools.CalculatorControl.ValueCalculatedEventHandler(this.CodeGen_calculatorControl1_ValueCalculated);
    // Add the CalculatorControl control to the form
    this.Controls.Add(this.calculatorControl1);

    
    'InitializeComponent
    ' Create the Calculator Control
    Me.calculatorControl1 = New CalculatorControl()
    Me.textBox1 = New TextBox()
    ' Set the value of the calculator control
    Me.calculatorControl1.DoubleValue = 0
    ' Set the border style for the control
    Me.calculatorControl1.BorderStyle = Border3DStyle.Raised
    ' The flat style for the buttons
    Me.calculatorControl1.FlatStyle = FlatStyle.Standard
    ' Set the size of the calculator
    Me.calculatorControl1.Size = New System.Drawing.Size(288, 232)
    ' Add a event handler for the ValueCalculated event of the child button
    AddHandler Me.calculatorControl1.ValueCalculated, New Syncfusion.Windows.Forms.Tools.CalculatorControl.ValueCalculatedEventHandler(AddressOf CodeGen_calculatorControl1_ValueCalculated)
    ' Add the CalculatorControl control to the form
    Me.Controls.Add(Me.calculatorControl1)

    Constructors

    CalculatorControl()

    Initializes a new instance of the CalculatorControl class.

    The constructor will initialize the Syncfusion.Windows.Forms.Tools.CalculatorControl.CalculatorEngine and the display textbox with the initial values.

    Declaration
    public CalculatorControl()

    Fields

    autoSizeValue

    Value when the control is resized based on the layout.

    Declaration
    protected bool autoSizeValue
    Field Value
    Type Description
    System.Boolean

    m_office2007Theme

    Colorschemes for Office2007 visual style.

    Declaration
    protected Office2007Theme m_office2007Theme
    Field Value
    Type Description
    Office2007Theme

    m_office2010Theme

    Colorschemes for Office2010 visual style.

    Declaration
    protected Office2010Theme m_office2010Theme
    Field Value
    Type Description
    Office2010Theme

    textCalculatorBox

    The display box for the CalculatorControl.

    Declaration
    protected TextBox textCalculatorBox
    Field Value
    Type Description
    System.Windows.Forms.TextBox
    Remarks

    This TextBox will display the output from the calculations.

    Properties

    AutoSize

    Gets or sets a value indicating whether the control is to be resized based on the layout.

    Declaration
    public bool AutoSize { get; set; }
    Property Value
    Type Description
    System.Boolean

    BackgroundColor

    Gets or sets the background color, gradient and other styles can be set through this property.

    Declaration
    public BrushInfo BackgroundColor { get; set; }
    Property Value
    Type Description
    BrushInfo

    BeforeTouchSize

    Gets/Sets Control size before touch enabled

    Declaration
    public Size BeforeTouchSize { get; set; }
    Property Value
    Type Description
    System.Drawing.Size

    BorderStyle

    Gets or sets the Border3DStyle for the CalculatorControl's border.

    Declaration
    public Border3DStyle BorderStyle { get; set; }
    Property Value
    Type Description
    System.Windows.Forms.Border3DStyle
    Remarks

    This value can be any of the values of the type System.Windows.Forms.Border3DStyle. Setting the value to System.Windows.Forms.Border3DStyle.Adjust displays no border.

    ButtonStyle

    Gets or sets the button style for the Calculator Control.

    Declaration
    public ButtonAppearance ButtonStyle { get; set; }
    Property Value
    Type Description
    ButtonAppearance

    CanApplyTheme

    Gets or sets a value indicating whether a SkinManager theme settings can be applied to the control.

    Declaration
    public bool CanApplyTheme { get; set; }
    Property Value
    Type Description
    System.Boolean

    The default value is true.

    Remarks

    This property must be initialized before applying the VisualTheme />

    CanOverrideStyle

    Gets or sets a value indicating whether control elements styles can be overridden by theme style settings.

    Declaration
    public bool CanOverrideStyle { get; set; }
    Property Value
    Type Description
    System.Boolean

    Default value is false.

    Remarks

    By default, the control's element styles will not be overridden by theme style settings if the style is set in sample level. If this property is enabled, element style will be overridden by theme style settings event if it is set in sample level. This property should be enabled or disabled before calling the ThemeName property of the control.

    ControlName

    Gets the name of the control.

    Declaration
    public string ControlName { get; }
    Property Value
    Type Description
    System.String

    Culture

    Gets or sets the culture that is to be used for formatting the currency display.

    Declaration
    public CultureInfo Culture { get; set; }
    Property Value
    Type Description
    System.Globalization.CultureInfo

    DisplayTextAlign

    Gets or sets the text alignment. Based on the System.Windows.Forms.HorizontalAlignment, the Text in the display textbox will be aligned left or right based on this value.

    Declaration
    public HorizontalAlignment DisplayTextAlign { get; set; }
    Property Value
    Type Description
    System.Windows.Forms.HorizontalAlignment

    DoubleValue

    Gets or sets the Value of the Calculator Control as a double value.

    Declaration
    public double DoubleValue { get; set; }
    Property Value
    Type Description
    System.Double
    Remarks

    This property does not maintain its own value and converts the Calculator Value object to double.

    EnableTouchMode

    Gets or sets value to enable or disable the Touchmode to the controls.

    Declaration
    public bool EnableTouchMode { get; set; }
    Property Value
    Type Description
    System.Boolean
    Remarks

    Scale factor will be updated automatically if scalefactor is equal to 1

    FlatStyle

    Gets or sets the flat style for the Syncfusion.Windows.Forms.Tools.CalculatorButton objects.

    Declaration
    public FlatStyle FlatStyle { get; set; }
    Property Value
    Type Description
    System.Windows.Forms.FlatStyle
    Remarks

    This property raises the StyleChanged event so that the buttons can set themselves to this new FlatStyle.

    Font

    Gets / Sets the Font for the Calculator control.

    Declaration
    public override Font Font { get; set; }
    Property Value
    Type Description
    System.Drawing.Font

    HorizontalSpacing

    Gets or sets the horizontal spacing between buttons.

    Declaration
    public int HorizontalSpacing { get; set; }
    Property Value
    Type Description
    System.Int32

    IsVisualStyleEnabled

    Gets a value indicating whether the visual style based theme is applied to the CalculatorControl. This also indicates whether the theme files are referred from external assemblies or not.

    Declaration
    public bool IsVisualStyleEnabled { get; }
    Property Value
    Type Description
    System.Boolean

    Return true, if the visual style based theme is applied to CalculatorControl. Otherwise returns false.

    LayoutType

    Gets or sets the current layout type for the Calculator Control. This is of type CalculatorLayoutTypes.

    Declaration
    public CalculatorLayoutTypes LayoutType { get; set; }
    Property Value
    Type Description
    CalculatorLayoutTypes

    MetroColor

    Declaration
    public Color MetroColor { get; set; }
    Property Value
    Type Description
    System.Drawing.Color

    NumberFormatInfoObject

    Gets or sets the NumberFormatInfo object that will be used for formatting the number value.

    Declaration
    public NumberFormatInfo NumberFormatInfoObject { get; set; }
    Property Value
    Type Description
    System.Globalization.NumberFormatInfo
    Remarks

    This property will not be exposed to the developer. This is only meant to be an acccessor for use within the control. The developer will be able to access the properties of the NumberFormatInfo through the individual properties exposed.

    Office2007Theme

    Gets or sets colorschemes for Office2007 visual style.

    Declaration
    public Office2007Theme Office2007Theme { get; set; }
    Property Value
    Type Description
    Office2007Theme

    Office2010Theme

    Gets or sets colorschemes for Office2010 visual style.

    Declaration
    public Office2010Theme Office2010Theme { get; set; }
    Property Value
    Type Description
    Office2010Theme

    RepeatAssignAction

    Gets or sets a value indicating whether the assignment action (=) will repeat the previous action.

    Declaration
    public bool RepeatAssignAction { get; set; }
    Property Value
    Type Description
    System.Boolean
    Remarks

    This property raises the StyleChanged event so that the buttons can set themselves to this new FlatStyle.

    ShowDisplayArea

    Gets or sets a value indicating whether the calculator control is to display the display textbox. The textbox can be hidden and the application using the Calculator Control can handle the ValueCalculated event to display the value in their own display area / textbox.

    Declaration
    public bool ShowDisplayArea { get; set; }
    Property Value
    Type Description
    System.Boolean

    SpecialCultureValue

    Gets or sets the mode for the cultures.

    Declaration
    public SpecialCultureValues SpecialCultureValue { get; set; }
    Property Value
    Type Description
    SpecialCultureValues

    ThemeName

    Gets or sets the theme name of the control.

    Declaration
    public string ThemeName { get; set; }
    Property Value
    Type Description
    System.String

    The default value is null.

    Remarks

    This ThemeStyle settings will be applied only when the VisualStyleBased theme has been applied to the control.

    ThemesEnabled

    Gets or sets a value indicating whether themes are enabled for the Calculator Control.

    Declaration
    public bool ThemesEnabled { get; set; }
    Property Value
    Type Description
    System.Boolean
    Remarks

    This property raises the StyleChanged event so that the buttons can set themselves to this new FlatStyle.

    ThemeStyle

    Gets or sets the CalculatorControlVisualStyle value used to customize the appearance of the CalculatorControl.

    Declaration
    public CalculatorControlVisualStyle ThemeStyle { get; set; }
    Property Value
    Type Description
    CalculatorControlVisualStyle
    Remarks

    This ThemeStyle settings will be applied only when the VisualStyleBased theme has been applied to the control.

    UseUserOverride

    Gets or sets a value indicating whether the NumberFormatInfo used for formatting will use the UseUserOverride parameter for CultureInfo.

    Declaration
    public bool UseUserOverride { get; set; }
    Property Value
    Type Description
    System.Boolean
    Remarks

    The NumberTextBoxBase control has several properties that expose Culture specific information. These properties use a System.Globalization.NumberFormatInfo object for handling the culture specific information. This property is used in the creation of the NumberFormatInfo object. System.Globalization.CultureInfo.UseUserOverride

    UseVerticalAndHorizontalSpacing

    Gets or sets a value indicating whether use vertical and horizontal spacing between buttons.

    Declaration
    public bool UseVerticalAndHorizontalSpacing { get; set; }
    Property Value
    Type Description
    System.Boolean

    UseVisualStyle

    Gets or sets a value indicating whether to use visual style.

    Declaration
    public bool UseVisualStyle { get; set; }
    Property Value
    Type Description
    System.Boolean

    Value

    Gets or sets the current value of the Calculator Control.

    Declaration
    public CalculatorValue Value { get; set; }
    Property Value
    Type Description
    CalculatorValue
    Remarks

    The Value property is a shadow of the Calculator Engine's Value property.

    VerticalSpacing

    Gets or sets the vertical spacing between buttons.

    Declaration
    public int VerticalSpacing { get; set; }
    Property Value
    Type Description
    System.Int32

    Methods

    AddShortcutKey(Int32, Int32)

    Adds a shortcut key for the button.

    Declaration
    protected void AddShortcutKey(int index, int keyData)
    Parameters
    Type Name Description
    System.Int32 index

    The index of the button.

    System.Int32 keyData

    The KeyData that the button will be invoked through.

    ApplyRightToLeft()

    Applies RightToLeft based on the current culture.

    Declaration
    protected void ApplyRightToLeft()

    ApplyScaleToControl(Single)

    Scale the control based on the scale factor passed in the argument.

    Declaration
    public void ApplyScaleToControl(float scaleFactor)
    Parameters
    Type Name Description
    System.Single scaleFactor

    value to scale the factor based upon.

    ButtonAction(CalcActions)

    The Calculator Buttons will use this method to call back a click action and pass in their CalcActions type action property.

    Declaration
    public void ButtonAction(CalcActions action)
    Parameters
    Type Name Description
    CalcActions action

    The action that is to be performed.

    CreateCalculatorDisplayBox()

    Creates the display textbox.

    Declaration
    protected virtual void CreateCalculatorDisplayBox()
    Remarks

    This method creates the TextBox that will be used by the Calculator Control to display the value of the calculations.

    Dispose(Boolean)

    Cleans up any resources being used.

    Declaration
    protected override void Dispose(bool disposing)
    Parameters
    Type Name Description
    System.Boolean disposing

    Bool value for disposing

    DrawBorder(Graphics)

    Draws a border around the Calculator Control.

    Declaration
    protected virtual void DrawBorder(Graphics g)
    Parameters
    Type Name Description
    System.Drawing.Graphics g

    the Graphics object to draw on.

    Remarks

    The type of the border drawn is based on the System.Windows.Forms.Border3DStyle property.

    EngineValueChanged(CalculatorValue, Boolean, String, Double)

    The calculator engine will invoke this method for its parent to be informed of a change in its value.

    Declaration
    public void EngineValueChanged(CalculatorValue internalValue, bool errorCondition, string feedbackMessage, double memoryValue)
    Parameters
    Type Name Description
    CalculatorValue internalValue

    The internal string value of the engine.

    System.Boolean errorCondition

    The error condition.

    System.String feedbackMessage

    The feedback message.

    System.Double memoryValue

    The memory value.

    FormatChanged(NumberFormatInfo)

    Declaration
    protected virtual void FormatChanged(NumberFormatInfo previousFormat)
    Parameters
    Type Name Description
    System.Globalization.NumberFormatInfo previousFormat

    GetActiveThemeName()

    Gets the active theme name of the control.

    Declaration
    public virtual string GetActiveThemeName()
    Returns
    Type Description
    System.String

    Returns the active theme name.

    GetButtonColor(CalcActions)

    Returns the button caption color.

    Declaration
    public Color GetButtonColor(CalcActions caCalcButton)
    Parameters
    Type Name Description
    CalcActions caCalcButton

    Calculator button.

    Returns
    Type Description
    System.Drawing.Color

    Returns Button Color

    GetButtonFont(CalcActions)

    Returns the button caption font.

    Declaration
    public Font GetButtonFont(CalcActions caCalcButton)
    Parameters
    Type Name Description
    CalcActions caCalcButton

    Calculator button.

    Returns
    Type Description
    System.Drawing.Font

    Returns button Font.

    GetControlName(String)

    Helps to override the ThemeName property settings

    Declaration
    public virtual string GetControlName(string controlName)
    Parameters
    Type Name Description
    System.String controlName

    ThemeName

    Returns
    Type Description
    System.String

    GetCopyOfCurrentNumberFormatInfo()

    Returns a copy of the current NumberFormatInfo.

    Declaration
    protected NumberFormatInfo GetCopyOfCurrentNumberFormatInfo()
    Returns
    Type Description
    System.Globalization.NumberFormatInfo

    Returns Numberformat info

    GetLayoutManager()

    Returns the current layout manager for the calculator.

    Declaration
    public GridBagLayout GetLayoutManager()
    Returns
    Type Description
    GridBagLayout

    The current layout manager for the calculator.

    GetLayoutManager(CalculatorLayoutTypes)

    Returns the layout manager for this layout type.

    Declaration
    public GridBagLayout GetLayoutManager(CalculatorLayoutTypes layoutType)
    Parameters
    Type Name Description
    CalculatorLayoutTypes layoutType

    The layout type.

    Returns
    Type Description
    GridBagLayout

    The layout manager.

    HandleBoundsChanged(Object, EventArgs)

    Handles the BoundsChanged event. This initiates a refresh of the layout.

    Declaration
    protected void HandleBoundsChanged(object sender, EventArgs e)
    Parameters
    Type Name Description
    System.Object sender

    The calculator control.

    System.EventArgs e

    The event data.

    HandleChildKeyDown(KeyEventArgs)

    Handles the KeyDown event of the child controls.

    Declaration
    public void HandleChildKeyDown(KeyEventArgs e)
    Parameters
    Type Name Description
    System.Windows.Forms.KeyEventArgs e

    The KeyEventArgs for the event data.

    InitializeCalculatorDisplay()

    Initializes the calculator display.

    Declaration
    protected virtual void InitializeCalculatorDisplay()
    Remarks

    The display TextBox and the memory value display label are created and initialized.

    The calculator buttons are created and added to the CalculatorControl.

    InitializeCalculatorEngine()

    Initalizes the CalculatorEngine that will perform the calculations.

    Declaration
    protected virtual void InitializeCalculatorEngine()
    Remarks

    The CalculatorEngine is initialized and the CalculatorControl sets the interface for communicating with the CalculatorEngine.

    InitializeFinancialLayout()

    Initializes the Financial layout for the Calculator Control.

    Declaration
    protected void InitializeFinancialLayout()
    Remarks

    The Financial Layout resembles the layout of the calculator popularized by the Quicken(r) products. Most of the functionality is geared towards simple banking arithmetic.

    InitializeLayoutAndAddControls()

    Initialized the layout managers and the controls. This method initializes all the controls that needs to be initialized for a layout.

    Declaration
    public void InitializeLayoutAndAddControls()

    InitializeWindowsStandardLayout()

    Initializes the WindowsStandard layout for the Calculator Control.

    Declaration
    protected void InitializeWindowsStandardLayout()
    Remarks

    The Windows Standard Layout resembles the layout of the calculator provides with the windows operating system. Most of the functionality is the same as the operation of the Windows operating system calculator.

    OnBackColorChanged(EventArgs)

    Overrides the System.Windows.Forms.Control.OnBackColorChanged(System.EventArgs) method.

    Declaration
    protected override void OnBackColorChanged(EventArgs arg)
    Parameters
    Type Name Description
    System.EventArgs arg

    The event data.

    Remarks

    This method is overriden in order to set the color of the child buttons to be the same as the backcolor of the Calculator Control.

    OnCanApplyThemeChanged(Boolean)

    Helps to override the CanApplyTheme property settings

    Declaration
    public virtual void OnCanApplyThemeChanged(bool canApplyTheme)
    Parameters
    Type Name Description
    System.Boolean canApplyTheme

    OnCanOverrideStyleChanged(Boolean)

    Helps to override the CanOverriderStyle property settings

    Declaration
    public virtual void OnCanOverrideStyleChanged(bool canOverrideStyle)
    Parameters
    Type Name Description
    System.Boolean canOverrideStyle

    OnFlatStyleChange(CalculatorStyleChangedEventArgs)

    Invokes the FlatStyleChange event.

    Declaration
    protected virtual void OnFlatStyleChange(CalculatorStyleChangedEventArgs args)
    Parameters
    Type Name Description
    CalculatorStyleChangedEventArgs args

    A StyleChangedEventArgs that contains the event data.

    Remarks

    The OnFlatStyleChange method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

    note

    Inheritors: When overriding OnFlatStyleChange in a derived class, be sure to call the base class's OnFlatStyleChange method so that registered delegates receive the event.

    OnFontChanged(EventArgs)

    Font changed event

    Declaration
    protected override void OnFontChanged(EventArgs e)
    Parameters
    Type Name Description
    System.EventArgs e

    OnLayoutTypeChange(CalculatorLayoutTypeChangedEventArgs)

    Invokes the LayoutTypeChange event.

    Declaration
    protected virtual void OnLayoutTypeChange(CalculatorLayoutTypeChangedEventArgs args)
    Parameters
    Type Name Description
    CalculatorLayoutTypeChangedEventArgs args

    A LayoutTypeChangedEventArgs that contains the event data.

    Remarks

    The OnLayoutTypeChange method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

    note

    Inheritors: When overriding OnLayoutTypeChange in a derived class, be sure to call the base class's OnLayoutTypeChange method so that registered delegates receive the event.

    OnOffice2007ThemeChanged()

    Raises the Office2007Theme event.

    Declaration
    protected virtual void OnOffice2007ThemeChanged()

    OnOffice2010ThemeChanged()

    Raises the Office2007Theme event.

    Declaration
    protected virtual void OnOffice2010ThemeChanged()

    OnPaint(PaintEventArgs)

    Overrides the System.Windows.Forms.Control.OnPaint(System.Windows.Forms.PaintEventArgs) method.

    Declaration
    protected override void OnPaint(PaintEventArgs pe)
    Parameters
    Type Name Description
    System.Windows.Forms.PaintEventArgs pe

    The Paint event data.

    Remarks

    This override is for drawing a border around the Calculator Control by invoking the DrawBorder(Graphics) method.

    OnSizeChanged(EventArgs)

    Declaration
    protected override void OnSizeChanged(EventArgs e)
    Parameters
    Type Name Description
    System.EventArgs e

    OnThemeNameChanged(String)

    Helps to override the ThemeName property settings

    Declaration
    public virtual void OnThemeNameChanged(string themeName)
    Parameters
    Type Name Description
    System.String themeName

    ThemeName

    OnValueCalculated(CalculatorValueCalculatedEventArgs)

    Raises the ValueCalculated event.

    Declaration
    protected virtual void OnValueCalculated(CalculatorValueCalculatedEventArgs arg)
    Parameters
    Type Name Description
    CalculatorValueCalculatedEventArgs arg

    The event data for the ValueCalculated event.

    Remarks

    This event is raised when there is a change in the Value property of the CalculatorControl. The handler can output the value to its own display area. This helps customize the Calculator control usage and the default display area of the CalculatorControl can be hidden and the display can be another suitable display area.

    ProcessDialogKey(Keys)

    Processes the dialog key.

    Declaration
    protected override bool ProcessDialogKey(Keys keyData)
    Parameters
    Type Name Description
    System.Windows.Forms.Keys keyData

    One of the Keys values that represents the key to process.

    Returns
    Type Description
    System.Boolean

    Returns bool value

    Remarks

    This is overriden in order to capture and process enterkey input

    RaiseFlatStyleChangedEvent()

    Raises the FlatStyleChangedEvent.

    Declaration
    protected void RaiseFlatStyleChangedEvent()

    RaiseLayoutTypeChangedEvent()

    Raises the LayoutTypeChangedEvent.

    Declaration
    protected void RaiseLayoutTypeChangedEvent()

    RaiseThemeChanged(Object, ThemeChangedEventArgs)

    Raises the ThemeNameChanged event when theme name changed.

    Declaration
    protected virtual void RaiseThemeChanged(object sender, ThemeChangedEventArgs args)
    Parameters
    Type Name Description
    System.Object sender

    The sender value.

    ThemeChangedEventArgs args

    A ThemeChangedEventArgs contains the event data.

    RaiseThemesChangedEvent()

    Raises the FlatStyleChangedEvent.

    Declaration
    protected void RaiseThemesChangedEvent()

    RefreshMemoryLabel(Double)

    Refreshes the memory label based on the new memory value.

    Declaration
    public void RefreshMemoryLabel(double memoryValue)
    Parameters
    Type Name Description
    System.Double memoryValue

    The memory value.

    Remarks

    The memory label is set to M if the memory value is > 0 and empty otherwise.

    ResetBackgroundColor()

    Declaration
    protected void ResetBackgroundColor()

    ResetCalculator()

    Resets the calculator and initializes the internal calculator engine.

    Declaration
    public void ResetCalculator()

    SetButton(Int32, CalculatorButtonStyle, CalcActions, String)

    Sets the characteristics for a button with the current layout. This helper method is invoked when a Layout is initialized for each calculator button.

    Declaration
    public void SetButton(int index, CalculatorButtonStyle btnStyle, CalcActions action, string title)
    Parameters
    Type Name Description
    System.Int32 index

    The index of the button.

    CalculatorButtonStyle btnStyle

    The Button style.

    CalcActions action

    The Button action.

    System.String title

    The caption of the button.

    SetButtonColor(CalcActions, Color)

    Sets the button caption color.

    Declaration
    public void SetButtonColor(CalcActions caCalcButton, Color color)
    Parameters
    Type Name Description
    CalcActions caCalcButton

    Calculator button.

    System.Drawing.Color color

    Color to set.

    SetButtonFont(CalcActions, Font)

    Sets the button caption font.

    Declaration
    public void SetButtonFont(CalcActions caCalcButton, Font font)
    Parameters
    Type Name Description
    CalcActions caCalcButton

    Calculator button.

    System.Drawing.Font font

    Font to set.

    SetDisplayString()

    Transfers the current value to the display.

    Declaration
    public void SetDisplayString()
    Remarks

    This method displays output only if the ShowDisplayArea property is set to true.

    SetTextBoxColor()

    Modifies the properties of the TextBox used for displaying the calculated value.

    Declaration
    protected virtual void SetTextBoxColor()
    Remarks

    The TextBox is enabled and the forecolor and backcolor properties are changed.

    ShouldSerializeBackgroundColor()

    Declaration
    protected bool ShouldSerializeBackgroundColor()
    Returns
    Type Description
    System.Boolean

    Events

    FlatStyleChanged

    Raised when the FlatStyle changes for the Calculator Control.

    Declaration
    public event CalculatorStyleChangedEventHandler FlatStyleChanged
    Event Type
    Type Description
    CalculatorStyleChangedEventHandler
    Remarks

    The Calculator Control maintains the same flatstyle for all its child buttons. This event is handled by all the buttons and they set their flatstyle property appropriately.

    LayoutTypeChanged

    Raised when the LayoutType changes.

    Declaration
    public event CalculatorLayoutTypeChangedEventHandler LayoutTypeChanged
    Event Type
    Type Description
    CalculatorLayoutTypeChangedEventHandler
    Remarks

    Other classes that need to be aware of the current layout of the Calculator Control or just need to know that the layout has changed so that they can reinitialize themselves, can handle this event.

    Office2007ThemeChanged

    Occurs when the Office2007Theme property is changed.

    Declaration
    public event EventHandler Office2007ThemeChanged
    Event Type
    Type Description
    System.EventHandler

    Office2010ThemeChanged

    Occurs when the Office2010Theme property is changed.

    Declaration
    public event EventHandler Office2010ThemeChanged
    Event Type
    Type Description
    System.EventHandler

    ThemeNameChanged

    Occurs when theme name of the control has changed.

    Declaration
    public event ThemeChangedEventHandler ThemeNameChanged
    Event Type
    Type Description
    ThemeChangedEventHandler

    ValueCalculated

    Raised when the Value of the calculator control changes.

    Declaration
    public event CalculatorValueCalculatedEventHandler ValueCalculated
    Event Type
    Type Description
    CalculatorValueCalculatedEventHandler
    Remarks

    Handle this event if you want to do some processing when the Value changes.

    Examples
    this.calculatorControl1.ValueCalculated += new Syncfusion.Windows.Forms.Tools.CalculatorControl.ValueCalculatedEventHandler(this.CodeGen_calculatorControl1_ValueCalculated);
    calculatorControl1_ValueCalculated
    if(arg.ErrorCondition == false)
    this.textBox1.Text = arg.Value.ToString();
    else
    this.textBox1.Text = arg.Message;

    
    AddHandler Me.calculatorControl1.ValueCalculated, New Syncfusion.Windows.Forms.Tools.CalculatorControl.ValueCalculatedEventHandler(AddressOf CodeGen_calculatorControl1_ValueCalculated)
    'calculatorControl1_ValueCalculated
    If (arg.ErrorCondition = False) Then
    Me.textBox1.Text = arg.Value.ToString
    Else
    Me.textBox1.Text = arg.Message
    End If

    Explicit Interface Implementations

    IVisualStyle.VisualTheme

    Gets or sets the VisualTheme of the control.

    Declaration
    string IVisualStyle.VisualTheme { get; set; }
    Returns
    Type Description
    System.String

    IThemeProvider.BaseThemeName

    Gets or sets the Base Theme name of the theme

    Declaration
    string IThemeProvider.BaseThemeName { get; set; }
    Returns
    Type Description
    System.String

    Implements

    ICalculatorEngineParent
    ICalculatorButtonParent
    IThemeProvider
    IVisualStyle
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved