Chào ban Vi tính! Hiện tôi đang sử dụng Visual Basic 6.0 để viết một chương trình quản lý CSDL. Tôi muốn sử dụng tiếng Việt cho các menu và hộp thoại, nhưng chưa biết cách làm. Ban biên tập có thể chỉ cho tôi một phương pháp nào đó, hoặc một website nói về vấn đề này. Xin chân thành cảm ơn!
Võ Văn Vinh
Hồi âm:
Minh vua lam xong mot vi du giong het nhu yeu cau cua ban, nhung ma no lai duoc viet bang Visual C++ 6.0 chu khong phai dung Visual Basic. Minh co chuyen code sang VB6 nhung chua lam xong: Day la 1 vi du don gian: Dat 1 icon len khay he thong (SystemTray). Khi kich chuot phai vao TrayIcon thi bat ra 1 menu don gian (nhu cac PopupMenu binh thuong).
PopupMenu cua BKAV hay cua VietKey deu la cac menu cao cap, chung duoc sua, ve lai tu cac menu don gian va cach lam menu nhu vay tuong doi phuc tap. Noi chung la ban cung phai co mot so kien thuc co ban ve lap trinh de tao cac menu nhu vay.
Ban nen tham khao MSDN va vao cac trang web nhu:
www.developer.com
www.codeguru.com
Chu y: De tao ra cac menu dep mat nhu VietKey hoac BKAV ban phai dung cac ham API chu cac ham VB thi khong lam duoc dau.
- Dung chuong trinh API Text Viewer de biet cach khai bao cac ham API trong VB
- Tham khao MSDN de biet cach dung ham API do nhu the nao.
"Co cong mai sat, co ngay nen kim".
Programmer HUBM
Em men! Anh viet ra doan code nay de cau tao nen popup menu in systray, qua ngon ngu lap trinh visual basic nay em nghien cuu va hoc hoi them duoc nhieu dieu bo ich ve cach viet no nhu the nao, va biet dau sau nay em se viet hay hon thi sao.
Private Sub DisplayPopupMenuTaskbar()
' Display a popupmenu
Dim cPopMenu As New BitmapPopupMenu.cPopupMenu
Dim nIndex As Long
Dim nIconIndex As Long
If (Me.WindowState <> vbMinimized) Then Exit Sub
' Initialise the Image List:
cPopMenu.ImageList = ImageListTaskbar
' *** Initialise the hWndOwner (you must do this before showing a menu):
cPopMenu.hWndOwner = frmTrayIcon.hwnd
' Add the menu Items
nIconIndex = ImageListTaskbar.ListImages("Restore").Index - 1
cPopMenu.AddItem "&Restore", , , , nIconIndex, , , "Restore"
nIconIndex = ImageListTaskbar.ListImages("About").Index - 1
cPopMenu.AddItem "&About", , , , nIconIndex, , , "About"
cPopMenu.AddItem "-"
nIconIndex = ImageListTaskbar.ListImages("Exit").Index - 1
cPopMenu.AddItem "&Exit", , , , nIconIndex, , , "Exit"
nIndex = cPopMenu.ShowPopupMenu(frmTrayIcon.left * 2.8, frmTrayIcon.Top * 2)
If (nIndex > 0) Then
Select Case cPopMenu.ItemKey(nIndex)
Case "Restore":
Me.WindowState = vbNormal
Me.Visible = True
Me.ZOrder 0
AlwaysOnTop Me, True
AlwaysOnTop Me, False
Case "About":
frmAbout.Show vbModal
Case "Exit":
Unload Me
End Select
End If
End Sub
Chuc em vui ve nha!
Phucusa
Theo tôi thì bạn nên nâng cấp lên VB .NET để viết chương trình (theo mục đích mà bạn đề cập) một cách đơn giản hơn.
Nếu bạn dùng VB .NET thì bạn tham khảo ở trang web này:
Visual Basic and Visual C# Concepts
Localizing Applications
Localization is the process of customizing your application for a given culture or locale. Localization consists primarily of translating the user interface.
In This SectionWalkthrough: Localizing Windows Forms
Provides a step-by-step example of how to localize a Windows Form.
Walkthrough: Localizing Web Forms Pages
Provides a step-by-step example of how to localize a Web Forms page.
Hierarchical Organization of Resources for Localization
Explains how localized resources are stored and accessed in Visual Studio.
Security and Localized Satellite Assemblies
Discusses signing satellite assemblies with public-private key pairs.
Version Numbers for Main and Localized Satellite Assemblies
Introduces the SatelliteContractVersionAttribute class, which determines which satellite assemblies work with an application's main assembly
Neutral Resources Languages for Localization
Introduces the NeutralResourcesLanguageAttribute class, which specifies the culture of the resources included in an application's main assembly.
Related SectionsIntroduction to International Applications in Visual Basic and Visual C#
Discusses the concepts related to developing software for an international market using Visual Basic or Visual C#.
Provides links to topics about creating Windows applications that support multiple cultures.
Provides links to topics about creating Web applications that support multiple cultures.
Planning World-Ready Applications
Provides information on programming for an international audience, such as design issues and terminology.
Nếu bạn dùng VB 6.0 thì bạn tham khảo cuốn sách này:
Microsoft Visual Basic 6.0 Programmer's Guide
Microsoft Press, Paperback, Published August 1998, 959 pages, ms_vb6_prggd, ISBN 1572318635
Chapter 16 International Issues 781
16.1. International Software Definitions 781
16.2. Designing International Software 782
16.3. Using Resource Files for Localization 785
16.4. Designing an International-Aware User Interface 788
16.5. General Considerations When Writing International Code 790
16.6. Writing International Code in Visual Basic 792
16.7. Issues Specific to the Double-Byte Character Set (DBCS) 801
16.8. Visual Basic Bidirectional Features
Chúc bạn thành công.
Hoàng Minh Hải