zoukankan      html  css  js  c++  java
  • C#实现显示器中心画点

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    using System.Runtime.InteropServices;
    
    namespace WindowsFormsApp1
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
            [DllImport("User32.dll")]
            public extern static System.IntPtr GetDC(System.IntPtr hWnd);
            private void Form1_Load(object sender, EventArgs e)
            {
                System.IntPtr DesktopHandle = GetDC(System.IntPtr.Zero);
                Graphics g = Graphics.FromHdc(DesktopHandle);
                Rectangle ScreenArea = System.Windows.Forms.Screen.GetBounds(this);
                for (; ; )
                {                         
                    g.DrawRectangle(new Pen(Color.Red), new Rectangle(ScreenArea.Width/2, ScreenArea.Height/2, 1, 1));
                }
    
            }
        }
    }
  • 相关阅读:
    校验函数
    声明
    主程序(开始检查)
    活代码LINQ——09
    活代码LINQ——08
    活代码LINQ——07
    活代码LINQ——06
    活代码LINQ——05
    活代码LINQ——04
    活代码LINQ——03
  • 原文地址:https://www.cnblogs.com/xinyibufang/p/7477152.html
Copyright © 2011-2022 走看看