包含vb.net0:x2的词条
VB.NET 一次函数求横坐标
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
目前成都创新互联公司已为上千的企业提供了网站建设、域名、虚拟空间、网站运营、企业网站设计、东山网站维护等服务,公司将坚持客户导向、应用为本的策略,正道将秉承"和谐、参与、激情"的文化,与客户和合作伙伴齐心协力一起成长,共同发展。
Dim X2 As Integer = 0
Dim Y2 As Integer = 0
Dim X3 As Integer = 2
Dim Y3 As Integer = -1
Dim X4 As Integer = 6
Dim Y4 As Integer = 3
'首先计算y=kx+b
Dim k As Double = (6 - 2) / (3 - (-1))
Dim b As Double = -1 - k * 2
'根据y求x
Dim X5 As Double = -b / k
TextBox1.Text = Math.Abs(X5 - X2)
End Sub
vb.net2010十六进制读取串口的问题
不是很明白你的题意
strHex = strHex + [String].Format("{0:X2} "
这里的意思是把每个字节数据转换成了十六进制,每个字节占两个字符
如果你串口收到的4个字节数据:43,27,56,200
那么你的结果是:2B1B38C8
即receivebytes.Text="2B1B38C8"
不足两位的补0
如果你串口收到的4个字节数据:3,27,56,200
那么你的结果是:031B38C8
即receivebytes.Text="031B38C8"
vb.net数组赋值
Dim x(8, 8)
Dim a As Integer
Dim b As Integer
b = 0
For i = 0 To 8
For j = 0 To 8
If b = 3 Then
b = 1
a = a + 1
Else
b = b + 1
End If
x(i, j) = aNext
Next
求VB.NET的MD5算法调用
下面是完整的类,可以设置任意密码
'DES及md5加密解密----添加引用中添加对system.web的引用。
Imports System.Security.Cryptography
Imports System
Imports System.Text
Imports System.Web
''' summary
''' DES加密类
''' /summary
''' remarks/remarks
Public Class DESEncrypt
Public Sub DESEncrypt()
End Sub
Public Shared Function Encrypt(ByVal Text As String) As String
Return Encrypt(Text, "12345678")
End Function
Public Shared Function Encrypt(ByVal Text As String, ByVal sKey As String) As String
Dim des As New DESCryptoServiceProvider()
Dim inputByteArray As Byte()
inputByteArray = Encoding.Default.GetBytes(Text)
des.Key = ASCIIEncoding.ASCII.GetBytes(System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(sKey, "md5").Substring(0, 8))
des.IV = ASCIIEncoding.ASCII.GetBytes(System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(sKey, "md5").Substring(0, 8))
Dim ms As New System.IO.MemoryStream()
Dim cs As New CryptoStream(ms, des.CreateEncryptor(), CryptoStreamMode.Write)
cs.Write(inputByteArray, 0, inputByteArray.Length)
cs.FlushFinalBlock()
Dim ret As New StringBuilder()
Dim b As Byte
For Each b In ms.ToArray()
ret.AppendFormat("{0:X2}", b)
Next
Return ret.ToString()
End Function
Public Shared Function Decrypt(ByVal Text As String) As String
Return Decrypt(Text, "12345678")
End Function
Public Shared Function Decrypt(ByVal Text As String, ByVal sKey As String) As String
Dim des As New DESCryptoServiceProvider()
Dim len As Integer
len = Text.Length / 2
Dim inputByteArray(len - 1) As Byte
Dim x, i As Integer
For x = 0 To len - 1
i = Convert.ToInt32(Text.Substring(x * 2, 2), 16)
inputByteArray(x) = CType(i, Byte)
Next
des.Key = ASCIIEncoding.ASCII.GetBytes(System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(sKey, "md5").Substring(0, 8))
des.IV = ASCIIEncoding.ASCII.GetBytes(System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(sKey, "md5").Substring(0, 8))
Dim ms As New System.IO.MemoryStream()
Dim cs As New CryptoStream(ms, des.CreateDecryptor(), CryptoStreamMode.Write)
cs.Write(inputByteArray, 0, inputByteArray.Length)
cs.FlushFinalBlock()
Return Encoding.Default.GetString(ms.ToArray())
End Function
End Class
'以下是调用方法
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click '加密
Dim str_Encrypt As String = DESEncrypt.Encrypt("你要加密的文本,可以是任意长度", "密码,可以很长,如果省略这个参数就是默认的12345678")
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click '解密
Dim str_Decrypt As String = DESEncrypt.Decrypt("你要解密的文本, 可以是任意长度", "加密时用到的密码,如果省略这个参数就是默认的12345678")
End Sub
vb.net怎么自定义坐标系
scale(x1,y1)-(x2,y2)
你只要记住,这里的x1,y1是左上角的坐标,x2,y2是右下角的坐标,通过这两个点的坐标设定,就可以决定坐标原点的位置以及坐标轴的方向了,比如
Scale (-300,200)-(300,-200)
以上是把坐标原点设在窗体中心,x轴长600,方向从左到右,y轴长400,方向从下向上。
Scale (800,0)-(0,600)
以上是把坐标原点设在窗体右上角,x轴长800,方向从右到左,y轴长600,方向从上向下。
下面说坐标轴和原点的标示法:
假定自定义坐标设为:
Scale (-300, 200)-(300, -200)
则
Line (-300, 0)-(300, 0) '画x轴
Line (0, 200)-(0, -200) '画y轴
CurrentX = 290
CurrentY = -5
Print "x" '标示x轴
CurrentX = 5
CurrentY = 200
Print "y" '标示y轴
CurrentX = 5
CurrentY = -5
Print "0" '标示原点
分享标题:包含vb.net0:x2的词条
转载源于:http://cdiso.cn/article/hjossg.html