Discussion:
Teclado Virtual
(too old to reply)
Fabio Luis Rodrigues
2005-07-28 17:20:04 UTC
Permalink
Boa Tarde Gente,

Alguem por acaso saberia informar se existe algum artigo que ajude-me a
criar um teclado virtual ?

Estou tentando um teclado tipo a do Itaú um botão para Dois números.
--
Fabio Luis Rodrigues
Desenvolvedor Web
ASP.NET - VB.NET
Glaudiston Gomes da Silva
2005-07-29 12:55:03 UTC
Permalink
Oi Fábio... fiz especialmente pra vc: (Acho q vale um ponto pra mim) ;-)

segue o código:

<%@ Page Language="VB" %>
<%@ Import namespace="System.Drawing" %>
<%@ Import namespace="System.Drawing.Imaging" %>
<%@ Import namespace="System.Drawing.Text" %>
<%@ import namespace="System.Drawing.Drawing2D" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<script runat="server">
Protected Sub form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs)
If Not Request.Params("n") Is Nothing Then
Response.ContentType = "image/gif"
Response.Expires = 0
Response.Buffer = True
Response.Clear()
Dim w As Integer = 30, h As Integer = 30
Dim objectoBitmap As Bitmap
Dim objectoGraficos As Graphics
objectoBitmap = New Bitmap(w, h)

objectoGraficos = Graphics.FromImage(objectoBitmap)
objectoGraficos.Clear(Color.White)

objectoGraficos.TextRenderingHint =
TextRenderingHint.SystemDefault
objectoGraficos.DrawString(Request.Params("n"), New
Font("Verdana", 14), Brushes.Red, 1, 1)

objectoBitmap.Save(Response.OutputStream, ImageFormat.Gif)
Response.End()
End If
Dim i As Integer
Randomize() ' Inicializa a aleatoriariedade.
i = CInt(Int((2 * Rnd()) + 1)) ' Gera um numero randômico entre 1 e 2.
Dim i2 As Integer = IIf(i = 1, 2, 1)
Me.teclado.InnerHtml = ""
Me.teclado.InnerHtml += "<SCR" + "IPT>"
Me.teclado.InnerHtml += "function clicou(n)"
Me.teclado.InnerHtml += "{"
Me.teclado.InnerHtml += " document.getElementById('" &
TextBox1.UniqueID & "').value=n"
Me.teclado.InnerHtml += "}"
Me.teclado.InnerHtml += "</SCR" + "IPT>"
Me.teclado.InnerHtml += "<img src='tecladovirtual.aspx?n=" & i & "'
onclick='clicou(" & i & ");' />"
Me.teclado.InnerHtml += "<img src='tecladovirtual.aspx?n=" & i2 & "'
onclick='clicou(" & i2 & ");' />"
End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server" onload="form1_Load">
Este é um teclado virtual...<br />Clique nos botões abaixo para
testálos:<br />
<div id="teclado" runat=server />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</form>
</body>
</html>

Espero ter ajudado.
--
Abs,
Ton

Sendo ajudei, marque como util.
Post by Fabio Luis Rodrigues
Boa Tarde Gente,
Alguem por acaso saberia informar se existe algum artigo que ajude-me a
criar um teclado virtual ?
Estou tentando um teclado tipo a do Itaú um botão para Dois números.
--
Fabio Luis Rodrigues
Desenvolvedor Web
ASP.NET - VB.NET
Loading...