ReportViewer.Messages 屬性

取得或設定包含 ReportViewer 控制項所使用之自訂訊息的物件。

命名空間:  Microsoft.Reporting.WinForms
組件:  Microsoft.ReportViewer.WinForms (在 Microsoft.ReportViewer.WinForms.dll 中)

語法

'宣告
<BrowsableAttribute(False)> _
Public Property Messages As IReportViewerMessages
[BrowsableAttribute(false)]
public IReportViewerMessages Messages { get; set; }
[BrowsableAttribute(false)]
public:
property IReportViewerMessages^ Messages {
    IReportViewerMessages^ get ();
    void set (IReportViewerMessages^ value);
}
[<BrowsableAttribute(false)>]
member Messages : IReportViewerMessages with get, set
function get Messages () : IReportViewerMessages
function set Messages (value : IReportViewerMessages)

屬性值

類型:Microsoft.Reporting.WinForms.IReportViewerMessages
實作 IReportViewerMessages 介面的物件。

備註

您可以實作 IReportViewerMessages 介面,以提供 ReportViewer 控制項使用者介面的自訂當地語系化。可以藉由設定 ReportViewer 控制項的 Messages 屬性,將這個實作傳遞給 ReportViewer 控制項。

注意事項注意事項

IReportViewerMessages 介面不允許自訂本機或伺服器報表處理錯誤訊息。

針對屬性傳回 nullnull 參考 (即 Visual Basic 中的 Nothing) 字串值時,將會造成 ReportViewer 控制項顯示該項目的原始使用者介面字串。

範例

下列程式碼範例會示範傳遞給 ReportViewer 控制項的 IReportViewerMessages 實作。

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.Reporting.WinForms;
using System.Diagnostics;

namespace MySample
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            CCustomMessageClass myMessageClass = new CCustomMessageClass();

            reportViewer1.Messages = myMessageClass;

            this.reportViewer1.RefreshReport();

         }
    }

    public class CCustomMessageClass : IReportViewerMessages
    {

        #region IReportViewerMessages Members

        public string BackButtonToolTip
        {
            get { return ("BackButtonToolTip here."); }
        }

        public string BackMenuItemText
        {
            get { return("Add your custom text here."); }
        }

        public string ChangeCredentialsText
        {
            get { return("Add your custom text here."); }
        }

        public string CurrentPageTextBoxToolTip
        {
            get { return("Add your custom text here."); }
        }

        public string DocumentMapButtonToolTip
        {
            get { return("Add your custom text here."); }
        }

        public string DocumentMapMenuItemText
        {
            get { return("Add your custom text here."); }
        }

        public string ExportButtonToolTip
        {
            get { return("Add your custom text here."); }
        }

        public string ExportMenuItemText
        {
            get { return("Add your custom text here."); }
        }

        public string FalseValueText
        {
            get { return("Add your custom text here."); }
        }

        public string FindButtonText
        {
            get { return("Add your custom text here."); }
        }

        public string FindButtonToolTip
        {
            get { return("Add your custom text here."); }
        }

        public string FindNextButtonText
        {
            get { return("Add your custom text here."); }
        }

        public string FindNextButtonToolTip
        {
            get { return("Add your custom text here."); }
        }

        public string FirstPageButtonToolTip
        {
            get { return("Custom first page tool tip"); }
        }

        public string LastPageButtonToolTip
        {
            get { return(null); }
        }

        public string NextPageButtonToolTip
        {
            get { return("Add your custom text here."); }
        }

        public string NoMoreMatches
        {
            get { return("Add your custom text here."); }
        }

        public string NullCheckBoxText
        {
            get { return("Add your custom text here."); }
        }

        public string NullCheckBoxToolTip
        {
            get { return("Add your custom text here."); }
        }

        public string NullValueText
        {
            get { return("Add your custom text here."); }
        }

        public string PageOf
        {
            get { return("Add your custom text here."); }
        }

        public string PageSetupButtonToolTip
        {
            get { return("Add your custom text here."); }
        }

        public string PageSetupMenuItemText
        {
            get { return("Add your custom text here."); }
        }

        public string ParameterAreaButtonToolTip
        {
            get { return("Add your custom text here."); }
        }

        public string PasswordPrompt
        {
            get { return("Add your custom text here."); }
        }

        public string PreviousPageButtonToolTip
        {
            get { return("Add your custom text here."); }
        }

        public string PrintButtonToolTip
        {
            get { return("Add your custom text here."); }
        }

        public string PrintLayoutButtonToolTip
        {
            get { return("Add your custom text here."); }
        }

        public string PrintLayoutMenuItemText
        {
            get { return("Add your custom text here."); }
        }

        public string PrintMenuItemText
        {
            get { return("Add your custom text here."); }
        }

        public string ProgressText
        {
            get { return("Add your custom text here."); }
        }

        public string RefreshButtonToolTip
        {
            get { return("Add your custom text here."); }
        }

        public string RefreshMenuItemText
        {
            get { return("Add your custom text here."); }
        }

        public string SearchTextBoxToolTip
        {
            get { return("Add your custom text here."); }
        }

        public string SelectAValue
        {
            get { return("Add your custom text here."); }
        }

        public string SelectAll
        {
            get { return("Add your custom text here."); }
        }

        public string StopButtonToolTip
        {
            get { return("Add your custom text here."); }
        }

        public string StopMenuItemText
        {
            get { return("Add your custom text here."); }
        }

        public string TextNotFound
        {
            get { return("Add your custom text here."); }
        }

        public string TotalPagesToolTip
        {
            get { return("Add your custom text here."); }
        }

        public string TrueValueText
        {
            get { return("Add your custom text here."); }
        }

        public string UserNamePrompt
        {
            get { return("Add your custom text here."); }
        }

        public string ViewReportButtonText
        {
            get { return("Add your custom text here."); }
        }

        public string ViewReportButtonToolTip
        {
            get { return("Add your custom text here."); }
        }

        public string ZoomControlToolTip
        {
            get { return("Add your custom text here."); }
        }

        public string ZoomMenuItemText
        {
            get { return("Add your custom text here."); }
        }

        public string ZoomToPageWidth
        {
            get { return("Add your custom text here."); }
        }

        public string ZoomToWholePage
        {
            get { return("Add your custom text here."); }
        }

        #endregion
    }

}

請參閱

參考

ReportViewer 類別

Microsoft.Reporting.WinForms 命名空間