在WINFORM版本程序中使用微软REPORTVIEWER控件,但默认显示英文,如何将期设置为中文呢,在MSDN中有很好的说明:
第一步:写一个独立的类,实现接口IReportViewerMessages,代码如下:
Public Class ReportViewerMessagesZhcn
ImplementsIReportViewerMessages
PublicReadOnly Property BackButtonToolTip As String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.BackButtonToolTip
Get
Return "后退"
End Get
EndProperty
Public ReadOnly PropertyBackMenuItemText As String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.BackMenuItemText
Get
Return "后退"
End Get
EndProperty
Public ReadOnly PropertyChangeCredentialsText As String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.ChangeCredentialsText
Get
Return "更改"
End Get
EndProperty
Public ReadOnly PropertyCurrentPageTextBoxToolTip As String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.CurrentPageTextBoxToolTip
Get
Return "当前页"
End Get
EndProperty
Public ReadOnly PropertyDocumentMapButtonToolTip As String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.DocumentMapButtonToolTip
Get
Return "文档视图"
End Get
EndProperty
Public ReadOnly PropertyDocumentMapMenuItemText As String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.DocumentMapMenuItemText
Get
Return "文档视图"
End Get
EndProperty
Public ReadOnly PropertyExportButtonToolTip As String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.ExportButtonToolTip
Get
Return "导出"
End Get
EndProperty
Public ReadOnly PropertyExportMenuItemText As String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.ExportMenuItemText
Get
Return "选择格式:"
End Get
EndProperty
Public ReadOnly Property FalseValueTextAs String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.FalseValueText
Get
Return "不正确的值"
End Get
EndProperty
Public ReadOnly Property FindButtonTextAs String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.FindButtonText
Get
Return "查找"
End Get
EndProperty
Public ReadOnly PropertyFindButtonToolTip As String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.FindButtonToolTip
Get
Return "查找"
End Get
EndProperty
Public ReadOnly PropertyFindNextButtonText As String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.FindNextButtonText
Get
Return "下一个"
End Get
EndProperty
Public ReadOnly PropertyFindNextButtonToolTip As String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.FindNextButtonToolTip
Get
Return "下一个"
End Get
EndProperty
Public ReadOnly PropertyFirstPageButtonToolTip As String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.FirstPageButtonToolTip
Get
Return "首页"
End Get
EndProperty
Public ReadOnly PropertyLastPageButtonToolTip As String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.LastPageButtonToolTip
Get
Return "最后一页"
End Get
EndProperty
Public ReadOnly PropertyNextPageButtonToolTip As String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.NextPageButtonToolTip
Get
Return "下一页"
End Get
EndProperty
Public ReadOnly Property NoMoreMatchesAs String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.NoMoreMatches
Get
Return "无匹配项"
End Get
EndProperty
Public ReadOnly PropertyNullCheckBoxText As String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.NullCheckBoxText
Get
Return "空值"
End Get
EndProperty
Public ReadOnly PropertyNullCheckBoxToolTip As String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.NullCheckBoxToolTip
Get
Return "空值"
End Get
EndProperty
Public ReadOnly Property NullValueTextAs String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.NullValueText
Get
Return "空值"
End Get
EndProperty
Public ReadOnly Property PageOf AsString ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.PageOf
Get
Return "页"
End Get
EndProperty
Public ReadOnly PropertyPageSetupButtonToolTip As String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.PageSetupButtonToolTip
Get
Return "页面设置"
End Get
EndProperty
Public ReadOnly PropertyPageSetupMenuItemText As String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.PageSetupMenuItemText
Get
Return "页面设置"
End Get
EndProperty
Public ReadOnly PropertyParameterAreaButtonToolTip As String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.ParameterAreaButtonToolTip
Get
Return "参数设置区"
End Get
EndProperty
Public ReadOnly Property PasswordPromptAs String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.PasswordPrompt
Get
Return "请输入密码:"
End Get
EndProperty
Public ReadOnly PropertyPreviousPageButtonToolTip As String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.PreviousPageButtonToolTip
Get
Return "前一页"
End Get
EndProperty
Public ReadOnly PropertyPrintButtonToolTip As String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.PrintButtonToolTip
Get
Return "打印"
End Get
EndProperty
Public ReadOnly PropertyPrintLayoutButtonToolTip As String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.PrintLayoutButtonToolTip
Get
Return "打印"
End Get
EndProperty
Public ReadOnly PropertyPrintLayoutMenuItemText As String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.PrintLayoutMenuItemText
Get
Return "打印"
End Get
EndProperty
Public ReadOnly PropertyPrintMenuItemText As String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.PrintMenuItemText
Get
Return "打印"
End Get
EndProperty
Public ReadOnly Property ProgressTextAs String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.ProgressText
Get
Return "正在生成报表......"
End Get
EndProperty
Public ReadOnly PropertyRefreshButtonToolTip As String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.RefreshButtonToolTip
Get
Return "刷新"
End Get
EndProperty
Public ReadOnly PropertyRefreshMenuItemText As String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.RefreshMenuItemText
Get
Return "刷新"
End Get
EndProperty
Public ReadOnly PropertySearchTextBoxToolTip As String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.SearchTextBoxToolTip
Get
Return "查找"
End Get
EndProperty
Public ReadOnly Property SelectAll AsString ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.SelectAll
Get
Return "全选"
End Get
EndProperty
Public ReadOnly Property SelectAValueAs String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.SelectAValue
Get
Return "SelectAValue"
End Get
EndProperty
Public ReadOnly PropertyStopButtonToolTip As String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.StopButtonToolTip
Get
Return "停止"
End Get
EndProperty
Public ReadOnly PropertyStopMenuItemText As String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.StopMenuItemText
Get
Return "停止"
End Get
EndProperty
Public ReadOnly Property TextNotFoundAs String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.TextNotFound
Get
Return "未找到"
End Get
EndProperty
Public ReadOnly PropertyTotalPagesToolTip As String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.TotalPagesToolTip
Get
Return "总页数"
End Get
EndProperty
Public ReadOnly Property TrueValueTextAs String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.TrueValueText
Get
Return "正确值"
End Get
EndProperty
Public ReadOnly Property UserNamePromptAs String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.UserNamePrompt
Get
Return "用户名"
End Get
EndProperty
Public ReadOnly PropertyViewReportButtonText As String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.ViewReportButtonText
Get
Return "显示报表"
End Get
EndProperty
Public ReadOnly PropertyViewReportButtonToolTip As String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.ViewReportButtonToolTip
Get
Return "显示报表"
End Get
EndProperty
Public ReadOnly PropertyZoomControlToolTip As String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.ZoomControlToolTip
Get
Return "缩放"
End Get
EndProperty
Public ReadOnly PropertyZoomMenuItemText As String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.ZoomMenuItemText
Get
Return "缩放"
End Get
EndProperty
Public ReadOnly PropertyZoomToPageWidth As String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.ZoomToPageWidth
Get
Return "页宽"
End Get
EndProperty
Public ReadOnly PropertyZoomToWholePage As String ImplementsMicrosoft.Reporting.WinForms.IReportViewerMessages.ZoomToWholePage
Get
Return "整页"
End Get
EndProperty
End Class
第二步:创建对像,设置REPORTVIEWERR控件的MESSAGEs属性
ReportViewer1.Messages = NewReportViewerMessagesZhcn
此时完成汉化,呵呵!