Friday, February 13, 2015

FlexToolBarSlider


FlexToolBarSlider class
It derived from FlexToolBarBaseButton. This tool item allows you select from a range of values by moving a Thumb along a Track.
Examples
The following example shows how to use the CommandID attribute of a tool item.
public partial class MySlider : FlexToolBarSlider
{
public MySlider() : base()
{
// ******* //
CommandID = SLIDER_COMMAND_ID;
}
}

class SliderCommand : LinsUICommand
{
public SliderCommand(long nCommandID, object data) : base(nCommandID, data)
{
// Assign a help file to this command. The help file must be stored at the location
// specified by FlexUISettings.DefaultHelpFilePath,
HelpFile = "Slider.rtf";
}

public override void Execute(object parameter)
{
base.Execute(parameter);

// Execute your command //
}

[CommandEventAttribute(COMMAND_EVENT.THUMBDRAG_STARTED)]
protected void DragStart(object sender, EventArgs e)
{
// ******* //
}

[CommandEventAttribute(COMMAND_EVENT.THUMBDRAG_COMPLETED)]
protected void DragCompleted(object sender, EventArgs e)
{
// ******* //
}

public override bool CanExecute(object parameter)
{
return true;
}
}

public partial class MainWindow : LinsMDIWindow
{
public MainWindow()
{
InitializeComponent();
CreateCommands();
}

private void CreateCommands()
{
// Create SLIDER command instance
LinsUICommand command = new SliderCommand(SLIDER_COMMAND_ID, null);
}
}

§  Constructors
1)  public FlexToolBarSlider()
Remarks
Initialize a new instance of FlexToolBarSlider
§  Members
1)  public virtual ToolBarItemDisplayStyle Appearence { get; set; }
Remarks
Gets or sets the appearance of the tool item. The default is ToolBarItemDisplayStyle.ImageAndText. It can be one of the following values,
§   None:             
Assigned Text and assigned Icon are to be rendered.
§   Text:                
Only Text is to be rendered.
§   Image:         
Only Icon is to be rendered.
§   ImageAndText:              
Both Text and Icon are to be rendered.
2)  public virtual Rect Bounds { get; }
Remarks
Retrieve both the size and the location of the tool item, in pixels, relative to its parent.
3)  public virtual Rect BoundsAtMDIFrame { get; }
Remarks
Retrieve both the size and the location of the tool item, in pixels, relative to MDI frame.
4)  public virtual bool Checked { get; set; }
Remarks
Gets or sets the check status of the tool item. The default is false.
5)  public long CommandID { get; set; }               
Remarks
If this attribute is assigned, then this tool item will be associated to the correspondent command with the same CommandID. See the above example for creating a command. 
6)  public int Delay { get; set; }
Remarks
Gets or sets the amount of time in milliseconds that a RepeatButton waits, while it is pressed, before a command to move the Thumb executes, such as a DecreaseLarge command,
7)  public double ExpandedLength { get; set; }
Remarks
Gets or sets the length of a Slider, when mouse hovers above the slider.
8)  public FontFamily Font { get; set; }
Remarks
Gets or sets the font of the tool item. The default is SystemFonts.MenuFontFamily.
9)  public Color FontColor { get; set; }
Remarks
Gets or sets the font color of the tool item. The default is SystemManager.FlexParameters.DefaultToolItemFontColor.
10)public double FontSize { get; set; }
Remarks
Gets or sets the font size of the tool item. The default is SystemFonts.MenuFontSize.
11)public FontStyle FontStyle { get; set; }
Remarks
Gets or sets the font style of the tool item. The default is normal.
12)public FontWeight FontWeight { get; set; }
Remarks
Gets or sets the font weight of the tool item. The default is normal.
13)public string HelpContext { get; set; }
Remarks
Gets or sets the help content for the tool item. If this tool item has been associated to a command (CommandID attribute is assigned), then this attribute will be ignored, instead the COMMAND_EVENT.HELPBUTTON_CLICK event defined inside the correspondent command will be executed once the help button on the tooltip is clicked.
14)public string HelpFile { get; set; }
Remarks
Gets or sets the help file for the tool item. If this tool item has been associated to a command (CommandID attribute is assigned), then this attribute will be ignored, instead the COMMAND_EVENT.HELPBUTTON_CLICK event defined inside the correspondent command will be executed once the help button on the tooltip is clicked.
15)public virtual ImageSource Icon { get; set; }
Remarks
Gets or sets the icon of the tool item.
16)public double IconSize { get; set; }
Remarks
Gets or sets the icon size of the tool item. The default is 16 pixels.
17)public virtual long ID { get; set; }               
Remarks
Every tool item should have a unique ID. If the user does not assign a number to the ID, a unique number which is larger than FlexConstants.m_nUserDefinedControlStartID (10,000,000) will be automatically generated and assigned to it. If the ID is between FlexConstants.m_nUserDefinedControlStartID (1000) and FlexConstants.m_nUserDefinedControlStartID (10,000,000), then once the tool item is created, it will never been destroyed, and its layout will be persistent and customizable. You can always use LinsUIToolItemManager.GetToolItem() to retrieve its instance, once it is created.
18)public int Interval { get; set; }
Remarks
Gets or sets the amount of time in milliseconds between increase or decrease commands when a user clicks the RepeatButton of a Slider,
19)public bool IsCheckable { get; set; }
Remarks
Gets or sets the check ability of the tool item. The default is false.
20)public bool IsMoveToPointEnabled { get; set; }
Remarks
Gets or sets a value that indicates whether the Thumb of a Slider moves immediately to the location of the mouse click that occurs while the mouse pointer pauses on the Slider track,
21)public bool IsSelectionRangeEnabled { get; set; }
Remarks
Gets or sets a value that indicates whether the Slider displays a selection range along the Slider.
22)public bool IsSnapToTickEnabled { get; set; }
Remarks
Gets or sets a value that indicates whether the Slider automatically moves the Thumb to the closest tick mark.
23)public double Maximum { get; set; }
Remarks
Gets or sets the highest possible Value of the range element.
24)public double Minimum { get; set; }
Remarks
Gets or sets the lowest possible Value of the range element.
25)public Orientation Orientation { get; set; }
Remarks
Gets or sets the orientation of a Slider.
26)public virtual TextImageRelation Relation { get; set; }
Remarks
Gets or sets the appearance of the tool item. The default is TextImageRelation.TextBeforeImage. It can be one of the following values,
§   Overlay:             
The Icon and the Text share the same space.
§   ImageAboveText:                
The Icon is displayed vertically above the Text.
§   TextAboveImage:         
The Text is displayed vertically above the Icon.
§   ImageBeforeText:              
The Icon is displayed horizontally before the Text.
§   TextBeforeImage:              
The Text is displayed horizontally before the Icon.
27)public double SelectionEnd { get; set; }
Remarks
Gets or sets the largest value of a specified selection for a Slider.
28)public double SelectionStart { get; set; }
Remarks
Gets or sets the smallest value of a specified selection for a Slider.
29)public double SliderLength { get; set; }
Remarks
Gets or sets the slider width. 
30)public override string Text { get; set; }
Remarks
Gets or sets the text of the tool item.
31)public double TickFrequency { get; set; }
Remarks
Gets or sets the interval between tick marks.
32)public TickPlacement TickPlacement { get; set; }
Remarks
Gets or sets the position of tick marks with respect to the Track of the Slider.
33)public DoubleCollection Ticks { get; set; }
Remarks
Gets or sets the positions of the tick marks to display for a Slider.
34)public string ToolTipText { get; set; }
Remarks
Gets or sets the tooltip of the tool item.
35)public double Value { get; set; }
Remarks
Gets or sets the current magnitude of the range control.
§  Methods
1)  public virtual bool HitTest(
Point ptMousePosAtMDIFrame)                 
Parameters
ptMousePosAtMDIFrame
Type: Point
A location which is in MDI Frame coordinate. 
Remarks
Test whether the point, ptMousePosAtMDIFrame, which is in MDI Frame coordinate, is inside this tool item.
2)  public override Size MeasureSize(
bool bDropDown,
FLEX_DOCKING_ALIGN nDock)              
Parameters
bDropDown
Type: bool
True, if this tool item is on a dropdown list, for example a context menu or a sub-menu.            
nDock
Type: FLEX_DOCKING_ALIGN
The docking style of the tool item’s container. Always pass in FLEX_DOCKING_ALIGN .TOP, except the container is a FlexToolBar, and then pass the toolbar’s FlexDock.            
Remarks
This calculates how much space the tool item requires. If the user wants to customize the tool item, this method may need to be overridden by the user.
3)  public virtual void OnThumbDragCompleted(
DragCompletedEventArgs e)                 
Parameters
e
Type: DragCompletedEventArgs
The event data. 
Remarks
Provides class handling for the DragCompleted event that occurs when the user stops dragging the Thumb of the Slider.
4)  public virtual void OnThumbDragDelta(
DragDeltaEventArgs e)                 
Parameters
e
Type: DragDeltaEventArgs
The event data. 
Remarks
Provides class handling for the DragDelta event that occurs when the user drags the Thumb of the Slider.
5)  public virtual void OnThumbDragStarted(
DragStartedEventArgs e)                 
Parameters
e
Type: DragStartedEventArgs
The event data. 
Remarks
Provides class handling for the DragStarted event that occurs when the user starts to drag the Thumb of the Slider.
6)  public virtual void OnValueChanged(
double oldValue,
double newValue)                 
Parameters
oldValue
Type: double
The old value of the slider. 
newValue
Type: double
The new value of the slider. 
Remarks
Updates the current position of the Slider when the Value property changes.
7)  public virtual void Refresh()              
Remarks
This forces to redraw the tool item.  
§  Events
1)     public event DragCompletedEventHandler DragCompleted              
Remarks
This event is fired when finishing the dragging the Thumb of the Slider.  
2)     public event RoutedEventHandler GotFocus              
Remarks
This event is fired when the tool item receives focus.  
3)     public event RoutedEventHandler LostFocus              
Remarks
This event is fired when the tool item lost focus.  
4)     public event RoutedPropertyChangedEventHandler<double> ValueChanged              
Remarks
This event is fired when the range value changes.  


References:

No comments:

Post a Comment