Click here to Skip to main content
15,898,134 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: VB.Net Populate SQL Data to textbox upon Form Load Pin
Richard MacCutchan28-Aug-12 21:51
mveRichard MacCutchan28-Aug-12 21:51 
Questionprogramming G510 Pin
JR21227-Aug-12 20:38
JR21227-Aug-12 20:38 
AnswerRe: programming G510 Pin
Eddy Vluggen27-Aug-12 23:08
professionalEddy Vluggen27-Aug-12 23:08 
GeneralRe: programming G510 Pin
JR21227-Aug-12 23:32
JR21227-Aug-12 23:32 
GeneralRe: programming G510 Pin
Eddy Vluggen27-Aug-12 23:52
professionalEddy Vluggen27-Aug-12 23:52 
GeneralRe: programming G510 Pin
JR21228-Aug-12 7:24
JR21228-Aug-12 7:24 
GeneralRe: programming G510 Pin
Eddy Vluggen28-Aug-12 7:43
professionalEddy Vluggen28-Aug-12 7:43 
GeneralRe: programming G510 Pin
JR21228-Aug-12 8:09
JR21228-Aug-12 8:09 
starting from the example you gived me 2° link
i addapted to this
VB
Module Module1
  Public LCD As LgLcd
  Public fnt As New Font("Calibri", 8)

  'these font works for me
  'Calibri
  'batang
  'bookman old style
  'calibri
  'cambria
  'dotum
  'gulim
  'gungsuh
  'mingliu
  'ms gothic
  'nsimsun
  'pmingliu
  'simsun
  Sub main() 'args As String()
    ' LCD structures needed
    Dim conn As New lgLcdClassLibrary.lgLcd.lgLcdConnectContext()
    Dim opn As New lgLcdClassLibrary.lgLcd.lgLcdOpenContext()
    Dim bmp As New lgLcdClassLibrary.lgLcd.lgLcdBitmap160x43x1()
    Dim nAllButtonsReleased, nButton As Integer

    ' .NET drawing objects
    Dim bmpNet As Bitmap
    Dim gfx As Graphics

    ' Initialize LCD access            
    lgLcdClassLibrary.lgLcd.lgLcdInit()
    conn.appFriendlyName = "Test Application"
    conn.isAutostartable = False
    conn.isPersistent = False
    conn.connection = lgLcdClassLibrary.lgLcd.LGLCD_INVALID_CONNECTION


    lgLcdClassLibrary.lgLcd.lgLcdConnect(conn)
    opn.connection = conn.connection
    opn.index = 1

    lgLcdClassLibrary.lgLcd.lgLcdOpen(opn)
    Dim installed_fonts As New Drawing.Text.InstalledFontCollection
    Dim font_families() As FontFamily = installed_fonts.Families()

    ' Display the font families.
    'For Each font_family As FontFamily In font_families
    '  Console.Write(font_family.Name & ", ")
    'Next font_family
    Dim nCounter As Integer = 0
    Do
      Try
        fnt = New Font(font_families(nCounter).Name, 10)
      Catch ex As Exception

      End Try

      ' Graphics object
      bmpNet = New Bitmap(160, 43)
      gfx = Graphics.FromImage(bmpNet)

      ' Clear the screen            
      gfx.FillRectangle(Brushes.White, New Rectangle(0, 0, 160, 43))

      ' Drawing goes here.  We can do any .NET graphics object drawing we want.
      ' (fonts or whatever.)
      gfx.DrawString(fnt.Name, fnt, Brushes.Black, 10, 10)
      gfx.DrawString("Play    Stop     Prev     Next", fnt, Brushes.Black, 10, 27)

      ' Convert our .NET bitmap to the format that LCD wants 
      ' (treat anything non-white to be black)
      ' This is *not* the most efficient way to do this.
      bmp.hdr = New lgLcdClassLibrary.lgLcd.lgLcdBitmapHeader()
      bmp.hdr.Format = lgLcdClassLibrary.lgLcd.LGLCD_BMP_FORMAT_160x43x1
      bmp.pixels = New Byte(6879) {}

      For y As Integer = 0 To 42
        For x As Integer = 0 To 159
          Dim trueColor As Color = bmpNet.GetPixel(x, y)
          Dim nColor As Byte = CByte(If((trueColor.R = 255 AndAlso trueColor.G = 255 AndAlso trueColor.B = 255), 0, 255))

          bmp.pixels(y * 160 + x) = nColor
        Next
      Next

      ' Draw the picture.
      lgLcdClassLibrary.lgLcd.lgLcdUpdateBitmap(opn.device, bmp, lgLcdClassLibrary.lgLcd.LGLCD_PRIORITY_NORMAL)
      'bring the bitmap on the display
      lgLcdClassLibrary.lgLcd.lgLcdSetAsLCDForegroundApp(opn.device, lgLcdClassLibrary.lgLcd.LGLCD_LCD_FOREGROUND_APP_YES)
      Do
        lgLcdClassLibrary.lgLcd.lgLcdReadSoftButtons(opn.device, nButton)
      Loop Until nButton > 0
      If (nButton Or 4) = 4 Then
        nCounter -= 1
        If nCounter < 0 Then nCounter = 0
      ElseIf (nButton Or 8) = 8 Then
        nCounter += 1
        If nCounter > font_families.Count Then nCounter = font_families.Count
      End If
      Do
        lgLcdClassLibrary.lgLcd.lgLcdReadSoftButtons(opn.device, nAllButtonsReleased)
      Loop Until nAllButtonsReleased = 0
    Loop Until (nButton Or 2) = 2

    ' Shut it all down
    lgLcdClassLibrary.lgLcd.lgLcdClose(opn.device)
    lgLcdClassLibrary.lgLcd.lgLcdDisconnect(conn.connection)
    lgLcdClassLibrary.lgLcd.lgLcdDeInit()
  End Sub
End Module


So I can see all fonts that works with button 3 and 4
and exit with button 2
button 1 is not used in the quick test program.

For all comments remember its quick and dirty just to find out how everythi ng works

thanks fo the help
Smile | :)
Jan

Jan
GeneralRe: programming G510 Pin
Eddy Vluggen28-Aug-12 8:34
professionalEddy Vluggen28-Aug-12 8:34 
QuestionAddHandler and RemoveHandler Pin
biop.codeproject27-Aug-12 20:36
biop.codeproject27-Aug-12 20:36 
AnswerRe: AddHandler and RemoveHandler Pin
Simon_Whale27-Aug-12 22:50
Simon_Whale27-Aug-12 22:50 
GeneralRe: AddHandler and RemoveHandler Pin
biop.codeproject28-Aug-12 16:10
biop.codeproject28-Aug-12 16:10 
AnswerRe: AddHandler and RemoveHandler Pin
Shameel28-Aug-12 15:06
professionalShameel28-Aug-12 15:06 
QuestionControlling No. of Loggeed users Pin
SPSandy26-Aug-12 22:49
SPSandy26-Aug-12 22:49 
AnswerRe: Controlling No. of Loggeed users Pin
Eddy Vluggen27-Aug-12 0:12
professionalEddy Vluggen27-Aug-12 0:12 
GeneralRe: Controlling No. of Loggeed users Pin
SPSandy27-Aug-12 6:42
SPSandy27-Aug-12 6:42 
GeneralRe: Controlling No. of Loggeed users Pin
Eddy Vluggen27-Aug-12 8:01
professionalEddy Vluggen27-Aug-12 8:01 
GeneralRe: Controlling No. of Loggeed users Pin
SPSandy28-Aug-12 6:48
SPSandy28-Aug-12 6:48 
GeneralRe: Controlling No. of Loggeed users Pin
Eddy Vluggen28-Aug-12 8:05
professionalEddy Vluggen28-Aug-12 8:05 
AnswerRe: Controlling No. of Loggeed users Pin
pramod.hegde27-Aug-12 3:28
professionalpramod.hegde27-Aug-12 3:28 
GeneralRe: Controlling No. of Loggeed users Pin
SPSandy27-Aug-12 6:46
SPSandy27-Aug-12 6:46 
GeneralRe: Controlling No. of Loggeed users Pin
pramod.hegde27-Aug-12 6:52
professionalpramod.hegde27-Aug-12 6:52 
GeneralRe: Controlling No. of Loggeed users Pin
SPSandy28-Aug-12 6:49
SPSandy28-Aug-12 6:49 
QuestionSOAP Data: How to Convert Different Datatypes? Pin
Sonhospa24-Aug-12 1:47
Sonhospa24-Aug-12 1:47 
AnswerRe: SOAP Data: How to Convert Different Datatypes? Pin
Abhinav S24-Aug-12 2:15
Abhinav S24-Aug-12 2:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.