欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

C#仿QQ聊天窗口

 更新時(shí)間:2021年07月11日 10:16:18   作者:Dust_SongYunfei  
這篇文章主要為大家詳細(xì)介紹了C#仿QQ聊天窗口,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了C#實(shí)現(xiàn)QQ聊天窗口的具體代碼,供大家參考,具體內(nèi)容如下

效果圖:

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.Threading;// 用于暫停 的線程
namespace 聊天窗口
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        int x, y;// x為窗體left,y為窗體top
        private void Form1_Load(object sender, EventArgs e)
        {
            this.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width / 2 - this.Width / 2, Screen.PrimaryScreen.WorkingArea.Height / 2 - this.Height / 2);
            x = this.Left;
            y = this.Top;
            this.AcceptButton = button2; //按回車發(fā)送
            textBox1.ReadOnly = true; // 禁止輸入
            textBox1.ScrollBars = ScrollBars.Vertical; //顯示垂直滾動(dòng)條
            textBox1.Font = new Font("", 16);
            textBox2.Font = new Font("", 16); 
        }
        int t = 5, space = 10;// t為暫停時(shí)間,space為移動(dòng)距離

        //抖動(dòng)
        private void button1_Click(object sender, EventArgs e)
        {  // 循環(huán)抖動(dòng)
            for (int i = 0; i <5; i++)
            {  // 改變窗體位置
                this.Location = new Point(x - space, y);
                Thread.Sleep(t);
                this.Location = new Point(x - space, y - space);
                Thread.Sleep(t);
                this.Location = new Point(x, y - space);
                Thread.Sleep(t);
                this.Location = new Point(x + space, y - space);
                Thread.Sleep(t);
                this.Location = new Point(x + space, y);
                Thread.Sleep(t);
                this.Location = new Point(x + space, y + space);
                Thread.Sleep(t);
                this.Location = new Point(x, y + space);
                Thread.Sleep(t);
                this.Location = new Point(x - space, y + space);
                Thread.Sleep(t);
                this.Location = new Point(x - space, y);
                Thread.Sleep(t);
                this.Location = new Point(x, y);
            }
        }
        // 發(fā)送
        private void button2_Click(object sender, EventArgs e)
        { 
            // 記錄超出文本框高度 最新消息顯示
            textBox1.AppendText(DateTime.Now + "\r\n" + textBox2.Text + "\r\n");
            textBox2.Text = " ";// 文本框清空
        }

    }
}

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • python實(shí)現(xiàn)AutoResetEvent類的阻塞模式方法解析

    python實(shí)現(xiàn)AutoResetEvent類的阻塞模式方法解析

    AutoResetEvent :當(dāng)某個(gè)線程執(zhí)行到WaitOne()方法時(shí),該線程則會(huì)處于阻塞模式,當(dāng)被調(diào)用了Set()方法,阻塞的線程則會(huì)繼續(xù)向下執(zhí)行,其狀態(tài)立即被自動(dòng)設(shè)置為阻塞模式
    2012-11-11
  • C#生成單頁(yè)靜態(tài)頁(yè)簡(jiǎn)單實(shí)例

    C#生成單頁(yè)靜態(tài)頁(yè)簡(jiǎn)單實(shí)例

    這篇文章主要介紹了C#生成單頁(yè)靜態(tài)頁(yè)簡(jiǎn)單實(shí)例,是一個(gè)非常實(shí)用的技巧,需要的朋友可以參考下
    2014-10-10
  • C#調(diào)用接口的四種方式介紹

    C#調(diào)用接口的四種方式介紹

    這篇文章介紹了C#調(diào)用接口的四種方式,文中通過(guò)示例代碼介紹的非常詳細(xì)。對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2022-06-06
  • C#?WPF使用GDI實(shí)現(xiàn)截屏功能

    C#?WPF使用GDI實(shí)現(xiàn)截屏功能

    這篇文章主要為大家詳細(xì)介紹了C#?WPF如何使用GDI實(shí)現(xiàn)截屏功能,文中的示例代碼講解詳細(xì),具有一定的借鑒價(jià)值,有需要的小伙伴可以跟隨小編一起學(xué)習(xí)一下
    2024-03-03
  • 測(cè)試stringbuilder運(yùn)行效率示例

    測(cè)試stringbuilder運(yùn)行效率示例

    測(cè)試StringBuilder的運(yùn)行效率,大家參考使用吧
    2013-12-12
  • C# Socket編程實(shí)現(xiàn)簡(jiǎn)單的局域網(wǎng)聊天器的示例代碼

    C# Socket編程實(shí)現(xiàn)簡(jiǎn)單的局域網(wǎng)聊天器的示例代碼

    這篇文章主要介紹了C# Socket編程實(shí)現(xiàn)簡(jiǎn)單的局域網(wǎng)聊天器,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2020-03-03
  • C# 繪制實(shí)時(shí)折線圖,波形圖

    C# 繪制實(shí)時(shí)折線圖,波形圖

    這篇文章主要介紹了C# 繪制實(shí)時(shí)折線圖,波形圖的方法,文中示例代碼非常詳細(xì),幫助大家更好的理解和學(xué)習(xí),感興趣的朋友可以了解下
    2020-07-07
  • C#自定義字符串壓縮和解壓縮的方法

    C#自定義字符串壓縮和解壓縮的方法

    這篇文章主要介紹了C#自定義字符串壓縮和解壓縮的方法,通過(guò)自定義C#字符串操作類實(shí)現(xiàn)對(duì)字符串的壓縮與解壓的功能,具有一定參考借鑒價(jià)值,需要的朋友可以參考下
    2015-04-04
  • C#避免回溯方法心得

    C#避免回溯方法心得

    這篇文章主要介紹了C#避免回溯方法,以實(shí)例的形式講述了回溯方法的弊端及解決處理方法,是非常實(shí)用的技巧,需要的朋友可以參考下
    2014-09-09
  • C#使用Stack類進(jìn)行堆棧設(shè)計(jì)詳解

    C#使用Stack類進(jìn)行堆棧設(shè)計(jì)詳解

    C#中的堆棧由System.Collections.Generic命名空間中的Stack類定義,那么下面就跟隨小編一起學(xué)習(xí)一下C#如何Stack類進(jìn)行堆棧設(shè)計(jì)吧
    2024-03-03

最新評(píng)論