zoukankan      html  css  js  c++  java
  • 0717的一个错误写法

     1 using System;
     2 using System.Collections.Generic;
     3 using System.Text;
     4 using System.Runtime.InteropServices;
     5 namespace ConsoleApplication1
     6 {
     7 class Program
     8 {
     9 //Win32 API
    10 [DllImport("User32.dll")]
    11 public static extern int GetSystemMetrics(int nIndex);
    12 static void Main(string[] args)
    13 {
    14 int Width,Height;
    15 double LineWidth, Size;
    16 Width=GetSystemMetrics(0);
    17 Height = GetSystemMetrics(1);
    18 //验证
    19 Console.WriteLine("{0}*{1}", Width, Height);
    20 Console.ReadKey();
    21 LineWidth = (((Width * 24) + 31) & (0x7FFFFFFF - 31)) >> 3; //对齐后每行数据长度
    22 Size = LineWidth * Height;
    23 //验证
    24 Console.WriteLine("{0};{1}", LineWidth, Size);
    25 Console.ReadKey();
    26 GetMem(Bits, Size);//动态分布内存
    27 //截图
    28 Wnd=GetDesktopWindow(); //获取桌面句柄
    29 DC = GetWindowDC(Wnd); //返回hWnd参数所指定的窗口的设备环境
    30 MemDC = CreateCompatibleDC(DC); //该函数创建一个与指定设备兼容的内存设备上下文环境
    31 Bitmap = CreateCompatibleBitmap(DC, Width, Height); //创建与指定的设备环境相关的设备兼容的位图
    32 OldBitmap=SelectObject(MemDC,Bitmap); //选择一对象到指定的设备上下文环境中
    33 BitBlt(MemDC,0,0,Width,Height,DC,0,0,SRCCOPY); //
    34 Bitmap=SelectObject(MemDC,OldBitmap);
    35 }
    36 }
    37 }
    365个夜晚,我希望做到两天更一篇博客。加油,小白!
  • 相关阅读:
    移动端rem屏幕设置
    封装ajax库,post请求
    获取浏览器url参数
    身份证验证
    jq封装插件
    页面分享功能,分享好友、朋友圈判断,用share_type做标记 这里用的是jweixin-1.3.2.js
    @RequestParam和@RequestBody区别
    400报错
    IDEA中用Maven构建SSM项目环境入门
    Eclipse搭建Spring开发环境
  • 原文地址:https://www.cnblogs.com/qq2806933146xiaobai/p/11202759.html
Copyright © 2011-2022 走看看