Header Ads

  • Breaking News

    Ratio Windows CE

    ย่อขยายหน้า จอสำหรับ Windows Mobile CE ที่หน้าจอเล็กบ้างใหญ่บ้าง

     '// Change resolution from QVGA to VGA
        '//
        '//    CALL: Add following statements in the each "form_Load()".
        '//
        '//    If System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width = 480 Then
        '//        Call resolution.QVGAtoVGA(Me)
        '//    End If


        Public Sub QVGAtoVGA(ByVal top As System.Windows.Forms.Form)
            MsgBox(MobileType)
            If MobileType.Equals("1") Then              'BHT 1200
                ratio = 1.35
            ElseIf MobileType.Equals("2") Then          'BT -75W
                ratio = 1
            End If



            '// Adjust size of each control
            For Each item As Control In top.Controls

                '// left/top/width/height
                item.Left = item.Left * ratio
                item.Top = item.Top * ratio
                item.Width = item.Width * ratio
                item.Height = item.Height * ratio

                '// font size
                If item.GetType.Name <> "PictureBox" Then
                    item.Font = New Font(item.Font.Name, item.Font.Size * ratio, item.Font.Style)
                End If
            Next

            '// Adjust form size
            top.Left = top.Left * ratio
            top.Top = top.Top * ratio
            top.Width = top.Width * ratio
            top.Height = top.Height * ratio

            top.Font = New Font(top.Font.Name, top.Font.Size * ratio, top.Font.Style)
            top.WindowState = FormWindowState.Maximized
        End Sub


    -------------การเรียกใช้งาน  --------
    Call QVGAtoVGA(Me)



    ''------อ่าน ชื่อเครื่องจากไฟล์ ----- setting.ini   เพื่อแยก ขนาดเครื่องเล็ก หรือ ใหญ่  -----
    '''''  Public Sub GET_MOBILETYPE(ByVal frm As System.Windows.Forms.Form)
            '// Check 1:1 or 1:N from setting file
            path = frm.GetType().Assembly.GetModules()(0).FullyQualifiedName
            Dim en As Int32 = path.LastIndexOf("\")
            path = path.Substring(0, en)
            htlogfile = path + "\" + pclogfile

            If System.IO.File.Exists(path & "\setting.ini") Then
                Dim cReader As New System.IO.StreamReader(path & "\setting.ini", System.Text.Encoding.GetEncoding("shift_jis"))
                Dim strRead As String
                strRead = cReader.ReadLine()
                cReader.Close()

                MobileType = 2              '' BT 75
                If strRead.Substring(0, 18) = "MobileType:BHT1200xx" Then
                    MobileType = 1                          '' BHT1200
                End If
            Else
                MobileType = 2
            End If    End Sub

    ไม่มีความคิดเห็น

    Post Top Ad

    ad728

    Post Bottom Ad

    ad728