Thai Language on lvButtons in VB6
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Thai Language on lvButtons in VB6

  1. #1
    Join Date
    Aug 2011
    Posts
    2

    Thai Language on lvButtons in VB6

    Hi to All,

    Can we show the Thai language on LVButtons in VB6?

    I want to display Thai language on LVButtons is there any solution for that.

    Please its urgent.

    Thanks in Advance

  2. #2
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,770

    Re: Thai Language on lvButtons in VB6

    If the Region and Language of the machine has been set to Thai...

    Then you should be able to Directly enter Thai into the Button Captions...
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  3. #3
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,722

    Re: Thai Language on lvButtons in VB6

    Well, I think this topic is not quite as trivial.
    I'm struggling around with unicode text display as well at the moment.

    You must know that usual VB controls except ListView and MSHFlexGrid are actually not unicode-aware. I'm not sure if you can put foreign writing into a usual button's caption, even if the reginal settings are given. (Have not tried that)

    The controls of the Forms2.0 library, however, accept unicode characters of any language, as long as the font is installed on the computer. I was able to display Urdu, Farsi, Tamil and also Thai in any Form2.0 control, as well as in the ListView and the MSHFlexGrid, although, ListView gave up when trying to put unicode characters into the column headers. It just converted them to ANSI, as it seems, showing ??????? instead.

  4. #4
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,875

    Re: Thai Language on lvButtons in VB6

    Here's the .FRM file:

    Code:
    VERSION 5.00
    Begin VB.Form Form1 
       Caption         =   "VB6 Unicode Example 1"
       ClientHeight    =   2505
       ClientLeft      =   60
       ClientTop       =   450
       ClientWidth     =   7245
       LinkTopic       =   "Form1"
       ScaleHeight     =   2505
       ScaleWidth      =   7245
       StartUpPosition =   3  'Windows Default
       Begin VB.CommandButton Command1 
          Caption         =   "Go"
          Height          =   375
          Left            =   240
          TabIndex        =   2
          Top             =   1920
          Width           =   1215
       End
       Begin VB.TextBox Text2 
          BeginProperty Font 
             Name            =   "Arial"
             Size            =   8.25
             Charset         =   0
             Weight          =   400
             Underline       =   0   'False
             Italic          =   0   'False
             Strikethrough   =   0   'False
          EndProperty
          Height          =   375
          Left            =   240
          TabIndex        =   1
          Text            =   "Western European"
          Top             =   1320
          Width           =   6735
       End
       Begin VB.TextBox Text1 
          BeginProperty Font 
             Name            =   "MS UI Gothic"
             Size            =   8.25
             Charset         =   128
             Weight          =   400
             Underline       =   0   'False
             Italic          =   0   'False
             Strikethrough   =   0   'False
          EndProperty
          Height          =   375
          Left            =   240
          TabIndex        =   0
          Text            =   "Japanese"
          Top             =   480
          Width           =   6735
       End
       Begin VB.Label Label2 
          Caption         =   "Font: Arial w/ Western script selected:"
          Height          =   375
          Left            =   240
          TabIndex        =   4
          Top             =   960
          Width           =   3615
       End
       Begin VB.Label Label1 
          Caption         =   "Font: MS UI Gothic w/ Japanese script selected:"
          Height          =   375
          Left            =   240
          TabIndex        =   3
          Top             =   120
          Width           =   4335
       End
    End
    Attribute VB_Name = "Form1"
    Attribute VB_GlobalNameSpace = False
    Attribute VB_Creatable = False
    Attribute VB_PredeclaredId = True
    Attribute VB_Exposed = False
    Private Sub Command1_Click()
    
        Dim s1 As String
        s1 = "p"
        
        ' The Font for the Text1 textbox is set to
        ' MS UI Gothic w/ the Japanese script selected.
        ' It displays a single Japanese character.
        Text1.Text = s1
        
        ' The Font for Text is set to Arial w/ the
        ' Western script selected.
        ' It displays the two characters as you see them
        ' in the literal string above.
        Text2.Text = s1
        
    End Sub
    Attached Files Attached Files
    Last edited by dglienna; August 8th, 2011 at 10:34 AM.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  5. #5
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,722

    Re: Thai Language on lvButtons in VB6

    Yes, David, I know about this sample and I know about this displaying of Japanese and Chinese characters which make people think "oh look, the VB6 TextBox can display unicode".
    That's not the real thing after all. It cannot.

    Try to show Tamil, Bengal or even russian cyrillics. It wouldn't work. Not with Thai at all.
    The only controls which can really display Unicode strings are the MSHFlexGrid, ListView and the Forms2.0 controls, up to a certain extend.
    I made a lot of tries recently and find a couple of strange problems when displaying foreign fonts' character sets.

    !!First of all, Windows is aware of UTF16 encoding in the mentioned controls, which allows you to display most of the foreign languages like Punjabi, Tamil, Korean, Thai and even Inuktitut, as long as you have a fitting font installed on your computer.

    Forms2.0, MSHFlexGrid and ListView seem to support (to a certain limited extend) the so called Font FallBack. That means, you set the Font of a TextBox or FlexGrid to "Arial" and read (or copy) some Arabic characters to the control. Font FallBack will now find that Arial has not the desired characters defined and will find the next font which supports the desired UTF16 wide characters. (Sometimes it doesn't and I'm still wondering why it does not work all the times).

    Also when reading data from files you'd have to watch certain rules of getting unicode characters read in. You'd have to read byte arrays with Get or with InputB to achieve proper unicode input.

    It's all really complex and I'm still not down to the bottom of it.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center