自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

  • 博客(0)
  • 资源 (2)
  • 收藏
  • 关注

空空如也

多语言系统的Demo程序

利用XML文件作的多语言DEMO程序 ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '' '' '' 多語系設置類 '' '' Create: Bunny_Young 2010-03-12 '' email:[email protected] '' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '' Modification history: '' '' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Imports System.Xml Imports System.Data Imports System.Web Imports System.Web.UI Imports System.Web.UI.WebControls Imports System.IO Public Class MutiLanguage Const _LANGUAGE_NAME = "language" Const _PAGE_NAME = "pageName" Const _CONTROL_NAME = "controlName" Const _CONTROL_TYPE = "controlType" Const _CONTROL_VALUE = "controlValue" Private _PageName As String ''resource讀取路徑 Private _languageType As String '' Private _xmlDoc As XmlDocument Private _savePath As String Private ds As DataSet Sub New(ByVal strLanguage As String, ByVal aspxPage As String) 'savePath = "~/Resource/" + strLanguage _PageName = "~/Resource/" + strLanguage + "/" + aspxPage + ".xml" _savePath = "~/Resource/" + strLanguage _savePath = HttpContext.Current.Server.MapPath(_savePath) _PageName = HttpContext.Current.Server.MapPath(_PageName) _languageType = strLanguage End Sub Public Sub GetDataSet() ds = New DataSet() ds.ReadXml(_PageName, XmlReadMode.Auto) End Sub Public Function UpdateLanguage(ByVal _controlName As String, ByVal _controlType As String, ByVal _controlValue As String) As Boolean GetDataSet() For Each dr As DataRow In ds.Tables(0).Rows If dr("controlName") = _controlName And dr("controlType") = _controlType Then dr("controlValue") = _controlValue End If Next ds.WriteXml(_PageName, XmlWriteMode.IgnoreSchema) ds.ReadXml(_PageName) End Function Public Function GetControlsList() As List(Of UIControl) GetDataSet() Dim dt As DataTable = ds.Tables(0) Dim ResultList As New List(Of UIControl) For Each dr As DataRow In dt.Rows Dim MyControl As New UIControl MyControl.ControlName = dr("controlName") MyControl.ControlType = dr("controlType") MyControl.ControlValue = dr("controlValue") ResultList.Add(MyControl) Next Return ResultList End Function ''' <summary> ''' 主動生成資源文件 ''' </summary> ''' <param name="strLanguage">語言類別</param> ''' <param name="Page">WEB PAGE</param> ''' <remarks></remarks> Public Sub WriteResourceFile(ByVal Page As UI.Page) Try If Not Directory.Exists(_savePath) Then Directory.CreateDirectory(_savePath) End If Dim writer As New XmlTextWriter(_PageName, Nothing) writer.Formatting = Formatting.Indented ''語言類別 writer.WriteStartElement(_LANGUAGE_NAME, _languageType) LoopAllControls(Page, writer) ''語言類別結束 writer.WriteEndElement() writer.Close() Catch ex As Exception End Try End Sub Private Sub LoopAllControls(ByVal oCtrl As Control, ByVal writer As XmlWriter) For Each _Ctrl As Control In oCtrl.Controls Dim _strName As String = _Ctrl.GetType.Name.ToUpper If _strName = "LABEL" Or _strName = "BUTTON" Then Dim strValue As String Dim strComment As String If _strName = "LABEL" Then strValue = CType(_Ctrl, Label).Text strComment = "label control" Else strValue = CType(_Ctrl, Button).Text strComment = "button control" End If writer.WriteComment(strComment) writer.WriteStartElement("Control") writer.WriteAttributeString(_CONTROL_VALUE, strValue) writer.WriteAttributeString(_CONTROL_NAME, _Ctrl.ID) writer.WriteAttributeString(_CONTROL_TYPE, _Ctrl.GetType.Name) writer.WriteEndElement() End If If _Ctrl.GetType.Name.ToUpper() = "GRIDVIEW" Then Continue For End If If _Ctrl.HasControls Then LoopAllControls(_Ctrl, writer) End If Next End Sub Public Sub ApplylanguageResource(ByVal _aspxPage As System.Web.UI.Page) GetDataSet() LoopApply(_aspxPage) End Sub Private Sub LoopApply(ByVal _control As Control) For Each ct As Control In _control.Controls Dim controlName As String = ct.ID Dim dr() As System.Data.DataRow = ds.Tables(0).Select("controlName='" + controlName + "'", "controlName DESC") If dr.Count > 0 Then If ct.GetType.Name.ToUpper = "LABEL" Then CType(ct, Label).Text = dr(0)("controlValue") End If If ct.GetType.Name.ToUpper = "BUTTON" Then CType(ct, Button).Text = dr(0)("controlValue") End If End If If ct.HasControls Then LoopApply(ct) End If Next End Sub End Class

2010-03-15

DevelopersGuide_Delphi7

英文版本的delphi技术资料,里面内容很全,值得一看。

2007-06-15

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除