Class DialogControl
Base class for all dialog controls such as ButtonControl, TextBoxControl.
Inheritance
Inherited Members
Namespace: FastReport.Dialog
Assembly: FastReport.dll
Syntax
public abstract class DialogControl : DialogComponentBase, IComponent, IDisposable, IFRSerializable, IHasEditor
Properties
Anchor
Gets or sets the edges of the container to which a control is bound and determines how a control is resized with its parent. Wraps the System.Windows.Forms.Control.Anchor property.
Declaration
public override AnchorStyles Anchor { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Forms.AnchorStyles |
Overrides
BackColor
Gets or sets the background color for the control. Wraps the System.Windows.Forms.Control.BackColor property.
Declaration
public virtual Color BackColor { get; set; }
Property Value
Type | Description |
---|---|
System.Drawing.Color |
BindableProperty
Gets or sets a property that returns actual data contained in a control. This value is used in the "Data" window.
Declaration
[Browsable(false)]
public PropertyInfo BindableProperty { get; set; }
Property Value
Type | Description |
---|---|
System.Reflection.PropertyInfo |
ClickEvent
Gets or sets a script method name that will be used to handle the Click event.
Declaration
public string ClickEvent { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Control
Gets an internal Control.
Declaration
[Browsable(false)]
public Control Control { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Forms.Control |
Cursor
Gets or sets the cursor that is displayed when the mouse pointer is over the control. Wraps the System.Windows.Forms.Control.Cursor property.
Declaration
public Cursor Cursor { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Forms.Cursor |
Dock
Gets or sets which control borders are docked to its parent control and determines how a control is resized with its parent. Wraps the System.Windows.Forms.Control.Dock property.
Declaration
public override DockStyle Dock { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Forms.DockStyle |
Overrides
DoubleClickEvent
Gets or sets a script method name that will be used to handle the DoubleClick event.
Declaration
public string DoubleClickEvent { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Enabled
Gets or sets a value indicating whether the control can respond to user interaction. Wraps the System.Windows.Forms.Control.Enabled property.
Declaration
public bool Enabled { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
EnterEvent
Gets or sets a script method name that will be used to handle the Enter event.
Declaration
public string EnterEvent { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Font
Gets or sets the font of the text displayed by the control. Wraps the System.Windows.Forms.Control.Font property.
Declaration
public Font Font { get; set; }
Property Value
Type | Description |
---|---|
System.Drawing.Font |
ForeColor
Gets or sets the foreground color of the control. Wraps the System.Windows.Forms.Control.ForeColor property.
Declaration
public virtual Color ForeColor { get; set; }
Property Value
Type | Description |
---|---|
System.Drawing.Color |
Height
Gets or sets the height of the object.
Declaration
public override float Height { get; set; }
Property Value
Type | Description |
---|---|
System.Single |
Overrides
Remarks
This property value is measured in the screen pixels. Use Units class to convert a value to desired units.
KeyDownEvent
Gets or sets a script method name that will be used to handle the KeyDown event.
Declaration
public string KeyDownEvent { get; set; }
Property Value
Type | Description |
---|---|
System.String |
KeyPressEvent
Gets or sets a script method name that will be used to handle the KeyPress event.
Declaration
public string KeyPressEvent { get; set; }
Property Value
Type | Description |
---|---|
System.String |
KeyUpEvent
Gets or sets a script method name that will be used to handle the KeyUp event.
Declaration
public string KeyUpEvent { get; set; }
Property Value
Type | Description |
---|---|
System.String |
LeaveEvent
Gets or sets a script method name that will be used to handle the Leave event.
Declaration
public string LeaveEvent { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Left
Gets or sets the left coordinate of the object in relation to its container.
Declaration
public override float Left { get; set; }
Property Value
Type | Description |
---|---|
System.Single |
Overrides
Remarks
This property value is measured in the screen pixels. Use Units class to convert a value to desired units.
To obtain absolute coordinate, use AbsLeft property.
MouseDownEvent
Gets or sets a script method name that will be used to handle the MouseDown event.
Declaration
public string MouseDownEvent { get; set; }
Property Value
Type | Description |
---|---|
System.String |
MouseEnterEvent
Gets or sets a script method name that will be used to handle the MouseEnter event.
Declaration
public string MouseEnterEvent { get; set; }
Property Value
Type | Description |
---|---|
System.String |
MouseLeaveEvent
Gets or sets a script method name that will be used to handle the MouseLeave event.
Declaration
public string MouseLeaveEvent { get; set; }
Property Value
Type | Description |
---|---|
System.String |
MouseMoveEvent
Gets or sets a script method name that will be used to handle the MouseMove event.
Declaration
public string MouseMoveEvent { get; set; }
Property Value
Type | Description |
---|---|
System.String |
MouseUpEvent
Gets or sets a script method name that will be used to handle the MouseUp event.
Declaration
public string MouseUpEvent { get; set; }
Property Value
Type | Description |
---|---|
System.String |
PaintEvent
Gets or sets a script method name that will be used to handle the Paint event.
Declaration
public string PaintEvent { get; set; }
Property Value
Type | Description |
---|---|
System.String |
ResizeEvent
Gets or sets a script method name that will be used to handle the Resize event.
Declaration
public string ResizeEvent { get; set; }
Property Value
Type | Description |
---|---|
System.String |
RightToLeft
Gets or sets a value indicating whether control's elements are aligned to support locales using right-to-left fonts. Wraps the System.Windows.Forms.Control.RightToLeft property.
Declaration
public RightToLeft RightToLeft { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Forms.RightToLeft |
TabIndex
Gets or sets the tab order of the control within its container. Wraps the System.Windows.Forms.Control.TabIndex property.
Declaration
public int TabIndex { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
TabStop
Gets or sets a value indicating whether the user can give the focus to this control using the TAB key. Wraps the System.Windows.Forms.Control.TabStop property.
Declaration
public bool TabStop { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Text
Gets or sets the text associated with this control. Wraps the System.Windows.Forms.Control.Text property.
Declaration
public virtual string Text { get; set; }
Property Value
Type | Description |
---|---|
System.String |
TextChangedEvent
Gets or sets a script method name that will be used to handle the TextChanged event.
Declaration
public string TextChangedEvent { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Top
Gets or sets the top coordinate of the object in relation to its container.
Declaration
public override float Top { get; set; }
Property Value
Type | Description |
---|---|
System.Single |
Overrides
Remarks
This property value is measured in the screen pixels. Use Units class to convert a value to desired units.
To obtain absolute coordinate, use AbsTop property.
Visible
Gets or sets a value indicating whether the control is displayed. Wraps the System.Windows.Forms.Control.Visible property.
Declaration
public override bool Visible { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Overrides
Width
Gets or sets the width of the object.
Declaration
public override float Width { get; set; }
Property Value
Type | Description |
---|---|
System.Single |
Overrides
Remarks
This property value is measured in the screen pixels. Use Units class to convert a value to desired units.
Methods
AttachEvents()
Attaches Control events to its event handlers.
Declaration
protected virtual void AttachEvents()
Remarks
Override this method if your custom control has own events.
Examples
See the example of AttachEvents implementation used in the CheckBoxControl:
protected override void AttachEvents()
{
base.AttachEvents();
CheckBox.CheckedChanged += new EventHandler(CheckBox_CheckedChanged);
}
private void CheckBox_CheckedChanged(object sender, EventArgs e)
{
if (CheckedChanged != null)
CheckedChanged(this, e);
InvokeEvent(CheckedChangedEvent, e);
}
CheckParent(Boolean)
Checks if the object is inside its parent.
Declaration
public override void CheckParent(bool immediately)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | immediately | if true, check now independent of any conditions. |
Overrides
Remarks
Typically you don't need to use or override this method.
When you move an object with the mouse, it may be moved outside its parent. If so, this method must find a new parent for the object and correct it's Left, Top and Parent properties. If immediately parameter is false, you can optimize the method to search for new parent only if the object's bounds are outside parent. If this parameter is true, you must skip any optimizations and search for a parent immediately.
DetachEvents()
Detaches Control events from its event handlers.
Declaration
protected virtual void DetachEvents()
Remarks
Override this method if your custom control has own events. In this method, you should detach control's events that were attached in the AttachEvents() method.
Examples
See the example of DetachEvents implementation used in the CheckBoxControl:
protected override void DetachEvents()
{
base.DetachEvents();
CheckBox.CheckedChanged -= new EventHandler(CheckBox_CheckedChanged);
}
Dispose(Boolean)
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
Overrides
Draw(FRPaintEventArgs)
Draws the object.
Declaration
public override void Draw(FRPaintEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
FRPaintEventArgs | e | Paint event args. |
Overrides
Remarks
This method is widely used in the FastReport. It is called each time when the object needs to draw or print itself.
In order to draw the object correctly, you should multiply the object's bounds by the scale parameter.
cache parameter is used to optimize the drawing speed. It holds all items such as pens, fonts, brushes, string formats that was used before. If the item with requested parameters exists in the cache, it will be returned (instead of create new item and then dispose it).
DrawSelection(FRPaintEventArgs)
Draw the selection points.
Declaration
public override void DrawSelection(FRPaintEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
FRPaintEventArgs | e | Paint event args. |
Overrides
Remarks
This method draws a set of selection points returned by the FastReport.ComponentBase.GetSelectionPoints() method.
DrawSelectionPoint(Graphics, Pen, Brush, Single, Single)
Draws the selection point.
Declaration
protected void DrawSelectionPoint(Graphics g, Pen p, Brush b, float x, float y)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | Graphics object to draw on. |
System.Drawing.Pen | p | System.Drawing.Pen object. |
System.Drawing.Brush | b | System.Drawing.Brush object. |
System.Single | x | Left coordinate. |
System.Single | y | Top coordinate. |
FinalizeControl()
Finalizes the control after its parent form is closed.
Declaration
public virtual void FinalizeControl()
Remarks
This method is called when report is run.
Focus()
Sets input focus to the control.
Declaration
public void Focus()
GetSelectionPoints()
Gets the object's selection points.
Declaration
protected override SelectionPoint[] GetSelectionPoints()
Returns
Type | Description |
---|---|
SelectionPoint[] | Array of SelectionPoint objects. |
Overrides
Remarks
Selection point is a small square displayed at the object's sides when object is selected in the designer. You can drag this square by the mouse to change the object's size. For example, the TextObject has eight selection points to change its width and height by the mouse.
If you are developing a new component for FastReport, you may override this method if your object has non-standard set of selection points. For example, if an object has something like "AutoSize" property, it would be good to disable all selection points if that property is true, to disable resizing of the object by the mouse.
Hide()
Conceals the control from the user.
Declaration
public void Hide()
InitializeControl()
Initializes the control before display it in the dialog form.
Declaration
public virtual void InitializeControl()
Remarks
This method is called when report is run.
InvokeEditor()
Creates the empty event handler for the ClickEvent event in the report's script.
Declaration
public bool InvokeEditor()
Returns
Type | Description |
---|---|
System.Boolean | true if event handler was created successfully. |
OnBeforeInsert(Int32)
Called before inserting a new object in the designer.
Declaration
public override void OnBeforeInsert(int flags)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | flags | Object's flags. |
Overrides
Remarks
Do not call this method directly. You may override it if you are developing a new component for FastReport.
Some objects are registered in the designer several times with the same object type, but different flags. For example, the ShapeObject represents different shapes: rectangle, roundrect, ellipse and so on. All these shapes are registered in the designer using flags (the last parameter in this code):
RegisteredObjects.Add(typeof(ShapeObject), "ReportPage,Shapes", 108, "Objects,Shapes,Rectangle", 0);
RegisteredObjects.Add(typeof(ShapeObject), "ReportPage,Shapes", 109, "Objects,Shapes,RoundRectangle", 1);
RegisteredObjects.Add(typeof(ShapeObject), "ReportPage,Shapes", 110, "Objects,Shapes,Ellipse", 2);
When we put the "Ellipse" object on a band, the designer creates the ShapeObject instance and calls its OnBeforeInsert method with flags value set to 2. In turn, the OnBeforeInsert method converts the int value of the flags to the shape kind:
public override void OnBeforeInsert(int flags)
{
FShape = (ShapeKind)flags;
}
OnClick(EventArgs)
This method fires the Click event and the script code connected to the ClickEvent.
Declaration
public virtual void OnClick(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | Event data. |
OnDoubleClick(EventArgs)
This method fires the DoubleClick event and the script code connected to the DoubleClickEvent.
Declaration
public virtual void OnDoubleClick(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | Event data. |
OnEnabledChanged()
Called when the control's Enabled state changed.
Declaration
protected virtual void OnEnabledChanged()
OnEnter(EventArgs)
This method fires the Enter event and the script code connected to the EnterEvent.
Declaration
public virtual void OnEnter(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | Event data. |
OnKeyDown(KeyEventArgs)
This method fires the KeyDown event and the script code connected to the KeyDownEvent.
Declaration
public virtual void OnKeyDown(KeyEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.KeyEventArgs | e | Event data. |
OnKeyPress(KeyPressEventArgs)
This method fires the KeyPress event and the script code connected to the KeyPressEvent.
Declaration
public virtual void OnKeyPress(KeyPressEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.KeyPressEventArgs | e | Event data. |
OnKeyUp(KeyEventArgs)
This method fires the KeyUp event and the script code connected to the KeyUpEvent.
Declaration
public virtual void OnKeyUp(KeyEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.KeyEventArgs | e | Event data. |
OnLeave(EventArgs)
This method fires the Leave event and the script code connected to the LeaveEvent.
Declaration
public virtual void OnLeave(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | Event data. |
OnMouseDown(MouseEventArgs)
This method fires the MouseDown event and the script code connected to the MouseDownEvent.
Declaration
public virtual void OnMouseDown(MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.MouseEventArgs | e | Event data. |
OnMouseEnter(EventArgs)
This method fires the MouseEnter event and the script code connected to the MouseEnterEvent.
Declaration
public virtual void OnMouseEnter(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | Event data. |
OnMouseLeave(EventArgs)
This method fires the MouseLeave event and the script code connected to the MouseLeaveEvent.
Declaration
public virtual void OnMouseLeave(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | Event data. |
OnMouseMove(MouseEventArgs)
This method fires the MouseMove event and the script code connected to the MouseMoveEvent.
Declaration
public virtual void OnMouseMove(MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.MouseEventArgs | e | Event data. |
OnMouseUp(MouseEventArgs)
This method fires the MouseUp event and the script code connected to the MouseUpEvent.
Declaration
public virtual void OnMouseUp(MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.MouseEventArgs | e | Event data. |
OnPaint(PaintEventArgs)
This method fires the Paint event and the script code connected to the PaintEvent.
Declaration
public virtual void OnPaint(PaintEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.PaintEventArgs | e | Event data. |
OnResize(EventArgs)
This method fires the Resize event and the script code connected to the ResizeEvent.
Declaration
public virtual void OnResize(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | Event data. |
OnTextChanged(EventArgs)
This method fires the TextChanged event and the script code connected to the TextChangedEvent.
Declaration
public virtual void OnTextChanged(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | Event data. |
Serialize(FRWriter)
Serializes the object.
Declaration
public override void Serialize(FRWriter writer)
Parameters
Type | Name | Description |
---|---|---|
FRWriter | writer | Writer object. |
Overrides
Remarks
Do not call this method directly. You should override it if you are developing a new component for FastReport.
This method is called when the object needs to save the state. It may happen when:
- saving the report to the file or stream;
- saving the report to the designer's undo buffer;
- assigning the object to another object using the Assign(Base) or AssignAll methods;
- saving the object to the designer's clipboard;
- saving the object to the preview (when run a report).
SetParent(Base)
Sets the object's parent.
Declaration
public override void SetParent(Base value)
Parameters
Type | Name | Description |
---|---|---|
Base | value | New parent. |
Overrides
Remarks
This method is for internal use only. You can use it if you are developing a new component for FastReport. Override it to perform some actions when the parent of an object is changing. This method checks that parent can contain a child.
Exceptions
Type | Condition |
---|---|
ParentException | Parent object cannot contain this object. |
ShouldSerializeBackColor()
Determines whether is necessary to serialize the BackColor property.
Declaration
protected virtual bool ShouldSerializeBackColor()
Returns
Type | Description |
---|---|
System.Boolean | true if serialization is necessary. |
ShouldSerializeCursor()
Determines whether is necessary to serialize the Cursor property.
Declaration
protected virtual bool ShouldSerializeCursor()
Returns
Type | Description |
---|---|
System.Boolean | true if serialization is necessary. |
ShouldSerializeFont()
Determines whether is necessary to serialize the Font property.
Declaration
protected virtual bool ShouldSerializeFont()
Returns
Type | Description |
---|---|
System.Boolean | true if serialization is necessary. |
ShouldSerializeForeColor()
Determines whether is necessary to serialize the ForeColor property.
Declaration
protected virtual bool ShouldSerializeForeColor()
Returns
Type | Description |
---|---|
System.Boolean | true if serialization is necessary. |
Show()
Displays the control to the user.
Declaration
public void Show()
Events
Click
Occurs when the control is clicked. Wraps the System.Windows.Forms.Control.Click event.
Declaration
public event EventHandler Click
Event Type
Type | Description |
---|---|
System.EventHandler |
DoubleClick
Occurs when the control is double-clicked. Wraps the System.Windows.Forms.Control.DoubleClick event.
Declaration
public event EventHandler DoubleClick
Event Type
Type | Description |
---|---|
System.EventHandler |
Enter
Occurs when the control is entered. Wraps the System.Windows.Forms.Control.Enter event.
Declaration
public event EventHandler Enter
Event Type
Type | Description |
---|---|
System.EventHandler |
KeyDown
Occurs when a key is pressed while the control has focus. Wraps the System.Windows.Forms.Control.KeyDown event.
Declaration
public event KeyEventHandler KeyDown
Event Type
Type | Description |
---|---|
System.Windows.Forms.KeyEventHandler |
KeyPress
Occurs when a key is pressed while the control has focus. Wraps the System.Windows.Forms.Control.KeyPress event.
Declaration
public event KeyPressEventHandler KeyPress
Event Type
Type | Description |
---|---|
System.Windows.Forms.KeyPressEventHandler |
KeyUp
Occurs when a key is released while the control has focus. Wraps the System.Windows.Forms.Control.KeyUp event.
Declaration
public event KeyEventHandler KeyUp
Event Type
Type | Description |
---|---|
System.Windows.Forms.KeyEventHandler |
Leave
Occurs when the input focus leaves the control. Wraps the System.Windows.Forms.Control.Leave event.
Declaration
public event EventHandler Leave
Event Type
Type | Description |
---|---|
System.EventHandler |
MouseDown
Occurs when the mouse pointer is over the control and a mouse button is pressed. Wraps the System.Windows.Forms.Control.MouseDown event.
Declaration
public event MouseEventHandler MouseDown
Event Type
Type | Description |
---|---|
System.Windows.Forms.MouseEventHandler |
MouseEnter
Occurs when the mouse pointer enters the control. Wraps the System.Windows.Forms.Control.MouseEnter event.
Declaration
public event EventHandler MouseEnter
Event Type
Type | Description |
---|---|
System.EventHandler |
MouseLeave
Occurs when the mouse pointer leaves the control. Wraps the System.Windows.Forms.Control.MouseLeave event.
Declaration
public event EventHandler MouseLeave
Event Type
Type | Description |
---|---|
System.EventHandler |
MouseMove
Occurs when the mouse pointer is moved over the control. Wraps the System.Windows.Forms.Control.MouseMove event.
Declaration
public event MouseEventHandler MouseMove
Event Type
Type | Description |
---|---|
System.Windows.Forms.MouseEventHandler |
MouseUp
Occurs when the mouse pointer is over the control and a mouse button is released. Wraps the System.Windows.Forms.Control.MouseUp event.
Declaration
public event MouseEventHandler MouseUp
Event Type
Type | Description |
---|---|
System.Windows.Forms.MouseEventHandler |
Paint
Occurs when the control is redrawn. Wraps the System.Windows.Forms.Control.Paint event.
Declaration
public event PaintEventHandler Paint
Event Type
Type | Description |
---|---|
System.Windows.Forms.PaintEventHandler |
Resize
Occurs when the control is resized. Wraps the System.Windows.Forms.Control.Resize event.
Declaration
public event EventHandler Resize
Event Type
Type | Description |
---|---|
System.EventHandler |
TextChanged
Occurs when the Text property value changes. Wraps the System.Windows.Forms.Control.TextChanged event.
Declaration
public event EventHandler TextChanged
Event Type
Type | Description |
---|---|
System.EventHandler |