重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
成都创新互联主营顺河网站建设的网络公司,主营网站建设方案,成都App定制开发,顺河h5成都微信小程序搭建,顺河网站营销推广欢迎顺河等地区企业咨询
DataGridView1.Columns.Clear()
DataGridView1.DataSource = GetDateTable("1|2|3,张三|李四|王五,1111111|2222222|3333333", "编号|姓名|卡号")
End Sub
Function GetDateTable(ByVal s As String, ByVal TabNames As String) As DataTable
Dim tb As New DataTable
Dim ss() As String = s.Split(",")
Dim tc() As String = TabNames.Split("|")
Dim c As Integer
For Each i As String In ss
Dim ts() As String = i.Split("|")
Dim dc As DataColumn
If c tc.Length Then
dc = New DataColumn(tc(c))
Else
dc = New DataColumn
End If
tb.Columns.Add(dc)
For j As Integer = 0 To ts.Length - 1
If j tb.Rows.Count - 1 Then
tb.Rows.Add(tb.NewRow)
End If
tb.Rows(j)(dc) = ts(j)
Next
c += 1
Next
Return tb
End Function
给你个工程自己看...
运行后可以看到自己...
点按钮保存到c:\1.bmp
using Sytem.net.socket;
tcpclient tc = new tcpclient(127.0.0.1,8080);//连接8080端口
netstream ns =tc.getstream();
if(ns.canwrite)
{
byte[] buffer = {0x66, 0x73, 0x52, 0x4E ,0x20 ,0x4C, 0x4D, 0x33, 0x73, 0x56 ,0x23, 0x6E ,0x64 ,0x61, 0x74 ,0x61 ,0x22};
ns.writer(0,buffer,buffer.length);
}
简单的帮你写了下,不会可以通过私信联系我。
Private Const WS_CHILD = H40000000
Private Const WS_VISIBLE = H10000000
Private Const WM_CAP_START = H400
Private Const WM_CAP_DRIVER_CONNECT = WM_CAP_START + 10
Private Const WM_CAP_SET_SCALE = WM_CAP_START + 53
Private Const WM_CAP_SET_PREVIEWRATE = WM_CAP_START + 52
Private Const WM_CAP_SET_PREVIEW = WM_CAP_START + 50
Private Declare Function capCreateCaptureWindowA Lib "avicap32.dll" ( _
ByVal lpszWindowName As String, _
ByVal dwStyle As Long, _
ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Integer, _
ByVal hWndParent As Long, ByVal nID As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Long) As Long
Private Sub Form_Load()
'建立采集窗口(不显示窗口,处理后显示到PIC控件)
uwndc = capCreateCaptureWindowA("", WS_VISIBLE Or WS_CHILD, 0, 0, 320, 240, Me.hWnd, 0)
'连接
SendMessage uwndc, WM_CAP_DRIVER_CONNECT, 0, 0
'Scale开
SendMessage uwndc, WM_CAP_SET_SCALE, True, 0
'显示刷新MS
SendMessage uwndc, WM_CAP_SET_PREVIEWRATE, 40, 0
'用予览方式显示(特殊需要,不显示予缆)
SendMessage uwndc, WM_CAP_SET_PREVIEW, True, 0
End Sub
上述代码就可以实现 但是要注意相应的控件是否存在 不存在的 你自己画出来