|
#region Disclaimer by Teo Lachev "Microsoft Reporting Services in Action"
/*============================================================================
File: FormatListboxTypeEditor.cs
Summary: The StringEditor class is a UITypeEditor for the ReportPath parameter.
--------------------------------------------------------------------
The AwReportViewer sample was built upon on the Microsoft's ReportViewer control included
with the RS samples.
The following portions of the code have been changed/added to fit the book needs:
1. Nothing was changed
===========================================================================*/
#endregion
using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Design;
using System.Windows.Forms;
using System.Windows.Forms.Design;
namespace RSControl.WebViewer {
public class StringEditor : UITypeEditor {
/// <summary>
/// Show StringEditorForm when user clicks the property editor button.
/// </summary>
/// <param name="context"></param>
/// <param name="serviceProvider"></param>
/// <param name="value"></param>
/// <returns></returns>
public override object EditValue(ITypeDescriptorContext context,
IServiceProvider serviceProvider, object value) {
if ((context != null) &&
(serviceProvider != null)) {
//Set the editor service
IWindowsFormsEditorService edSvc =
(IWindowsFormsEditorService)serviceProvider.GetService(
typeof(IWindowsFormsEditorService));
if (edSvc != null) {
//Create new StringEditorForm
StringEditorForm form = new StringEditorForm();
form.Value = (string)value;
//Show form as a dialog
DialogResult result = edSvc.ShowDialog(form);
if (result == DialogResult.OK) {
value = form.Value;
}
}
}
return value;
}
/// <summary>
/// The editor will be a modal window.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override UITypeEditorEditStyle GetEditStyle(
ITypeDescriptorContext context) {
if (context != null) {
return UITypeEditorEditStyle.Modal;
}
return base.GetEditStyle(context);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Years of software consulting and software development using Microsoft development products such as Microsoft Content Management System, SQL Server Reporting Service, ASP.Net C# VB.Net, HTML and javascript web development, Visual Studio add-on development, C++ MFC/ATL and COM+ development, and ActiveX components.