基本信息
源码名称:透明登录+框架源码
源码大小:56.67M
文件格式:.rar
开发语言:C#
更新时间:2018-11-14
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559

本次赞助数额为: 6 元 
   源码介绍


登陆过程如下:


登陆后如下:


最终变为透明窗体

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.IO;
using System.Media;
using System.Data.SqlClient;
using System.Runtime.InteropServices;

namespace ToolCloud
{
    public partial class Login : Form
    {
        public Login()
        {
            InitializeComponent();
        }
        public class Win32
        {
            public const Int32 AW_HOR_POSITIVE = 0x00000001; // 从左到右打开窗口
            public const Int32 AW_HOR_NEGATIVE = 0x00000002; // 从右到左打开窗口
            public const Int32 AW_VER_POSITIVE = 0x00000004; // 从上到下打开窗口
            public const Int32 AW_VER_NEGATIVE = 0x00000008; // 从下到上打开窗口
            public const Int32 AW_CENTER = 0x00000010; //若使用了AW_HIDE标志,则使窗口向内重叠;若未使用AW_HIDE标志,则使窗口向外扩展。
            public const Int32 AW_HIDE = 0x00010000; //隐藏窗口,缺省则显示窗口。
            public const Int32 AW_ACTIVATE = 0x00020000; //激活窗口。在使用了AW_HIDE标志后不要使用这个标志。
            public const Int32 AW_SLIDE = 0x00040000; //使用滑动类型。缺省则为滚动动画类型。当使用AW_CENTER标志时,这个标志就被忽略。
            public const Int32 AW_BLEND = 0x00080000; //使用淡出效果。只有当hWnd为顶层窗口的时候才可以使用此标志。
            [DllImport("user32.dll", CharSet = CharSet.Auto)]
            public static extern bool AnimateWindow(
          IntPtr hwnd, // handle to window
              int dwTime, // duration of animation
              int dwFlags // animation type
              );
        }

        SoundPlayer sp = new SoundPlayer();//创建播放实体类
        private void Login_Load(object sender, EventArgs e)
        {
            Win32.AnimateWindow(this.Handle, 3000, Win32.AW_CENTER);
            sp.SoundLocation = "../../Music/01.wav";
            sp.PlayLooping();
            this.FormBorderStyle = 0;
            this.BackColor = Color.White;
            this.TransparencyKey = Color.White;

            //this.Opacity = 0.5;
            txtUser.Text = "请输入账号";
            this.txtPassword.Text = "请输入密码";
            txtUser.ForeColor = Color.Gray;
            txtPassword.ForeColor = Color.Gray;
            DoubleBuffered = true;
            //设置跑马灯
            label3.Text = System.Configuration.ConfigurationManager.AppSettings["Name"].ToString();

            this.label3.Enabled = true;

        }

        private void Login_KeyDown(object sender, KeyEventArgs e)
        {
            Application.Exit();
            // 如果按下Esc退出键,则退出到登录界面
            if (e.KeyCode == Keys.Escape)
            {
                this.Visible = true;

            }
        }

        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnLogin_Click(object sender, EventArgs e)
        {
           
            //// sp.PlayLooping();
            ProgressBar pb = new ProgressBar();
            pb.Show();
            this.Hide();

        }

        /// <summary>
        /// 退出
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnCancel_Click(object sender, EventArgs e)
        {
            Win32.AnimateWindow(this.Handle, 2000, Win32.AW_SLIDE | Win32.AW_HIDE | Win32.AW_CENTER);
            this.Close();
        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {
            sp.Stop();
          
        }
      
         //账号事件
        private void txtUser_MouseLeave(object sender, EventArgs e)
        {
            if (this.txtUser.Text == "")
            {
                txtUser.ForeColor = Color.Gray;
                this.txtUser.Text = "请输入账号";

            }

        }
        //跑马灯
        private void timer1_Tick(object sender, EventArgs e)
        {

            label3.Left -= 1;
            if (label3.Left <= label3.Width * -1)
            {
                label3.Left = this.Width;
            }

        }
   
        /// <summary>
        /// 密码
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void txtPassword_MouseLeave(object sender, EventArgs e)
        {
            if (txtPassword.Text == "")
            {
                txtPassword.ForeColor = Color.Gray;
                this.txtPassword.PasswordChar = new char();
                this.txtPassword.Text = "请输入密码";
              

            }
           
        }
        //账号文本框点击事件
        private void txtUser_Click(object sender, EventArgs e)
        {
           if(txtUser.Text=="请输入账号")
            {
                txtUser.Text = "";
                txtUser.ForeColor = Color.Green;
            }
        }

        /// <summary>
        /// 密码点击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void txtPassword_Click(object sender, EventArgs e)
        {
            if(txtPassword.Text=="请输入密码")
            {
                txtUser.ForeColor = Color.Green;
                txtPassword.Text = "";
                this.txtPassword.PasswordChar = '*';
            }
        }
    }
}