基本信息
源码名称:C# 半透明窗体 示例代码
源码大小:5.51M
文件格式:.zip
开发语言:C#
更新时间:2017-04-11
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

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

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



 

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.Drawing.Drawing2D;
using System.Diagnostics;
using System.IO;


namespace hniu
{
    public partial class 系统登录 : Form
    {
   
        登录背景 xx;
        public 系统登录(登录背景 ss)
        {
            xx = ss;
            InitializeComponent();
            //TopLevel = false;
            //this.Parent = qq;
        }

        private void 登录界面_Load(object sender, EventArgs e)
        {

            GraphicsPath g = new System.Drawing.Drawing2D.GraphicsPath();

            g.AddEllipse(0, 0, 500, 500);
            this.Region = new Region(g);
            this.CenterToParent();
            if (File.Exists(@"c:\pd"))
            {
                StreamReader sw = new StreamReader(@"c:\\pd");
                textBox2.Text = sw.ReadLine();
                textBox1.Text = sw.ReadLine();
                sw.Close();
            }
        }

   
        int x, y,fx,fy;
        bool ye = true;
        private void 登录界面_MouseDown(object sender, MouseEventArgs e)
        {
            x = MousePosition.X;
            y = MousePosition.Y;
            fx = Location.X;
            fy = Location.Y;
            ye = false;
        }

        private void 登录界面_MouseMove(object sender, MouseEventArgs e)
        {
            if(!ye)
            { 
            int nx=fx, ny=fy;
            if (MousePosition.X > x)
            {
                nx = fx   (MousePosition.X - x);
            }
            if (MousePosition.X < x)
            {
                nx = fx -( x - MousePosition.X);
            }
            if (MousePosition.Y > y)
            {
                ny = fy MousePosition.Y - y;
            }
            if (MousePosition.Y < y)
            {
                ny = fy -(y- MousePosition.Y);            
            }
            Location = new Point(nx, ny);

            //x = MousePosition.X;
            //y = MousePosition.Y;
          }
        }

        private void 登录界面_MouseUp(object sender, MouseEventArgs e)
        {
            ye = true; ;
        }

        private void label1_Click_1(object sender, EventArgs e)
        {
            Close();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
           // TopMost = false;
            TopMost = true;
            DateTime ds = DateTime.Now;
            label11.Text = ds.ToString();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            Process[] pProcess;
            pProcess = Process.GetProcesses();
            for (int i = 1; i <= pProcess.Length - 1; i  )
            {
                if (pProcess[i].ProcessName == "hniu")
                {
                    pProcess[i].Kill();
                    break;
                }
            }
            Close();
            xx.Close();
        }

        private void button2_Click(object sender, EventArgs e)
        {
           if(checkBox1.Checked==true)
            {
                StreamWriter sw = new StreamWriter(@"C:\pd");
                sw.WriteLine( textBox2.Text);
                sw.WriteLine(textBox1.Text);
                sw.Close();
            }
           if(sb())
            {
                MessageBox.Show("登录成功");
            }
           else
            {
                MessageBox.Show("登录失败");
            }
            
        }

        private void 登录界面_FormClosing(object sender, FormClosingEventArgs e)
        {
            Process[] pProcess;
            pProcess = Process.GetProcesses();
            for (int i = 1; i <= pProcess.Length - 1; i  )
            {
                if (pProcess[i].ProcessName == "hniu")
                {
                    pProcess[i].Kill();
                    break;
                }
            }
        }
        private bool sb()
        {
            return true;
        }
          
    }
}