2444.html

来自「以电子书的形式收集了VB一些常见问题解决方法,可以很方便的查找自己需要解决的问题」· HTML 代码 · 共 22 行

HTML
22
字号
<html>
  <head>
    <title>不完整的范例</title>
  </head>
  <BODY BACKGROUND="" BGCOLOR="white" TEXT="black" LINK="red" VLINK="#808080" ALINK="">
    <center>
      <h1>不完整的范例</h1>
    </center>

<HR><p>
Posted by <a href="mailto:yfwu@iname.com">小吴</a> on March 30, 1998 at 17:19:58:<p>
In Reply to: <a href="2425.html"><b>如何改变萤幕解析度</b></a> posted by cww on March 27, 1998 at 19:26:56:<p>
你可以参考一下这篇文章。<p>Under the MicrosoftR WindowsR 95 operating system, you can set your screen<br>resolution by running the Display applet in Control Panel. In a Microsoft<br>Visual BasicR version 4.0 application, you can use the Windows application<br>programming interface (API) EnumDisplaySettings and ChangeDisplaySettings<br>functions to change the screen resolution while your program is running.<p>The EnumDisplaySettings function allows you to retrieve information about your<br>display's graphics modes. This information is then stored in a DEVMODE<br>structure.<p>After you have interrogated the computer system with the EnumDisplaySettings<br>function, you use the ChangeDisplaySettings function to tell the operating<br>system to use a different screen resolution.<p>The ChangeDisplaySettings function lets you set the screen resolution to a<br>different graphics mode. The DEVMODE structure holds the graphics mode<br>information to which you want to change.<p>In the example program below, you first retrieve the current screen resolution<br>information by calling the EnumDisplaySettings function. The DEVMODE structure<br>contains the graphics modes information for the display type. Next, you modify<br>the dmPelsWidth and dmPelsHeight fields in the DEVMODE structure to reflect the<br>new screen resolution you want to set. Finally, you call the<br>ChangeDisplaySettings function to tell the operating system to set the new<br>screen resolution as the default resolution.<p>Example Program<p>This program shows how to set the screen resolution from within a Visual Basic<br>application.<p>1. Create a new project in Visual Basic. Form1 is created by default.<p>2. Add the following code to the General Declarations section of Form1 (note<br>that each Declare statement must be typed as a single line of code):<br>Option Explicit<br>Private Declare Function EnumDisplaySettings Lib "user32" Alias<br>  "EnumDisplaySettingsA" (ByVal lpszDeviceName As Long,<br>  ByVal iModeNum As Long, lpDevMode As Any) As Boolean<p>Private Declare Function ChangeDisplaySettings Lib "user32" Alias<br>  "ChangeDisplaySettingsA" (lpDevMode As Any, ByVal dwflags As Long) As Long<p>Const CCDEVICENAME = 32<br>Const CCFORMNAME = 32<br>Const DM_PELSWIDTH = &H80000<br>Const DM_PELSHEIGHT = &H100000<p>Private Type DEVMODE<br>  dmDeviceName As String * CCDEVICENAME<br>  dmSpecVersion As Integer<br>  dmDriverVersion As Integer<br>  dmSize As Integer<br>  dmDriverExtra As Integer<p>  dmFields As Long<br>  dmOrientation As Integer<br>  dmPaperSize As Integer<br>  dmPaperLength As Integer<br>  dmPaperWidth As Integer<br>  dmScale As Integer<br>  dmCopies As Integer<br>  dmDefaultSource As Integer<br>  dmPrintQuality As Integer<br>  dmColor As Integer<br>  dmDuplex As Integer<br>  dmYResolution As Integer<br>  dmTTOption As Integer<br>  dmCollate As Integer<p>  dmFormName As String * CCFORMNAME<br>  dmUnusedPadding As Integer<br>  dmBitsPerPel As Integer<br>  dmPelsWidth As Long<br>  dmPelsHeight As Long<br>  dmDisplayFlags As Long<br>  dmDisplayFrequency As Long<br>End Type<br>Dim DevM As DEVMODE<p>3. Add a Command Button control to Form1. Command1 is created by default.<p>4. Add the following code to the Click event for Command1:<br>Private Sub Command1_Click()<br>  Dim a As Boolean<br>  Dim i&<br>  i = 0<br>  Do<br>    a = EnumDisplaySettings(0&, i&, DevM)<br>    i = i + 1<br>  Loop Until (a = False)<br>End Sub<p>5. Add a second Command Button control to Form1. Command2 is created by<br>default.<p>6. Add the following code to the Click event for Command2:<br>Private Sub Command2_Click()<br>  Dim b&<br>  DevM.dmFields = DM_PELSWIDTH Or DM_PELSHEIGHT<p>  DevM.dmPelsWidth = 800<br>  DevM.dmPelsHeight = 600<p>  b = ChangeDisplaySettings(DevM, 0)<br>End Sub<p>Run the example program by pressing Click the first Command Button control.<br>This retrieves all the graphics modes for your display. Next, click the second<br>Command Button control to change the display's screen resolution to 800 x 600<br>graphics mode.
<br>
<p>
<a name="followups">Follow Ups:</a><br>
<ul><!--insert: 2444-->
</ul><!--end: 2444-->
<br><HR><p>

</body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?