国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

VB中獲取指定打印機的各種紙張類型及大小

2024-07-21 02:25:11
字體:
來源:轉載
供稿:網友

商業源碼熱門下載www.html.org.cn

  放入一個msflexgrid,名稱為fgd1,列數為4'option explicit
private const dc_maxextent = 5
private const dc_minextent = 4
private const dc_papernames = 16
private const dc_papers = 2
private const dc_papersize = 3
private declare function devicecapabilities lib "winspool.drv" alias "devicecapabilitiesa" (byval lpdevicename as string, byval lpport as string, byval iindex as long, lpoutput as any, lpdevmode as any) as long
private type points
        x  as long
        y  as long
end type
private sub form_load()
dim i as longwith fgd1
    .clear
   
    .formatstring = "^紙張編號|^紙張名稱|^紙張長度|^紙張寬度"
    for i = 0 to .cols - 1
        .colwidth(i) = 1700
    next i
    .allowuserresizing = flexresizecolumns
    .left = 0
    .width = me.scalewidth
end withgetpaperinfoend subprivate sub getpaperinfo()
dim i as long, ret as long
dim length as integer, width as integer
dim paperno() as integer, papername() as string, papersize() as points'支持最大打印紙:
ret = devicecapabilities(打印機名稱, "lpt1", dc_maxextent, byval 0&, byval 0&)
length = ret / 65536
width = ret - length * 65536
'lblmaxlength.caption = length
'lblmaxwidth.caption = width'支持最小打印紙:
ret = devicecapabilities(打印機名稱, "lpt1", dc_minextent, byval 0&, byval 0&)
length = ret / 65536
width = ret - length * 65536
'支持紙張種類數
ret = devicecapabilities(打印機名稱, "lpt1", dc_papers, byval 0&, byval 0&)'紙張編號
redim paperno(1 to ret) as integer
call devicecapabilities(打印機名稱, "lpt1", dc_papers, paperno(1), byval 0&)'紙張名稱
dim arrpagename() as byte
dim allnames as string
dim lstart as long, lend as long
redim papername(1 to ret) as string
redim arrpagename(1 to ret * 64) as byte
call devicecapabilities(打印機名稱, "lpt1", dc_papernames, arrpagename(1), byval 0&)
allnames = strconv(arrpagename, vbunicode)
'loop through the string and search for the names of the papers
i = 1
do
    lend = instr(lstart + 1, allnames, chr$(0), vbbinarycompare)
    if (lend > 0) and (lend - lstart - 1 > 0) then
        papername(i) = mid$(allnames, lstart + 1, lend - lstart - 1)
        i = i + 1
    end if
    lstart = lend
loop until lend = 0'紙張尺寸redim papersize(1 to ret) as points
call devicecapabilities(form2.combo1.text, "lpt1", dc_papersize, papersize(1), byval 0&)'顯示在表格中
for i = 1 to ret
    fgd1.additem paperno(i) & vbtab & papername(i) & vbtab & papersize(i).y & vbtab & papersize(i).x
next i'移除第一個空行
fgd1.row = 1
fgd1.removeitem 1
end subprivate sub form_resize()
with fgd1
    .left = 0
    .width = me.scalewidth
    .height = me.scaleheight
    .top = 0
end withend sub
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 定兴县| 汶上县| 伊宁市| 石棉县| 云梦县| 富蕴县| 达州市| 三台县| 桐乡市| 萝北县| 祁连县| 越西县| 东乡| 兴化市| 南陵县| 达州市| 明光市| 苍山县| 旅游| 彰化市| 穆棱市| 嘉兴市| 孟连| 池州市| 溧阳市| 长春市| 广汉市| 吉首市| 纳雍县| 寻乌县| 新田县| 山阳县| 白玉县| 武强县| 滦平县| 宽甸| 化德县| 通道| 榆林市| 河源市| 邵东县|