精华内容
下载资源
问答
  • VB选择结构 习题1.ppt

    2020-10-18 13:29:41
    VB选择结构 习题1 4下面程序段的显示结果是 dim x x=int(rnd)+4 select case x case 5 print"优秀" case 4 print"良好" case 3 print"通过" case else print"不通过" end select A.优秀 B.良好 C.通过 D.不通过 5...
  • VB实现字体的单项选择选择字体应用于Textbox文本框,窗体上设置三个按钮,单击相应的按钮可将文本框中的字体样式修改为选择的字体,点击三个按钮后,分别对应执行下列按钮动作:  Private Sub Option1_Click()  ...
  • 郑州大学VB选择.doc

    2021-10-06 11:01:41
    郑州大学VB选择.doc
  • VB选择结构习题.ppt

    2020-11-04 07:48:56
    选择题 1下面程序段执行结果是 private sub form_click) const pi as single=3.14 a%=7 if a mod 4>pi then print"学习" else print"努力" end if end sub A.努力 B.学习 C.出错 D.无输出 2数学表达式1或10在VB中...
  • vb选择题与答案解析.doc
  • 计算机二级VB选择题大全.pdf
  • 程序VB选择结构程序设计PPT课件.pptx
  • VB选择结构程序设计PPT教案学习.pptx
  • 关于VB选择打印机,并打印

    千次阅读 2015-12-07 21:18:33
    一、 VB选择打印机,与打印机的基本设置 使用PrintDialog Option Explicit Private Const CCHDEVICENAME = 32 Private Const CCHFORMNAME = 32 Private Const GMEM_FIXED = &H0 Private Const GMEM_MOVEABLE = &...

    一、 VB选择打印机,与打印机的基本设置 使用PrintDialog


    Option Explicit
    Private Const CCHDEVICENAME = 32
    Private Const CCHFORMNAME = 32
    Private Const GMEM_FIXED = &H0
    Private Const GMEM_MOVEABLE = &H2
    Private Const GMEM_ZEROINIT = &H40
    Private Const DM_DUPLEX = &H1000&
    Private Const DM_ORIENTATION = &H1&
    '
    ' --- API TYPES DEFINITION
    '
    Private Type PRINTDLG_TYPE
      lStructSize As Long
      hwndOwner As Long
      hDevMode As Long
      hDevNames As Long
      hdc As Long
      Flags As Long
      nFromPage As Integer
      nToPage As Integer
      nMinPage As Integer
      nMaxPage As Integer
      nCopies As Integer
      hInstance As Long
      lCustData As Long
      lpfnPrintHook As Long
      lpfnSetupHook As Long
      lpPrintTemplateName As String
      lpSetupTemplateName As String
      hPrintTemplate As Long
      hSetupTemplate As Long
    End Type
    Private Type DEVNAMES_TYPE
      wDriverOffset As Integer
      wDeviceOffset As Integer
      wOutputOffset As Integer
      wDefault As Integer
      extra As String * 100
    End Type
    Private Type DEVMODE_TYPE
      dmDeviceName As String * CCHDEVICENAME
      dmSpecVersion As Integer
      dmDriverVersion As Integer
      dmSize As Integer
      dmDriverExtra As Integer
      dmFields As Long
      dmOrientation As Integer
      dmPaperSize As Integer
      dmPaperLength As Integer
      dmPaperWidth As Integer
      dmScale As Integer
      dmCopies As Integer
      dmDefaultSource As Integer
      dmPrintQuality As Integer
      dmColor As Integer
      dmDuplex As Integer
      dmYResolution As Integer
      dmTTOption As Integer
      dmCollate As Integer
      dmFormName As String * CCHFORMNAME
      dmUnusedPadding As Integer
      dmBitsPerPel As Integer
      dmPelsWidth As Long
      dmPelsHeight As Long
      dmDisplayFlags As Long
      dmDisplayFrequency As Long
    End Type
    '
    ' --- API DECLARATIONS
    '
    Private Declare Function PrintDialog Lib "comdlg32.dll" Alias "PrintDlgA" _
                             (pPrintdlg As PRINTDLG_TYPE) As Long
    Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
                        (hpvDest As Any, _
                         hpvSource As Any, _
                         ByVal cbCopy As Long)
    Private Declare Function GlobalLock Lib "kernel32" (ByVal hMem As Long) As Long
    Private Declare Function GlobalUnlock Lib "kernel32" _
                             (ByVal hMem As Long) As Long
    Private Declare Function GlobalAlloc Lib "kernel32" _
                             (ByVal wFlags As Long, _
                              ByVal dwBytes As Long) As Long
    Private Declare Function GlobalFree Lib "kernel32" (ByVal hMem As Long) As Long
    '
    ' --- PUBLIC ENUM
    '
    Public Enum PrinterConstants
      cdlPDAllPages = &H0
      cdlPDCollate = &H10
      cdlPDDisablePrintToFile = &H80000
      cdlPDHelpButton = &H800
      cdlPDHidePrintToFile = &H100000
      cdlPDNoPageNums = &H8
      cdlPDNoSelection = &H4
      cdlPDNoWarning = &H80
      cdlPDPageNums = &H2
      cdlPDPrintSetup = &H40
      cdlPDPrintToFile = &H20
      cdlPDReturnDC = &H100
      cdlPDReturnDefault = &H400
      cdlPDReturnIC = &H200
      cdlPDSelection = &H1
      cdlPDUseDevModeCopies = &H40000
    End Enum
    Public Enum ErrorConstants
      cdlCancel = 32755
    End Enum
    '
    ' --- PRIVATE VARIABLES
    '
    Private intMinPage As Integer  ' Local copy of Min
    Private intMaxPage As Integer  ' Local copy of Max
    Private intFromPage As Integer ' Local copy of FromPage
    Private intToPage As Integer   ' Local copy of ToPage
    Private intCopies As Integer   ' Local copy of ToPage
    ' N.B. 0 >= Min >= FromPage >= ToPage >= Max
    '      If Max=0 then no limits.
    '
    ' --- PUBLIC VARIABLES
    '
    Public Flags As PrinterConstants
    Public CancelError As Boolean
    '
    ' -- INITIALIZE
    '
    Private Sub Class_Initialize()
      intMinPage = 0
      intMaxPage = 0
      intFromPage = 0
      intToPage = 0
      intCopies = 1
      CancelError = False
    End Sub
    '
    ' -- PUBLIC MEMBERS
    '
    Property Get Min() As Integer
      Min = intMinPage
    End Property
    Property Let Min(ByVal intNewValue As Integer)
      intNewValue = IIf(intNewValue > 0, intNewValue, 0)
      intMinPage = intNewValue
      If intNewValue > intFromPage Then _
        intFromPage = intNewValue
      If intNewValue > intToPage Then _
        intToPage = intNewValue
      If intNewValue > intMaxPage Then _
        intMaxPage = intNewValue
    End Property
    Property Get FromPage() As Integer
      FromPage = intFromPage
    End Property
    Property Let FromPage(ByVal intNewValue As Integer)
      intNewValue = IIf(intNewValue > 0, intNewValue, 0)
      intFromPage = intNewValue
      If intNewValue > intToPage Then _
        intToPage = intNewValue
      If intNewValue > intMaxPage Then _
        intMaxPage = intNewValue
      If intNewValue < intMinPage Then _
        intMinPage = intNewValue
    End Property
    Property Get ToPage() As Integer
      ToPage = intToPage
    End Property
    Property Let ToPage(ByVal intNewValue As Integer)
      intNewValue = IIf(intNewValue > 0, intNewValue, 0)
      intToPage = intNewValue
      If intNewValue > intMaxPage Then _
        intMaxPage = intNewValue
      If intNewValue < intFromPage Then _
        intFromPage = intNewValue
      If intNewValue < intMinPage Then _
        intMinPage = intNewValue
    End Property
    Property Get Max() As Integer
      Max = intMaxPage
    End Property
    
    
    Property Let Max(ByVal intNewValue As Integer)
      intNewValue = IIf(intNewValue > 0, intNewValue, 0)
      intMaxPage = intNewValue
      If intNewValue < intToPage Then _
        intToPage = intNewValue
      If intNewValue < intFromPage Then _
        intFromPage = intNewValue
      If intNewValue < intMinPage Then _
        intMinPage = intNewValue
    End Property
    
    Property Get Copies() As Integer
      Copies = intCopies
    End Property
    
    
    Property Let Copies(ByVal intNewValue As Integer)
      intNewValue = IIf(intNewValue > 0, intNewValue, 0)
      intCopies = intNewValue
    
    End Property
    
    Public Function ShowPrinter() As Boolean
    Dim PrintDlg As PRINTDLG_TYPE
    Dim DevMode As DEVMODE_TYPE
    Dim DevName As DEVNAMES_TYPE
    Dim lpDevMode As Long, lpDevName As Long
    Dim intReturn As Integer
    Dim objPrinter As Printer
    Dim strNewPrinterName As String
    Dim blnCancel   As Boolean
      blnCancel = False
      ' Use PrintDialog to get the handle to a memory
      ' block with a DevMode and DevName structures
      With PrintDlg
        .lStructSize = Len(PrintDlg)
        .hwndOwner = 0
        .Flags = Flags
        .nMinPage = intMinPage
        .nFromPage = intFromPage
        .nToPage = intToPage
        .nMaxPage = intMaxPage
        Debug.Print "1 = " & intCopies
        .nCopies = intCopies
      End With
      'Set the current orientation and duplex setting
      DevMode.dmDeviceName = Printer.DeviceName
      DevMode.dmSize = Len(DevMode)
      DevMode.dmFields = DM_ORIENTATION Or DM_DUPLEX
      DevMode.dmOrientation = Printer.Orientation
      On Error Resume Next
      DevMode.dmDuplex = Printer.Duplex
      On Error GoTo 0
      'Allocate memory for the initialization hDevMode structure
      'and copy the settings gathered above into this memory
      PrintDlg.hDevMode = GlobalAlloc(GMEM_MOVEABLE Or _
                                      GMEM_ZEROINIT, Len(DevMode))
      lpDevMode = GlobalLock(PrintDlg.hDevMode)
      If lpDevMode > 0 Then
        CopyMemory ByVal lpDevMode, DevMode, Len(DevMode)
        intReturn = GlobalUnlock(lpDevMode)
      End If
      'Set the current driver, device, and port name strings
      With DevName
        .wDriverOffset = 8
        .wDeviceOffset = .wDriverOffset + 1 + Len(Printer.DriverName)
        .wOutputOffset = .wDeviceOffset + 1 + Len(Printer.Port)
        .wDefault = 0
      End With
      With Printer
        DevName.extra = .DriverName & Chr(0) & _
                        .DeviceName & Chr(0) & .Port & Chr(0)
      End With
      'Allocate memory for the initial hDevName structure
      'and copy the settings gathered above into this memory
      PrintDlg.hDevNames = GlobalAlloc(GMEM_MOVEABLE Or _
                                       GMEM_ZEROINIT, Len(DevName))
      lpDevName = GlobalLock(PrintDlg.hDevNames)
      If lpDevName > 0 Then
        CopyMemory ByVal lpDevName, DevName, Len(DevName)
        intReturn = GlobalUnlock(lpDevName)
      End If
      'Call the print dialog up and let the user make changes
      If PrintDialog(PrintDlg) Then
        'First get the DevName structure.
        lpDevName = GlobalLock(PrintDlg.hDevNames)
        CopyMemory DevName, ByVal lpDevName, 45
        intReturn = GlobalUnlock(lpDevName)
        With PrintDlg
          Flags = .Flags
          intFromPage = .nFromPage
          intToPage = .nToPage
          intCopies = .nCopies
        End With
         GlobalFree PrintDlg.hDevNames
        'Next get the DevMode structure and set the printer
        'properties appropriately
        lpDevMode = GlobalLock(PrintDlg.hDevMode)
    
        CopyMemory DevMode, ByVal lpDevMode, Len(DevMode)
        intReturn = GlobalUnlock(PrintDlg.hDevMode)
    
        strNewPrinterName = UCase$(Left(DevMode.dmDeviceName, _
                            InStr(DevMode.dmDeviceName, Chr$(0)) - 1))
        If Printer.DeviceName <> strNewPrinterName Then
          For Each objPrinter In Printers
            If UCase$(objPrinter.DeviceName) = strNewPrinterName Then _
              Set Printer = objPrinter
          Next
        End If
        On Error Resume Next
        'Set printer object properties according to selections made
        'by user
        With Printer
          .Copies = PrintDlg.nCopies
          .Duplex = DevMode.dmDuplex
          .Orientation = DevMode.dmOrientation
        End With
        On Error GoTo 0
        GlobalFree PrintDlg.hDevMode
      Else
        GlobalFree PrintDlg.hDevMode
        GlobalFree PrintDlg.hDevNames
        blnCancel = True
        If CancelError Then _
          Err.Raise cdlCancel, "LM PrintDialog", "Cancel."
      End If
      ShowPrinter = Not blnCancel
    End Function
    
    







    第二、调用PrintDialog,选择打印机,添加打印代码

      

    <pre name="code" class="vb">Private Function Print_Measure_Data()
    
        Dim NewTime As Date
        Dim PrintData(24) As String
        Dim MyPDialog As New clsPrintDialog
        Dim Number_Copies As Integer, i, j
        Dim PrintFromPage As Integer
        Dim PrintToPage As Integer
        Dim Measure_Data_Manage_Counts As Integer
        Measure_Data_Manage_Counts = 3
        
        NewTime = Now
        
        Call PrintDataInit(PrintData, NewTime)
        
        MyPDialog.Flags = cdlPDAllPages + cdlPDDisablePrintToFile + cdlPDNoSelection
        MyPDialog.Min = 1
        MyPDialog.Copies = 1
        MyPDialog.Max = 100
        MyPDialog.FromPage = 1
        MyPDialog.ToPage = Measure_Data_Manage_Counts
        
        
        
        If MyPDialog.ShowPrinter = True Then                          '如果确认打印
            Debug.Print "Printer.DeviceName:" & Printer.DeviceName
            Number_Copies = Printer.Copies
            
            If MyPDialog.FromPage > Measure_Data_Manage_Counts Or MyPDialog.FromPage < 1 Then
                PrintFromPage = 1
            Else
                PrintFromPage = MyPDialog.FromPage
            End If
            Debug.Print "PrintFromPage = " & PrintFromPage
            If MyPDialog.ToPage > Measure_Data_Manage_Counts Or MyPDialog.ToPage < MyPDialog.FromPage Then
                PrintFromPage = Measure_Data_Manage_Counts
            Else
                PrintToPage = MyPDialog.ToPage
            End If
            Debug.Print "PrintToPage = " & PrintToPage
            For i = 1 To Number_Copies
                Debug.Print "开始打印"
                Debug.Print "打印" & Number_Copies & "份"
                j = PrintToPage
                Do
                
                    
                    '在此添加打印代码
                    
    
                    Call PrintTable(Printer, PrintData, j - PrintFromPage + 1, PrintToPage - PrintFromPage + 1) '打印表格,打印机对象、打印数据数组、第j-PrintFromPage+1页、共PrintToPage-PrintFromPage+1 页
    
    
    
                    If j = PrintToPage Then
                        Printer.CurrentX = SignatureCoordinate_X_ForA4_F
                        Printer.CurrentY = SignatureCoordinate_Y_ForA4_F
                        Printer.FontSize = SignatureFontSize
                        Printer.Print "签名:"
                    End If
                    If j > PrintFromPage Then
                        Printer.NewPage
                    End If
                    
                    j = j - 1                       '循环控制变量
    
                Loop Until j = PrintFromPage - 1
                Printer.EndDoc
    
                
            Next
            
    
    
        End If
    
    
        
    
    End Function

     
    

    第三,常用方法,属性

                Printer.CurrentX =           '设置位置
                Printer.CurrentY =
                Printer.FontSize =          ‘设置字体大小
    
                Printer.Print                   ‘打印字符串
    
                Printer.Line (起点X,起点Y)-(终点X, 终点Y)         '画线函数


    展开全文
  • 湖南省非计算机专业二级VB选择题题库.pdf
  • VB选择输入法

    2015-08-11 15:39:11
    VB选择输入法
  • VB选择文件夹

    2014-04-24 11:28:29
    Set spShell = CreateObject("Shell.Application")  ...Set spFolder = spShell.BrowseForFolder(0, "选择目录:", 0, ssfDRIVES)  Set spFolderItem = spFolder.Self  spPath = spFolderItem.Path
    Set spShell = CreateObject("Shell.Application")  
    
    Set spFolder = spShell.BrowseForFolder(0, "选择目录:", 0, ssfDRIVES) 
    Set spFolderItem = spFolder.Self 
    spPath = spFolderItem.Path 
    展开全文
  • vb简单选择结构和嵌套if语句程序设计的实例,这是针对高一学生的基础内容
  • 选择要设置的打印机进行设置,设置选择的打印机为默认打印机,源代码
  • 弹出式文件夹浏览对话框。 一个模块,一个函数就可调用。
  • 福建省二级VB选择

    2013-05-28 13:56:41
    福建省计算机等级考试二级Visual Basic的选择题目汇总,共抽取了考试系统的十套模拟题
  • vb选择题复习vb选择题复习vb选择题复习
  • VB 文件夹浏览选择控件 你看到的文件来自:E动天下(http:/www.2e3.org)
  • VB6做的选择弹窗

    2012-10-27 16:41:40
    vb6 做的用于选择的弹窗,传入adorecordSet即可。
  • 选择题分章复习,绝对是复习或熟悉vb编程的好材料,计算机二级考试的好材料
  • VB 浏览并选择文件夹

    热门讨论 2011-08-24 16:34:32
    像浏览文件一样浏览文件夹,能够选择文件夹。写成了一个函数放在了模块里。函数返回选择文件夹的路径。
  • VB6切换默认打印机

    2017-03-11 08:10:36
    使用VB6切换系统默认打印机,并实现打印监控,包含了使用WINAPI控制其他程序的代码。
  • VB6.0很好很暴力对于那些VB基础不是很好的人确实是一个很好的支援
  • VB_VBA日期选择控件

    热门讨论 2010-09-23 14:55:12
    安装方法, 1. 将控件 MSCOMCT2.OCX 复制至windows\system\ (win98) 或 winnt\system32\ (win2000). ... 也可以直接双击运行Setup.bat...在VB/VBA中添加控件,选择Microsoft Date and Time Picker Control,Version 6.0
  • 上海计算机等级考试二级VB真题及模拟题整理By 易班校园工作站 & 清逸福王 VB基本概念和基础操作 1.在设计阶段中双击窗体上的某个控件打开的窗口是_ A.工程资源管理器窗口 B. 代码窗口 C. 工具箱窗口 D. 布局窗口 2. ...
  • 内容索引:VB源码,界面编程,listview,复选框 VB给listview控件添加自动选择功能,也就是说当我们用鼠标点击列表的某一行而非点击复选框的时候,复选框会自动打勾选中,再次单击鼠标则取消选中,在某些软件系统中,...
  • VB制作类似选择题考试的测试程序,其实是一个测试的小游戏,原版带有声音,另有一个FlavorTest界面漂亮版。这个小游戏可测试你在别人心中的印象,转瞬间便知道自己在别人心中是怎样的一个人了,快点答题吧。测试时,...
  • 帮论坛朋友一个忙: http://bbs.csdn.net/topics/392276725
  • VB选择按钮与组合框实现选课与登录,内有代码说明及思路来源
  • vb调用颜色对话框

    2016-10-29 23:03:58
    vb实现调用系统颜色对话框选择颜色,代码有注解,对于如何调用系统颜色对话框有学习参考作用,也可按思路转换到其他编程语言上。

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 93,056
精华内容 37,222
关键字:

vb选择