网站建设资讯

NEWS

网站建设资讯

vb.net扫描仪 web扫描仪

VB.NET TEXTBox控件我想控制它只能用扫描枪读资料不能让用户输入资料

在TEXTBox的属性找到ReadOnly,设置为TURE

创新互联专注于企业成都全网营销推广、网站重做改版、梅河口网站定制设计、自适应品牌网站建设、H5网站设计成都商城网站开发、集团公司官网建设、外贸网站制作、高端网站制作、响应式网页设计等建站业务,价格优惠性价比高,为梅河口等各大城市提供网站开发制作服务。

还有一个方法是用Lable不用Textbox

==========================================

就是我尝试设置为ReadOnly设置为TURE

执行以下代码

TextBox1.Text = "123"

在在TEXTBOX能成功显示能够成功显示123

怎样用VB把一张图片透明的放到Picture里,在线等

Public Function TranBlt(DestHdc As Long, X As Long, Y As Long, W As Long, H As Long, srcHdcOrBmp As Long, Optional srcX As Integer, Optional srcY As Integer, Optional srcW As Long, Optional srcH As Long, Optional tc As Long = -1, Optional IsBmp As Boolean) As Long

'srcHdcOrBmp参数 传入的可以是hdc也可以是Bmp对象的Handle,

'IsBmp参数 为真时srcHdcOrBmp代表Bmp对象的Handle,为假时代表hdc

'返回值 成功时返回透明色,不成功时返回-1

Dim tHdc(3) As MemHdc

Dim J As Long, oc As Long, I As Long, Bm As BITMAP, cc As Long, NewDc As Long

Dim sw As Long, sh As Long, sBmp As Long, sHdc As Long, obm As Long, NewX As Long, NewY As Long

If DestHdc = 0 Or srcHdcOrBmp = 0 Or W = 1 And H = 1 Then GoTo fail

If IsBmp Then '若传入的是Bmp句柄,需为其创建一个临时DC

sBmp = srcHdcOrBmp

tHdc(3) = NewMyHdc(DestHdc, 0, 0, srcHdcOrBmp)

sHdc = tHdc(3).hdc

Else

sHdc = srcHdcOrBmp

If srcW = 0 Then sBmp = GetCurrentObject(sHdc, 7)

End If

If sHdc = 0 Or sBmp = 0 Then GoTo fail

If srcW = 0 Then '若没有提供源图大小,需取得整个源图大小

GetObj sBmp, Len(Bm), Bm

sw = Bm.bmWidth - srcX

sh = Bm.bmHeight - srcY

Else

sw = srcW

sh = srcH

End If

If sw 1 Or sh 1 Then GoTo fail

If tc = -1 Then

cc = GetPixel(sHdc, srcX, srcY) '将左上角第一个像素作为源图背景色,用于透明

Else

cc = tc

End If

If W sw Or H sh Then

tHdc(2) = NewMyHdc(DestHdc, W, H)

StretchBlt tHdc(2).hdc, 0, 0, W, H, sHdc, srcX, srcY, sw, sh, vbSrcCopy

'先将源图缩放,下面步骤就一样了。

NewDc = tHdc(2).hdc

Else

NewDc = sHdc

NewX = srcX

NewY = srcY

End If

BitBlt DestHdc, X, Y, W, H, NewDc, NewX, NewY, vbSrcInvert

'将源图先反色(XOR)绘入目标图,若源图背景为黑色,此步可省

'下面是制作Mask图的方法

I = CreateBitmap(W, H, 1, 1, ByVal 0) '建立单色位图

tHdc(0) = NewMyHdc(DestHdc, 0, 0, I) '为单色图建立新DC,并选入

tHdc(1) = NewMyHdc(DestHdc, W, H) '另建一个彩色图及DC,用于存放Mask图

oc = SetBkColor(NewDc, cc) '将源图背景色改为透明色

BitBlt tHdc(0).hdc, 0, 0, W, H, NewDc, NewX, NewY, vbSrcCopy

'先将源图绘入单色DC,由此产生只有正反的Mask图,背景色(透明色)为黑,其它为白

SetBkColor NewDc, oc '恢复源图背景色,不是必须的,但这是个好习惯。

BitBlt tHdc(1).hdc, 0, 0, W, H, tHdc(0).hdc, 0, 0, vbSrcCopy

'单色DC必须复制进彩色DC才能进行后面的的AND运算

'Mask图完成,并已放入彩色DC

BitBlt DestHdc, X, Y, W, H, tHdc(1).hdc, 0, 0, vbSrcAnd '标准透明绘图:选将Mask图用And运算绘入,

BitBlt DestHdc, X, Y, W, H, NewDc, NewX, NewY, vbSrcInvert '再将源图以反色(XOR)绘入一次

DelMyHdc tHdc(0)

DelMyHdc tHdc(1)

If tHdc(2).hdc 0 Then DelMyHdc tHdc(2)

If tHdc(3).hdc 0 Then DelMyHdc tHdc(3)

TranBlt = cc

Exit Function

fail:

If tHdc(3).hdc 0 Then DelMyHdc tHdc(3)

TranBlt = -1

End Function

Private Function NewMyHdc(dHdc As Long, W As Long, H As Long, Optional Bm As Long) As MemHdc

With NewMyHdc

.hdc = CreateCompatibleDC(dHdc)

If Bm = 0 Then

.Bmp = CreateCompatibleBitmap(dHdc, W, H)

Else

.Bmp = Bm

End If

.obm = SelectObject(.hdc, .Bmp)

End With

End Function

Private Function DelMyHdc(MyHdc As MemHdc, Optional nobmp As Boolean) As MemHdc

With MyHdc

If .hdc 0 And .obm 0 Then SelectObject .hdc, .obm

If nobmp = False And .Bmp 0 Then DeleteObject .Bmp

If .hdc 0 Then DeleteDC .hdc

End With

End Function

把这个函数放在一个BAS里,然后在窗体里

TranBlt pic.hdc, X,Y,W,H,PIC2.Picture.Handle, _

TX,TY,TW,TH, , True

就OK

vb.net代码,扫描仪

你的想法很难实现。重写驱动难度相当大。

如果我是你的话,我会和客户讲明难度,并推荐代替方案。

扫描还是用原本驱动进行扫描,保存图片是保存到制定目录。

开发的应用系统监测制定目录,并图本地文件进行保存数据库。

这样就很容易做了。


本文题目:vb.net扫描仪 web扫描仪
本文地址:http://njwzjz.com/article/doipepg.html