• 黄聪:C# 窗体边框阴影效果


    这只是一个微小的窗体特效,但有时也会有画龙点睛之效。

    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;

    namespace winForm
    {
        public partial class Form1 : Form
        {
            #region 窗体边框阴影效果变量申明

            const int CS_DropSHADOW = 0x20000;
            const int GCL_STYLE = (-26);
            //声明Win32 API
            [DllImport("user32.dll", CharSet = CharSet.Auto)]
            public static extern int SetClassLong(IntPtr hwnd, int nIndex, int dwNewLong);
            [DllImport("user32.dll", CharSet = CharSet.Auto)]
            public static extern int GetClassLong_r(IntPtr hwnd, int nIndex);

            #endregion

            public Form1()
            {
                InitializeComponent();
                SetClassLong(this.Handle, GCL_STYLE, GetClassLong_r(this.Handle, GCL_STYLE) | CS_DropSHADOW); //API函数加载,实现窗体边框阴影效果
            }
        }
    }

  • 相关阅读:
    cookie、 Session Storage 、 Local Storage
    json 常用的方法
    ssm 框架 使用ajax异步,实现登陆
    ssm框架整合,配置文件中的配置内容
    ipv4和ipv6的区别
    分析域名的解析过程
    网络体系结构总结
    线程同步和异步
    博客目录
    [STM32H743]按键控制LED
  • 原文地址:https://www.cnblogs.com/huangcong/p/1697088.html
Copyright © 2020-2023  润新知