Sunteți pe pagina 1din 28

Cdigo QR Quick Response Barcode o cdigo de barras de respuesta rpida

Un cdigo QR (Quick Response Barcode cdigo de barras de respuesta rpida) es un sistema para almacenar informacin en una matriz de puntos o un cdigo de barras bidimensional. Fue creado por la compaa japonesa Denso-Wave en el ao 1994. Estos cdigos se caracterizan por los tres cuadrados que se encuentran en las esquinas y que sirven para que los lectores de cdigos QR puedan detectar su posicin. Los cdigos QR son muy comunes en Japn y de hecho son el cdigo bidimensional ms popular en ese pas. Aunque inicialmente se us para registrar repuestos en el rea de la fabricacin de vehculos, hoy, los cdigos QR se usan para administracin de inventarios en una gran variedad de industrias. Recientemente, la inclusin de software que lee cdigos QR en telfonos mviles, ha permitido nuevos usos orientados al consumidor, que se manifiestan en comodidades como el dejar de tener que introducir datos de forma manual en los telfonos. Las direcciones y las URLs se estn volviendo cada vez ms comunes en revistas, anuncios, emplazamientos tursticos, etc. El agregado de cdigos QR en tarjetas de presentacin tambin se est haciendo comn, simplificando en gran medida la tarea de introducir detalles individuales de un nuevo cliente en la agenda de un telfono mvil. Los cdigos QR tambin pueden leerse desde PC o smartphone mediante dispositivos de captura de imagen, como puede ser un escner o la cmara de fotos siempre y cuando estos dispositivos tengan algn software que permita leer los datos QR. Ejemplo de cdigo QR que guarda la URL de nuestro sitio web (http://www.ajpdsoft.com):

Desarrollar aplicacin Visual Basic .Net VB.Net para generar y leer cdigos QR
Instalar Microsoft Visual Studio .Net
Instalaremos Microsoft Visual Studio .Net como indicamos en este artculo: Instalar Microsoft Visual Studio .Net 2010 y desarrollar aplicacin con acceso a PostgreSQL

Crear aplicacin proyecto VB.Net y diseo AjpdSoft Generador y lector cdigos QR


Una vez instalado el IDE de desarrollo que usaremos, crearemos un nuevo proyecto. Para ello pulsaremos en el men "Archivo" - "Nuevo proyecto" de Microsoft Visual Studio .Net:

En "Plantillas instaladas" seleccionaremos "Visual Basic" - "Windows", en la parte derecha seleccionaremos "Aplicacin de Windows Forms". Introduciremos un nombre para el nuevo proyecto, por ejemplo "AjpdSoftLectorCodigosQR". Tras introducir los datos bsicos de la nueva solucin pulsaremos "Aceptar":

Aadiremos un componente TabControl con dos fichas, en la primera coloraremos los componentes necesarios para configurar el cdigo QR que se generar: texto que contendr

(sms, url, texto, telfono, contacto, email, red wifi, geolocalizacin, evento), nivel de correccin, color de fondo, color del cdigo, escala de los pxeles, forzar UTF-8:

Dentro de esta ficha tambin colocaremos otro TabControl para aadir todos los valores para el QR que queramos generar de forma automtica: SMS, URL, Texto, Telfono, Contacto, Email, Evento, Red Wifi, Geolocalizacin:

Para el SMS:

Para la URL:

Para el Texto libre:

Para llamada a un telfono:

Insertar contacto en agenda:

Enviar correo electrnico (email):

Insertar evento en calendario:

Conectar a una red Wifi:

Geolocalizacin, abrir mapa con un punto determinado:

En el TabControl principal colocaremos un segundo TabControl donde pondremos todos los componentes para la generacin del QR:

y en otra ficha colocaremos un TextBox para mostrar el texto resultante con el que se generar el QR:

En una segunda ficha del TabControl principal colocaremos los componentes necesarios para leer un cdigo QR ya guardado en imagen:

Aadiremos tambin dos componentes no visuales para imprimir los cdigos QR generados un PrintDialog y un PrintDocument (componentes del Cuadro de herramientas, ficha "Impresin"):

En la siguiente descarga publicamos el diseo y el cdigo fuente completo de la aplicacin AjpdSoft Generador y Lector cdigos QR: AjpdSoft Generador y Lector cdigos QR cdigo fuente VB.Net

Librera dll, agregar referencia en VB.Net para generar y leer cdigos QR con VB.Net
Para realizar un proyecto software en VB.Net que genere cdigos QR y que lea cdigos QR generados y previamente guardos en imagen utilizaremos una librera llamada ThoughtWorks.QRCode.dll. Dicha librera est disponible en la descarga gratuita AjpdSoft Generador y Lector cdigos QR cdigo fuente VB.Net. Una vez descargada esta librera la colocaremos en una carpeta del proyecto, a continuacin agregaremos la correspondiente referencia en nuestra solucin VB.Net a esta librera. Para ello accederemos al men "Proyecto" - "Agregar referencia":

Seleccionaremos el fichero de la librera ThoughtWorks.QRCode.dll:

En el cdigo fuente de nuestra solucin, en el fichero .vb del formulario principal aadiremos los imports correspondientes: Imports ThoughtWorks.QRCode Imports ThoughtWorks.QRCode.Codec Imports ThoughtWorks.QRCode.Codec.Data

Cdigo fuente solucin Visual Basic .Net para leer y generar cdigos QR Quick Response Barcode
A continuacin mostramos el listado del cdigo fuente completo (de todos los eventos y componentes) para generar la aplicacin AjpdSoft Generador y Lector cdigos QR:
Imports ThoughtWorks.QRCode Imports ThoughtWorks.QRCode.Codec Imports ThoughtWorks.QRCode.Codec.Data Public Class formLeerGenerarCodigosQR Private colorFondoQR As Integer = Color.FromArgb(255, 255, 255, 255).ToArgb Private colorQR As Integer = Color.FromArgb(255, 0, 0, 0).ToArgb

Private Function AdjustQRVersion(ByVal TextEncode As String, ByVal qrCodeErrCorrect As _ Codec.QRCodeEncoder.ERROR_CORRECTION) As Integer Dim textb() As Byte = System.Text.UTF8Encoding.UTF8.GetBytes(TextEncode) Dim ibits As Integer = ((textb.Length + 1) * 8) + 8 Return -1 Select Case qrCodeErrCorrect 'Correccin de errores del 7% Case QRCodeEncoder.ERROR_CORRECTION.L Select Case ibits Case Is <= 152 Return 1 Case Is <= 272 Return 2 Case Is <= 440 Return 3 Case Is <= 640 Return 4 Case Is <= 864 Return 5 Case Is <= 1088 Return 6 Case Is <= 1248 Return 7 Case Is <= 1552 Return 8 Case Is <= 1856 Return 9 Case Is <= 2192 Return 10 Case Is <= 2592 Return 11 Case Is <= 2960 Return 12 Case Is <= 3424 Return 13 Case Is <= 3688 Return 14 Case Is <= 4184 Return 15 Case Is <= 4712 Return 16 Case Is <= 5176 Return 17 Case Is <= 5768 Return 18 Case Is <= 6360 Return 19 Case Is <= 6888 Return 20 Case Is <= 7456 Return 21 Case Is <= 8048 Return 22

Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Else Return End Select

8752 23 9392 24 10208 25 10960 26 11744 27 12248 28 13048 29 13880 30 14744 31 15640 32 16568 33 17528 34 18448 35 19472 36 20528 37 21616 38 22496 39 23648 40 -1

'Correccin de errores del 15% Case QRCodeEncoder.ERROR_CORRECTION.M Select Case ibits Case Is <= 128 Return 1 Case Is <= 224 Return 2 Case Is <= 352 Return 3 Case Is <= 512 Return 4 Case Is <= 688 Return 5 Case Is <= 864 Return 6 Case Is <= 992 Return 7

Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <=

1232 8 1456 9 1728 10 2032 11 2320 12 2672 13 2920 14 3320 15 3624 16 4056 17 4504 18 5016 19 5352 20 5712 21 6256 22 6880 23 7312 24 8000 25 8496 26 9024 27 9544 28 10136 29 10984 30 11640 31 12328 32 13048 33 13800 34 14496 35 15312

Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Else Return End Select

36 15936 37 16816 38 17728 39 18672 40 -1

'Correccin de errores del 25% Case QRCodeEncoder.ERROR_CORRECTION.Q Select Case ibits Case Is <= 104 Return 1 Case Is <= 176 Return 2 Case Is <= 272 Return 3 Case Is <= 384 Return 4 Case Is <= 496 Return 5 Case Is <= 608 Return 6 Case Is <= 704 Return 7 Case Is <= 880 Return 8 Case Is <= 1056 Return 9 Case Is <= 1232 Return 10 Case Is <= 1440 Return 11 Case Is <= 1648 Return 12 Case Is <= 1952 Return 13 Case Is <= 2088 Return 14 Case Is <= 2360 Return 15 Case Is <= 2600 Return 16 Case Is <= 2936 Return 17 Case Is <= 3176 Return 18 Case Is <= 3560 Return 19 Case Is <= 3880 Return 20 Case Is <= 4096

Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Else Return End Select

21 4544 22 4912 23 5312 24 5744 25 6032 26 6464 27 6968 28 7288 29 7880 30 8264 31 8920 32 9368 33 9848 34 10288 35 10832 36 11408 37 12016 38 12656 39 13328 40 -1

' Correccin de error del 30% Case QRCodeEncoder.ERROR_CORRECTION.H Select Case ibits Case Is <= 72 Return 1 Case Is <= 128 Return 2 Case Is <= 208 Return 3 Case Is <= 288 Return 4 Case Is <= 368 Return 5 Case Is <= 480

Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return

6 528 7 688 8 800 9 976 10 1120 11 1264 12 1440 13 1576 14 1784 15 2024 16 2264 17 2504 18 2728 19 3080 20 3248 21 3536 22 3712 23 4112 24 4304 25 4768 26 5024 27 5288 28 5608 29 5960 30 6344 31 6760 32 7208 33 7688 34

Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Is <= Return Case Else Return End Select End Select End Function

7888 35 8432 36 8768 37 9136 38 9776 39 10208 40 -1

Private Sub establecerColorFondoQR() Dim dlSeleccionColor As New ColorDialog dlSeleccionColor.FullOpen = True dlSeleccionColor.Color = Color.FromArgb(pColorFondo.BackColor.ToArgb) If dlSeleccionColor.ShowDialog = Windows.Forms.DialogResult.OK Then pColorFondo.BackColor = dlSeleccionColor.Color colorFondoQR = pColorFondo.BackColor.ToArgb End If dlSeleccionColor.Dispose() End Sub Private Sub establecerColorQR() Dim dlSeleccionColor As New ColorDialog dlSeleccionColor.FullOpen = True dlSeleccionColor.Color = Color.FromArgb(pColorQR.BackColor.ToArgb) If dlSeleccionColor.ShowDialog = Windows.Forms.DialogResult.OK Then pColorQR.BackColor = dlSeleccionColor.Color colorQR = pColorFondo.BackColor.ToArgb End If dlSeleccionColor.Dispose() End Sub Private Sub btColorFondo_Click(sender As System.Object, e As System.EventArgs) _ Handles btColorFondo.Click, pColorFondo.Click establecerColorFondoQR() End Sub Private Sub btColorQR_Click(sender As System.Object, e As System.EventArgs) _ Handles btColorQR.Click, pColorQR.Click establecerColorQR()

End Sub Private Sub pColorQR_Click(sender As System.Object, e As System.EventArgs) establecerColorQR() End Sub Private Sub pColorFondo_Click(sender As System.Object, e As System.EventArgs) establecerColorFondoQR() End Sub Private Sub formLeerGenerarCodigosQR_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load lsNivelCorreccion.SelectedIndex = 1 txtEscalaPixel.Text = 4 pColorFondo.BackColor = Color.FromArgb(colorFondoQR) pColorQR.BackColor = Color.FromArgb(colorQR) tabFormatoQR.SelectedTab = tabQRSMS txtSMSMensaje_TextChanged(sender, e) End Sub Private Sub txtSMSMensaje_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtSMSMensaje.TextChanged, txtSMSNumeroTelefono.TextChanged txtTextoQR.Text = "SMSTO:" + txtSMSNumeroTelefono.Text + ":" + txtSMSMensaje.Text End Sub Private Sub txtURL_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtURL.TextChanged txtTextoQR.Text = txtURL.Text End Sub Private Sub txtTextoLibre_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtTextoLibre.TextChanged txtTextoQR.Text = txtTextoLibre.Text End Sub Private Sub txtNumeroTelefono_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtNumeroTelefono.TextChanged txtTextoQR.Text = "TEL:" + txtNumeroTelefono.Text End Sub Private Sub txtVcardNombre_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtVcardNombre.TextChanged, txtVcardURL.TextChanged, txtVcardTelefono.TextChanged, txtVcardMail.TextChanged, txtVcardEmpresa.TextChanged, txtVcardDireccion.TextChanged, txtVcardCargo.TextChanged txtTextoQR.Text = "BEGIN:VCARD" + vbCrLf + "N:" + txtVcardNombre.Text + _ vbCrLf + "TITLE:" + txtVcardCargo.Text + vbCrLf + "ORG:" + _ txtVcardEmpresa.Text + vbCrLf + "ADDR:" + txtVcardDireccion.Text + _

vbCrLf + "TEL:" + txtVcardTelefono.Text + vbCrLf + "EMAIL:" + _ txtVcardMail.Text + vbCrLf + "URL:" + txtVcardURL.Text + vbCrLf + "END:VCARD" End Sub Private Sub txtEMailDestinatario_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtEMailDestinatario.TextChanged, txtEMailMensaje.TextChanged, txtEMailAsunto.TextChanged txtTextoQR.Text = "SMTP:" + txtEMailDestinatario.Text + _ ":" + txtEMailAsunto.Text + ":" + txtEMailMensaje.Text End Sub Private Sub txtEventoAsunto_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtEventoAsunto.TextChanged, txtEventoUbicacion.TextChanged, txtEventoHastaHora.ValueChanged, txtEventoHasta.ValueChanged, txtEventoDesdeHora.ValueChanged, txtEventoDesde.ValueChanged, txtEventoDescripcion.TextChanged txtTextoQR.Text = "BEGIN:VEVENT" + vbCrLf + "SUMMARY:" + txtEventoAsunto.Text + vbCrLf + "DTSTART:" + txtEventoDesde.Value.Year.ToString("0000") + txtEventoDesde.Value.Month.ToString("00") + txtEventoDesde.Value.Day.ToString("00") + "T" + txtEventoDesdeHora.Value.Hour.ToString("00") + txtEventoDesdeHora.Value.Minute.ToString("00") + "00" + vbCrLf + "DTEND:" + txtEventoHasta.Value.Year.ToString("0000") + txtEventoHasta.Value.Month.ToString("00") + txtEventoHasta.Value.Day.ToString("00") + "T" + txtEventoHastaHora.Value.Hour.ToString("00") + txtEventoHastaHora.Value.Minute.ToString("00") + "00" + vbCrLf + "LOCATION:" + txtEventoUbicacion.Text + vbCrLf + "DESCRIPTION:" + txtEventoDescripcion.Text + vbCrLf + "END:VEVENT" End Sub Private Sub btGenerarQR_Click(sender As System.Object, e As System.EventArgs) Handles btGenerarQR.Click If txtEscalaPixel.Text.Trim = "" Then MsgBox("Debe indicar la escala de los pxeles del " + "QR que se generar.", MsgBoxStyle.Information + MsgBoxStyle.OkOnly) txtEscalaPixel.Focus() Else If Val(txtEscalaPixel.Text) = 0 Then txtEscalaPixel.Text = 4 End If Dim generarCodigoQR As QRCodeEncoder = New QRCodeEncoder generarCodigoQR.QRCodeEncodeMode = Codec.QRCodeEncoder.ENCODE_MODE.BYTE

generarCodigoQR.QRCodeScale = Int32.Parse(txtEscalaPixel.Text) Select Case lsNivelCorreccion.Text Case "Bajo (7%)" generarCodigoQR.QRCodeErrorCorrect = Codec.QRCodeEncoder.ERROR_CORRECTION.L Case "Medio (15%)" generarCodigoQR.QRCodeErrorCorrect = Codec.QRCodeEncoder.ERROR_CORRECTION.M Case "Alto (25%)" generarCodigoQR.QRCodeErrorCorrect = Codec.QRCodeEncoder.ERROR_CORRECTION.Q Case "Muy alto (30%)" generarCodigoQR.QRCodeErrorCorrect = Codec.QRCodeEncoder.ERROR_CORRECTION.H End Select 'La versin "0" calcula automticamente el tamao generarCodigoQR.QRCodeVersion = 0 '' --------- Forzar una determinada version ----------''En caso de querer forzar una determinada version '(tamao) el siguiente cdigo devuelve la ''versin mnima para el texto que se quiere cdificar: 'Dim iVersion As Integer = ' AdjustQRVersion(TextBox1.Text, QRCodeEncoder.QRCodeErrorCorrect) 'If iVersion = -1 Then ' MessageBox.Show("El texto es demasiado grande o el " + ' "Correction Level (ERROR_CORRECTION) no es el apropiado") ' Exit Sub 'Else ' qrCodeEncoder.QRCodeVersion = iVersion 'End If '' ----------------------------------------------------generarCodigoQR.QRCodeBackgroundColor = System.Drawing.Color.FromArgb(colorFondoQR) generarCodigoQR.QRCodeForegroundColor = System.Drawing.Color.FromArgb(colorQR) Try If opForzarUTF.Checked Then 'Con UTF-8 podremos aadir caracteres como , tildes, etc. imgQR.Image = generarCodigoQR.Encode(txtTextoQR.Text, System.Text.Encoding.UTF8) Else imgQR.Image = generarCodigoQR.Encode(txtTextoQR.Text) End If Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical + MsgBoxStyle.OkOnly) End Try End If

End Sub Private Sub txtRedWifiSSID_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtRedWifiSSID.TextChanged, txtRedWifiContrasena.TextChanged, lsRedWifiTipo.TextChanged Dim tipoWifi As String = "nopass" If lsRedWifiTipo.Text = "Sin encriptacin" Then tipoWifi = "nopass" End If If lsRedWifiTipo.Text = "WPA/WPA2" Then tipoWifi = "WPA" End If If lsRedWifiTipo.Text = "WEP" Then tipoWifi = "WEP" End If txtTextoQR.Text = "WIFI:S:" + txtRedWifiSSID.Text + ";T:" + tipoWifi + ";P:" + txtRedWifiContrasena.Text + ";;" End Sub Private Sub txtGeoLatitud_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtGeoLatitud.TextChanged, txtGeoLongitud.TextChanged, txtGeoConsulta.TextChanged txtTextoQR.Text = "geo:" + txtGeoLatitud.Text + "," + txtGeoLongitud.Text + "?=" + txtGeoConsulta.Text End Sub Private Sub btGuardarQR_Click(sender As System.Object, e As System.EventArgs) Handles btGuardarQR.Click Dim dlGuardar As New SaveFileDialog If IsNothing(imgQR.Image) Then MsgBox("No se ha generado el Cdigo QR. Antes de guardar " + "debe generar un cdigo QR.", MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly) Else dlGuardar.Filter = "JPEG|*.jpg|Mapa de Bits|*.bmp|Gif|*.gif|PNG|*.png" dlGuardar.Title = "Guardar cdigo QR" dlGuardar.FileName = "codigo_qr" dlGuardar.ShowDialog() If (dlGuardar.FileName <> "") Then Select Case dlGuardar.FilterIndex Case 1 imgQR.Image.Save(dlGuardar.FileName, System.Drawing.Imaging.ImageFormat.Jpeg) Case 2 imgQR.Image.Save(dlGuardar.FileName, System.Drawing.Imaging.ImageFormat.Bmp) Case 3 imgQR.Image.Save(dlGuardar.FileName, System.Drawing.Imaging.ImageFormat.Gif) Case 4 imgQR.Image.Save(dlGuardar.FileName, System.Drawing.Imaging.ImageFormat.Png) End Select End If

End If End Sub Private Sub btImprimirQR_Click(sender As System.Object, e As System.EventArgs) Handles btImprimirQR.Click If IsNothing(imgQR.Image) Then MsgBox("No se ha generado el Cdigo QR. Antes de " + "imprimir debe generar un cdigo QR.", MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly) Else dlImprimir.Document = imprimirDoc If dlImprimir.ShowDialog = Windows.Forms.DialogResult.OK Then imprimirDoc.Print() End If End If End Sub Private Sub PrintDocument1_PrintPage(sender As System.Object, e As System.Drawing.Printing.PrintPageEventArgs) _ Handles imprimirDoc.PrintPage e.Graphics.DrawImage(imgQR.Image, 0, 0) End Sub Private Sub btSelImagenQR_Click(sender As System.Object, e As System.EventArgs) Handles btSelImagenQR.Click Dim dlAbrirImagenQR As New OpenFileDialog dlAbrirImagenQR.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.MyPictures dlAbrirImagenQR.Filter = "*.bmp;*.gif;*.jpg;*.png|*.bmp;*.gif;*.jpg;*.png" dlAbrirImagenQR.RestoreDirectory = True dlAbrirImagenQR.CheckFileExists = True dlAbrirImagenQR.CheckPathExists = True If dlAbrirImagenQR.ShowDialog = Windows.Forms.DialogResult.OK Then txtLeerQRImagen.Text = dlAbrirImagenQR.FileName End If End Sub Private Sub btDecodificarImagenQR_Click(sender As System.Object, e As System.EventArgs) Handles btDecodificarImagenQR.Click If IsNothing(imgQRExistente.Image) Then MsgBox("Antes de decodificar una imagen QR a su texto " + "correspondiente QR Code debe seleccionar la imagen.", MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly) btSelImagenQR.Focus() Else Try Dim decoder As QRCodeDecoder = New QRCodeDecoder If opLeerForzarUTF8.Checked Then txtLeerQRTexto.Text = decoder.decode(New QRCodeBitmapImage( _ New Bitmap(imgQRExistente.Image)), System.Text.Encoding.UTF8) Else txtLeerQRTexto.Text =

decoder.decode(New QRCodeBitmapImage( _ New Bitmap(imgQRExistente.Image))) End If Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical + MsgBoxStyle.OkOnly) End Try End If End Sub Private Sub txtLeerQRImagen_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtLeerQRImagen.TextChanged If System.IO.File.Exists(txtLeerQRImagen.Text) Then imgQRExistente.Image = New Bitmap(txtLeerQRImagen.Text) End If End Sub Private Sub tabFormatoQR_SelectedIndexChanged(sender As System.Object, _ e As System.EventArgs) Handles tabFormatoQR.SelectedIndexChanged If tabFormatoQR.SelectedTab Is tabQRSMS Then txtSMSMensaje_TextChanged(sender, e) End If If tabFormatoQR.SelectedTab Is tabQRURL Then txtURL_TextChanged(sender, e) End If If tabFormatoQR.SelectedTab Is tabQRTexto Then txtTextoLibre_TextChanged(sender, e) End If If tabFormatoQR.SelectedTab Is tabQRNumeroTelefono Then txtNumeroTelefono_TextChanged(sender, e) End If If tabFormatoQR.SelectedTab Is tabQRVcard Then txtVcardNombre_TextChanged(sender, e) End If If tabFormatoQR.SelectedTab Is tabQRMAIL Then txtEMailDestinatario_TextChanged(sender, e) End If If tabFormatoQR.SelectedTab Is tabQREvento Then txtEventoAsunto_TextChanged(sender, e) End If If tabFormatoQR.SelectedTab Is tabQRRedWifi Then txtRedWifiSSID_TextChanged(sender, e) End If If tabFormatoQR.SelectedTab Is tabQRGeolocalizacion Then txtGeoLatitud_TextChanged(sender, e) End If End Sub

Private Sub linkURL_LinkClicked(sender As System.Object, _ e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) _ Handles linkURL.LinkClicked System.Diagnostics.Process.Start("http://www.ajpdsoft.com") End Sub End Class

AjpdSoft Generador y lector cdigos QR en funcionamiento


Generar cdigos QR con AjpdSoft Generador y lector cdigos QR
Tras ejecutar AjpdSoft Generador y Lector cdigos QR, para generar un cdigo de barras QR pulsaremos en la pestaa "Generar QR". Podremos generar un cdigo QR con un formato determinado para enviar un SMS, indicar una URL (direccin de pgina web), un texto variable (libre), para hacer una llamada a un nmero de telfono, para insertar un contacto en la agenda del telfono mvil, para enviar un correo electrnico, para insertar un evento o cita en nuestro calendario, para conectarnos a una red wifi, para acceder a un lugar. Para generar un QR con cualquiera de estos formatos pulsaremos en la pestaa apropiada, por ejemplo, para insertar una cita en el calendario del telfono mvil pulsaremos en la ficha "Evento", introduciremos los datos (asunto, ubicacin, desde, hasta, descripcin) y, en la pestaa "Texto QR" podremos ir viendo el texto que se generar en el QR:

Cuando tengamos el texto introducido pulsaremos en la ficha "QR", podremos elegir el nivel de correccin (por defecto Medio 15%), el color de fondo para el QR, el color del propio QR (no deben ser el mismo ni colores muy "difuminados", de lo contrario no podr leerse el QR), la escala del pixel (por defecto 4) y si queremos forzar UTF-8. Una vez elegidas las opciones de configuracin pulsaremos en el botn "Generar QR":

Si todo es correcto se generar el cdigo QR en la parte inferior de AjpdSoft Generador y Lector cdigos QR. Si queremos guardar el cdigo QR generado en un fichero de imagen pulsaremos en el botn "Guardar QR":

Seleccionaremos la carpeta y el nombre para el fichero de imagen as como el formato en el que queramos guardarlo en "Tipo": JPEG, BMP, GIF PNG y pulsaremos "Guardar":

Si queremos imprimir el cdigo QR Quick Response Barcode en papel o en una impresora PDF pulsaremos en "Imprimir QR":

Seleccionaremos la impresora y pulsaremos "Imprimir":

Leer y decodificar cdigo QR de imagen con AjpdSoft Generador y Lector cdigos QR


Tras ejecutar AjpdSoft Generador y Lector cdigos QR, para decodificar o leer el contenido de un cdigo de barras QR ya generado y guardado en imagen pulsaremos en la pestaa "Leer QR ". Podremos decodificar cualquier tipo de cdigo QR, pulsaremos en el botn de seleccin de fichero con cdigo QR:

Seleccionaremos el fichero que contiene el cdigo QR y pulsremos "Abrir":

Se mostrar en la parte inferior, para decodificarlo pulsaremos en el botn "Leer QR":

Si es un cdigo QR correcto en la parte inferior, en "Texto resultante" mostrar el texto contenido y decodificado del QR seleccionado:

S-ar putea să vă placă și