久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 4965|回復: 2
打印 上一主題 下一主題
收起左側

繼續上好玩的東西- c#表白程序

[復制鏈接]
跳轉到指定樓層
樓主
ID:481399 發表于 2019-2-28 19:21 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
        開發環境vs2017,使用語言c#,實現功能表白,不上圖了,上圖讓小姐姐們看到就不好了,懂得自己下載干上,讓小姐姐臣服于你的代碼之下

c#源程序如下:
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using System.Runtime.InteropServices;
  11. using Microsoft.Win32;
  12. namespace 表白
  13. {
  14.     public partial class Form1 : Form
  15.     {
  16.         [DllImport("user32.dll", EntryPoint = "SystemParametersInfo")]
  17.         public static extern int SystemParametersInfo(int uAction, int uParam, string lpvParam, int fuWinIni);
  18.         public Form1()
  19.         {
  20.             InitializeComponent();
  21.         }
  22.         #region 屬性
  23.         Form2 form2 = new Form2();
  24.         Form3 form3 = new Form3();
  25.         string name, QQ, imagef = "", musicPath, sex="小姐姐";
  26.         int affect = 0;
  27.         #endregion
  28.         #region 初始化窗口
  29.         private void Form1_Load(object sender, EventArgs e)
  30.         {
  31.             timer1.Interval = 30;
  32.             timer2.Interval = 10;
  33.             timer1.Enabled = true;
  34.             timer2.Enabled = false;
  35.             button1.Visible = false;
  36.             button2.Visible = false;
  37.             panel2.Visible = false;
  38.             panel4.Visible = true;
  39.             label13.Visible = false;
  40.             label15.Visible = false;
  41.             axWindowsMediaPlayer1.Visible = false;
  42.             this.ShowInTaskbar = false;
  43.             radioButton2.Checked = true;
  44.             this.Opacity = 1;
  45.             numericUpDown1.Minimum = DateTime.Now.Hour; numericUpDown1.Value = DateTime.Now.Hour;
  46.             numericUpDown2.Minimum = DateTime.Now.Minute; numericUpDown2.Value = DateTime.Now.Minute;
  47.             numericUpDown3.Minimum = DateTime.Now.Second; numericUpDown3.Value = DateTime.Now.Second;

  48.         }
  49.         #endregion
  50.         #region 單選按鈕處理
  51.         private void radioButton1_CheckedChanged(object sender, EventArgs e)
  52.         {
  53.             if(radioButton1 .Checked)
  54.             {
  55.                 sex = "小哥哥";
  56.                 textBox3.Text = "小哥哥,我喜歡你很久了";         
  57.                 textBox5.Text = "你英俊瀟灑  知書達理";  
  58.                 textBox7.Text = "小哥哥,做我男朋友好不好?";      
  59.                 textBox10.Text = "小哥哥,我會對你好的!";            
  60.             }
  61.         }
  62.         private void radioButton2_CheckedChanged(object sender, EventArgs e)
  63.         {
  64.             if (radioButton2.Checked)
  65.             {
  66.                 sex = "小姐姐";
  67.                  textBox3.Text = "小姐姐,我喜歡你很久了";  
  68.                 textBox5.Text = "你溫柔賢惠  知書達理";   
  69.                 textBox7.Text = "小姐姐,做我女朋友好不好?";
  70.                 textBox10.Text = "小姐姐,我會對你好的!";   
  71.             }
  72.         }
  73.         #endregion  
  74.         #region 自定義標題欄---窗口的移動
  75.         Point mPoint;
  76.         private void panel1_MouseMove(object sender, MouseEventArgs e)
  77.         {
  78.             if (MouseButtons.Left == e.Button)
  79.             {
  80.                 this.Location = new Point(MousePosition.X - mPoint.X, MousePosition.Y - mPoint.Y);
  81.             }
  82.         }
  83.         private void panel1_MouseDown(object sender, MouseEventArgs e)
  84.         {
  85.             if (MouseButtons.Left == e.Button)
  86.             {
  87.                 mPoint = (this.PointToClient(MousePosition));
  88.             }
  89.         }
  90.         #endregion
  91.         #region 單擊二維碼圖片框時
  92.         //單擊圖片框后
  93.         private void pictureBox2_Click(object sender, EventArgs e)
  94.         {
  95.             OpenFileDialog open = new OpenFileDialog();
  96.             open.InitialDirectory = "C:\\";
  97.             open.Filter = "jpg文件(*.jpg)png文件(*.png)bmp文件(*.bmp)GIF文件(*.GIF)|*.jpg;*.png;*.bmp;*.GIF";
  98.             open.ShowDialog();
  99.             imagef = open.FileName;//保存路徑
  100.             if (imagef != "")
  101.             {
  102.                 pictureBox2.BackgroundImage = Image.FromFile(imagef);
  103.                 label13.Visible = true;
  104.             }
  105.             open.Dispose();
  106.         }

  107.         #endregion
  108.         #region 單擊音樂圖片框時
  109.         private void pictureBox4_Click(object sender, EventArgs e)
  110.         {
  111.             OpenFileDialog open = new OpenFileDialog();
  112.             open.InitialDirectory = "C:\\";
  113.             open.Filter = "mp3文件(*.mp3)flac文件(*.flac)wma文件(*.wma)wav文件(*.wav)|*.mp3;*.flac;*.wma;*.wav";
  114.             open.ShowDialog();

  115.             musicPath = open.FileName;//保存路徑
  116.             open.Dispose();
  117.         }

  118.         #endregion
  119.         #region 單擊返回圖片框時
  120.         private void pictureBox5_Click(object sender, EventArgs e)
  121.         {
  122.             panel2.Visible = false;
  123.             panel4.Visible = true;
  124.         }

  125.         #endregion
  126.         #region 單擊設置圖片框時
  127.         private void pictureBox3_Click(object sender, EventArgs e)
  128.         {
  129.             panel4.Visible = false;
  130.             panel2.Visible = true;
  131.         }
  132.         #endregion
  133.         #region 關閉按鈕處理
  134.         private void pictureBox1_Click(object sender, EventArgs e)
  135.         {
  136.             if (affect == 0)
  137.                 this.Close();
  138.             else if (affect == 1) { notifyIcon1.ShowBalloonTip(0, "您好","窗口已隱藏" , ToolTipIcon.Info);this.Hide();  }
  139.             else
  140.             {
  141.                 form2.BackgroundImage = global::表白.Properties.Resources._666;
  142.             }
  143.         }
  144.         int s = 0;
  145.         private void pictureBox1_MouseEnter(object sender, EventArgs e)
  146.         {
  147.             if (affect == 0)
  148.                 pictureBox1.BackgroundImage = global::表白.Properties.Resources._96u58PICdEY;
  149.             if (affect == 3)
  150.             {
  151.                 if (s > 2) s = 0;
  152.                 pictureBox1.BackgroundImage = global::表白.Properties.Resources._96u58PICdEY;
  153.                 switch (s)
  154.                 {
  155.                     case 0:
  156.                         form3.label1.Text = sex+",不要關了我";
  157.                         form3.Show(); break;
  158.                     case 1:
  159.                         form3.label1.Text =sex+ ",你又調皮了";
  160.                         form3.Show(); break;
  161.                     case 2:
  162.                         form3.label1.Text ="---"+sex+",你這樣我會很傷心的----";
  163.                         form3.Show(); break;
  164.                 }
  165.                 s++;
  166.             }
  167.         }
  168.         private void pictureBox1_MouseLeave(object sender, EventArgs e)
  169.         {
  170.             if (affect == 0)
  171.                 pictureBox1.BackgroundImage = global::表白.Properties.Resources._0006019748618084_b ;
  172.             if (affect == 3)
  173.                 pictureBox1.BackgroundImage = global::表白.Properties.Resources._0006019748618084_b;
  174.         }
  175.         #endregion
  176.         #region 使窗口有呼吸效果和自動切換背景圖片
  177.         int a = 0, b = 0; double num = 0; bool ps = true;
  178.         private void timer2_Tick(object sender, EventArgs e)
  179.         {
  180.             if (ps)
  181.             {
  182.                 if (num > 1)
  183.                 {
  184.                     ps = false; if (a > 9) a = 0;
  185.                     switch (a)
  186.                     {
  187.                         case 0: label1.Text = textBox3.Text; this.BackgroundImage = global::表白.Properties.Resources._000; break;
  188.                         case 1: label1.Text = textBox4.Text; this.BackgroundImage = global::表白.Properties.Resources._001; break;
  189.                         case 2: label1.Text = textBox5.Text; this.BackgroundImage = global::表白.Properties.Resources._002; break;
  190.                         case 3: label1.Text = textBox6.Text; this.BackgroundImage = global::表白.Properties.Resources._003; break;
  191.                         case 4: label1.Text = textBox7.Text; this.BackgroundImage = global::表白.Properties.Resources._004; break;
  192.                         case 5: label1.Text = textBox8.Text; this.BackgroundImage = global::表白.Properties.Resources._005; break;
  193.                         case 6: label1.Text = textBox9.Text; this.BackgroundImage = global::表白.Properties.Resources._006; break;
  194.                         case 7: label1.Text = textBox10.Text; this.BackgroundImage = global::表白.Properties.Resources._007; break;
  195.                         case 8: label1.Text = textBox11.Text; this.BackgroundImage = global::表白.Properties.Resources._008; break;
  196.                         case 9: label1.Text = textBox6.Text; this.BackgroundImage = global::表白.Properties.Resources._009; break;
  197.                     }
  198.                     a++;
  199.                     label1.ForeColor = Color.Cyan;
  200.                 }
  201.                 this.Opacity = num;
  202.                 num += 0.01;
  203.             }
  204.             else
  205.             {
  206.                 if (num < 0.4)
  207.                 {
  208.                     ps = true;
  209.                     if (b > 4) b = 0;
  210.                     switch (b)
  211.                     {
  212.                         case 0:
  213.                             if (sex == "小姐姐")
  214.                                 form2.BackgroundImage = global::表白.Properties.Resources._01;
  215.                             else if (sex == "小哥哥")
  216.                                 form2.BackgroundImage = global::表白.Properties.Resources._2018032010363798224; break;
  217.                         case 1: form2.BackgroundImage = global::表白.Properties.Resources._02; break;
  218.                         case 2: form2.BackgroundImage = global::表白.Properties.Resources._03; break;
  219.                         case 3: form2.BackgroundImage = global::表白.Properties.Resources._04; break;
  220.                         case 4: if (sex == "小姐姐") form2.BackgroundImage = global::表白.Properties.Resources._05;
  221.                             else if (sex == "小哥哥")
  222.                                 form2.BackgroundImage = global::表白.Properties.Resources._2018032010363866154;break;                 
  223.                     }
  224.                     b++;
  225.                     label1.ForeColor = Color.White;
  226.                 }
  227.                 this.Opacity = num;
  228.                 num -= 0.01;
  229.             }
  230.         }
  231.         #endregion
  232.         #region 確定鍵
  233.         private void label4_Click(object sender, EventArgs e)
  234.         {
  235.             groupBox1.Visible = false;
  236.             groupBox3.Visible = false;
  237.             pictureBox1.BackgroundImage = global::表白.Properties.Resources.minimize_box_blue;
  238.             name = textBox19.Text;
  239.             QQ = textBox20.Text;
  240.             label10.Location = new Point(120, 85);
  241.             label8.Location = new Point(120, 120);
  242.             If_Start_Time = true;
  243.             first_dowm_time = Convert.ToInt32((numericUpDown1.Value - DateTime.Now.Hour) * 3600 + (numericUpDown2.Value - DateTime.Now.Minute) * 60 + (numericUpDown3.Value - DateTime.Now.Second));
  244.             affect = 1;
  245.         }     
  246.         #endregion
  247.         #region 子窗口2的處理
  248.         int L = 0, v0 = 10, posIf = 0;
  249.         bool lable8_show = true, If_Start_Time = false;
  250.         public int time_dowm = 10, first_dowm_time = 10;

  251.         private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
  252.         {
  253.         }
  254.         private void label13_Click(object sender, EventArgs e)
  255.         {
  256.             imagef = "";
  257.             pictureBox2.BackgroundImage = null;
  258.             label13.Visible = false;
  259.         }
  260.         private void timer1_Tick(object sender, EventArgs e)
  261.         {
  262.             if (lable8_show)
  263.             {
  264.                 if (If_Start_Time)
  265.                 {
  266.                     #region 當倒計時時間到時,初始化
  267.                     if (time_dowm == 0)
  268.                     {
  269.                         lable8_show = false;
  270.                         form2.Show();
  271.                         timer2.Enabled = true;
  272.                         affect = 3;
  273.                         this.Opacity = 0;
  274.                         button1.Text = "好";
  275.                         button2.Text = "不好";
  276.                         button1.Visible = true;
  277.                         button2.Visible = true;
  278.                         label1.Text = textBox3.Text; this.BackgroundImage = global::表白.Properties.Resources._001;
  279.                         pictureBox1.BackgroundImage = global::表白.Properties.Resources._0006019748618084_b;
  280.                         form2.BackgroundImage = global::表白.Properties.Resources._03;
  281.                         if(musicPath !="")
  282.                         axWindowsMediaPlayer1.URL = musicPath;
  283.                         panel4.Visible = false;
  284.                         this.Show();

  285.                     }
  286.                     #endregion
  287.                     time_dowm = Convert.ToInt32((numericUpDown1.Value - DateTime.Now.Hour) * 3600 + (numericUpDown2.Value - DateTime.Now.Minute) * 60 + (numericUpDown3.Value - DateTime.Now.Second));
  288.                     label9.Text = "剩余秒數" + time_dowm;
  289.                 }
  290.                 numericUpDown1.Minimum = DateTime.Now.Hour;

  291.                 numericUpDown2.Minimum = DateTime.Now.Minute;
  292.                 numericUpDown3.Minimum = DateTime.Now.Second;
  293.                 label8.Text = "" + DateTime.Now.Hour + " : " + DateTime.Now.Minute + " : " + DateTime.Now.Second;
  294.             }
  295.             else
  296.             {
  297.                 #region  子窗口2的移動
  298.                 switch (posIf)
  299.                 {
  300.                     case 0:     //判斷子窗口位置是否超過父窗口的最右邊
  301.                         if (form2.Left >= this.Right) { posIf++; L = 0; }
  302.                         else
  303.                         {          //字窗口位置緊貼父窗口并向右移動
  304.                             form2.Left = this.Left + L;
  305.                             form2.Top = this.Top - (form2.Height);
  306.                             L += v0;
  307.                         }
  308.                         break;
  309.                     case 1:     //判斷子窗口位置是否超過父窗口的最下邊
  310.                         if (form2.Top >= this.Bottom) { posIf++; L = 0; }
  311.                         else
  312.                         {//字窗口位置緊貼父窗口并向下移動
  313.                             form2.Left = this.Right;
  314.                             form2.Top = this.Top - form2.Height + L;
  315.                             L += v0;
  316.                         }
  317.                         break;
  318.                     case 2:     //判斷子窗口位置是否超過父窗口的最左邊+子窗口的寬度
  319.                         if (form2.Right <= this.Left) { posIf++; L = 0; }
  320.                         else
  321.                         {//字窗口位置緊貼父窗口并向左移動
  322.                             form2.Left = this.Right - L;
  323.                             form2.Top = this.Bottom;
  324.                             L += v0;
  325.                         }
  326.                         break;
  327.                     case 3:     //判斷子窗口位置是否超過父窗口的最上邊+子窗口的高度
  328.                         if (form2.Bottom <= this.Top) { posIf = 0; L = 0; }
  329.                         else
  330.                         {//字窗口位置緊貼父窗口并向上移動
  331.                             form2.Left = this.Left - form2.Width;
  332.                             form2.Top = this.Bottom - L;
  333.                             L += v0;
  334.                         }
  335.                         break;
  336.                 }
  337.                 #endregion
  338.             }
  339.         }
  340.         #endregion
  341.         #region 按鈕1,按鈕2處理
  342.         int buttonText_Null = 0;
  343.         private void button2_MouseEnter(object sender, EventArgs e)
  344.         {
  345.             if (buttonText_Null < 4)
  346.                 if (button2.Text == "不好")
  347.                 {
  348.                     button1.Text = "不好";
  349.                     button2.Text = "好";
  350.                     buttonText_Null++;
  351.                 }
  352.         }
  353.         private void button1_MouseEnter(object sender, EventArgs e)
  354.         {
  355.             if (buttonText_Null < 4)
  356.                 if (button1.Text == "不好")
  357.                 {
  358.                     button1.Text = "好";
  359.                     button2.Text = "不好";
  360.                     buttonText_Null++;
  361.                 }
  362.         }
  363.         Image image;
  364.         public void button_(string buttonText)      //按鈕事件處理函數
  365.         {
  366.             if (buttonText == "好")
  367.             {
  368.                 image = global::表白.Properties.Resources._0011;
  369.                 image.Save("D:\\AAA.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
  370.                 SystemParametersInfo(20, 0, "D:\\AAA.bmp", 0x2);    //設置桌面壁紙---不保存
  371.                 button1.Visible = false;        //button1隱藏
  372.                 button2.Visible = false;        //button2隱藏
  373.                 timer1.Enabled = false;        //定時器1停止      
  374.                 timer2.Enabled = false;         //定時器2停止
  375.                 this.Opacity = 1;
  376.                 affect = 0;
  377.                 label1.Visible = false;
  378.                 label15.Visible = true;
  379.                 label15.Text = "-----"+sex+",你人真好-----";
  380.                 form2.label1.Text = "我的名字:" + name;
  381.                 form2.label2.Text = "QQ" + QQ;
  382.                 form2.Height = 100;
  383.                 form2.Width = this.Width;
  384.                 form2.Location = new Point(this.Left, this.Top - form2.Height);
  385.                 form2.BackgroundImage = null;
  386.                 if(imagef!="")
  387.                 this.BackgroundImage = Image.FromFile(imagef);        //顯示二維碼            
  388.             }
  389.             else
  390.             {
  391.                 button2.Text = "好";             //修改button2的文本
  392.                 form3.label1.Text = sex+",你是不是選錯了?";
  393.                 form3.Show();

  394.                 image = global::表白.Properties.Resources._666;
  395.                 image.Save("D:\\BBB.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
  396.                 SystemParametersInfo(20, 0, "D:\\BBB.bmp", 0x2);
  397.             }
  398.         }
  399.         private void button1_Click(object sender, EventArgs e)
  400.         {
  401.             button_(button1.Text);
  402.         }
  403.      private void button2_Click(object sender, EventArgs e)
  404.         {
  405.             button_(button2.Text);
  406.         }
  407.         #endregion
  408.     }
  409. }
復制代碼

所有資料51hei提供下載:
表白 c#.rar (3.57 KB, 下載次數: 45)



評分

參與人數 1黑幣 +50 收起 理由
admin + 50 共享資料的黑幣獎勵!

查看全部評分

分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復

使用道具 舉報

沙發
ID:482858 發表于 2019-7-28 14:37 | 只看該作者
樓主把工程文件發一下吧  附件是代碼TXT啊。。。。。
回復

使用道具 舉報

板凳
ID:554793 發表于 2019-8-5 14:45 | 只看該作者
樓主,這怎么操作啊????感覺沒操作空間啊
回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

手機版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網

快速回復 返回頂部 返回列表
主站蜘蛛池模板: 亚洲一区视频在线播放 | 国产一级淫片免费视频 | 欧美美女爱爱 | 黄色免费在线观看 | 日韩视频一区二区 | 91色综合 | 日韩成人免费视频 | 日本成人在线网址 | 久久久成| 午夜丁香视频在线观看 | 日韩成人精品在线观看 | 农村妇女毛片精品久久久 | 午夜小电影 | 在线视频一区二区 | 亚洲伊人久久综合 | 水蜜桃亚洲一二三四在线 | 亚洲欧美中文日韩在线v日本 | 亚洲视频中文 | 99久久精品免费看国产四区 | 成人自拍视频 | 亚洲h色 | 日韩免费视频一区二区 | 日韩欧美国产精品综合嫩v 一区中文字幕 | 九九九视频在线 | 久久久久网站 | 99精品在线观看 | 国产成人在线视频 | 精品1区2区 | 欧美一区二区三区视频在线播放 | 国产毛片久久久 | 亚洲欧洲成人av每日更新 | 户外露出一区二区三区 | 日韩欧美国产精品一区 | 亚洲www啪成人一区二区 | 性一交一乱一透一a级 | 产真a观专区 | 日日碰狠狠躁久久躁婷婷 | 黄色91在线 | 99久久精品免费看国产高清 | 国产亚洲一区二区三区在线观看 | 伊人网综合在线观看 |