国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

EyesBaby功能實現之Windows前景色調節器

2019-11-17 03:53:18
字體:
來源:轉載
供稿:網友
其實所謂Windows前景色調節器就是利用Winform窗體遮蓋整個Windows區域。主要要求實現窗口透明,且鼠標可以穿過窗體點擊其他程序。

難點就是怎么樣讓鼠標穿透窗體,代碼也是從網上找的,現在找不到原鏈接了:)



原理就是調用Windows API設置窗口的屬性。

代碼:

代碼
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;

/*
* 作者:Billy Qing
* 日期:2009年11月20日
* 說明:EyesBaby Windows 前景窗口。
* 版本:1.0
*/
namespace EyesBaby
{
    public partial class WinScreenAdjust : Form
    {
        /*
         * 下面這段代碼主要用來調用Windows API實現窗體透明(鼠標可以穿透窗體)
         *  也是從網上找的:)
         */
        [DllImport("user32.dll", EntryPoint = "GetWindowLong")]
        public static extern long GetWindowLong(IntPtr hwnd, int nIndex);
        [DllImport("user32.dll", EntryPoint = "SetWindowLong")]
        public static extern long SetWindowLong(IntPtr hwnd, int nIndex, long dwNewLong);
        [DllImport("user32", EntryPoint = "SetLayeredWindowAttributes")]
        PRivate static extern int SetLayeredWindowAttributes(IntPtr Handle, int crKey, byte bAlpha, int dwFlags);
        const int GWL_EXSTYLE = -20;
        const int WS_EX_TRANSPARENT = 0x20;
        const int WS_EX_LAYERED = 0x80000;
        const int LWA_ALPHA = 2;
        public WinScreenAdjust()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            // 取消窗體任務欄
            ShowInTaskbar = false;
            // 窗體位于Windows最頂部
            this.TopMost = true;
            // 去除窗體邊框
            this.FormBorderStyle = FormBorderStyle.None;
            // 設置窗體最大化大小(除底部任務欄部分)
            this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
            // 設置Windows窗口狀態為最大化模式
            this.WindowState = FormWindowState.Maximized;
            // 設置Windows屬性
            SetWindowLong(this.Handle, GWL_EXSTYLE, GetWindowLong(this.Handle, GWL_EXSTYLE) | WS_EX_TRANSPARENT | WS_EX_LAYERED);
            SetLayeredWindowAttributes(this.Handle, 0, 128, LWA_ALPHA);  
        }
    }
}




至于EyesBaby中給窗體設置顏色部分就比較簡單了。

代碼:




            // 打開顏色選擇對話框 ,并分析是否選擇了對話框中的確定按鈕
            if (this.colColorAdjust.ShowDialog() == DialogResult.OK)
            {
                int[] item=colColorAdjust.CustomColors;
                // 將先中的顏色設置為窗體的背景色
                this.winAdjust.BackColor = colColorAdjust.Color;
                // 保存到配置文件
                ConfigHelper.WinForeColor = this.winAdjust.BackColor.Name;
            }






我的第一款實用工具-眼保程序(EyesBaby)

EyesBaby1.0使用幫助文檔


EyesBaby功能實現之窗口拖拽與縮放功能

EyesBaby功能實現之圖片控件上添加字符



下載地址:http://files.VEVb.com/yizhuqing/EyesBabySetup10.zip


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 礼泉县| 福海县| 凌云县| 广饶县| 安仁县| 麦盖提县| 林芝县| 庆阳市| 玛多县| 宁远县| 吉隆县| 德州市| 广元市| 阿城市| 昌吉市| 邵阳县| 阳西县| 育儿| 台南县| 扶绥县| 常山县| 治多县| 仪征市| 黄大仙区| 乐至县| 清流县| 马龙县| 漠河县| 光泽县| 凤山县| 莱西市| 安福县| 雷波县| 武宣县| 麻城市| 濮阳市| 莫力| 靖宇县| 万山特区| 济源市| 石家庄市|