国产探花免费观看_亚洲丰满少妇自慰呻吟_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
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 思茅市| 遂平县| 阜新市| 衡南县| 福海县| 太白县| 台东县| 云林县| 湄潭县| 拜城县| 江都市| 六盘水市| 景宁| 赞皇县| 宁津县| 贵南县| 和硕县| 方正县| 孟州市| 梧州市| 红河县| 海林市| 嘉定区| 大兴区| 江孜县| 扶风县| 甘肃省| 二手房| 星座| 巴马| 安陆市| 廉江市| 沁阳市| 稷山县| 平潭县| 萝北县| 将乐县| 土默特左旗| 定远县| 永清县| 平昌县|