📄 mainwindow.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Net;
using System.IO;
using System.Net.Sockets;
using System.Windows.Forms;
namespace SQ
{
public partial class MainWindow : Form
{
connect con;
User u=null;
Registers rs;
public User U {
get {return u ;}
set { this.u = value; }
}
public connect Con {
get { return con; }
set { this.con = value; }
}
public MainWindow()
{
InitializeComponent();
}
//加载个人信息
private void Information(User user) {
this.pictureBox1.Image=image.imageListLarge.Images[user.Picture];
this.label1.Text = "ID: " + user.Uid;
this.label2.Text = "昵称: "+user.Title;
}
//加载好友
private void CreateMyListView()
{
listView1.View = View.List;
listView1.GridLines = true ;//显示各个记录的分隔线
listView1.FullRowSelect = true ;//要选择就是一行
listView1.Scrollable = true;//需要时候显示滚动条
listView1.LargeImageList = image.imageListLarge;
listView1.SmallImageList = image.imageListLarge;
foreach(User ui in u.Friend){
listView1.Items.Add(ui.Name, ui.Picture);
}
}
private void MainWindow_Load(object sender, EventArgs e)
{
if (rs==null) {
rs = new Registers(this);
}
rs.ShowDialog();
if(u!=null){
if (u.Uid == 0)
{
MessageBox.Show("登录失败!");
MainWindow_Load(sender, e);
}
else
{
MessageBox.Show(u.Uid + u.Name + " " + u.Friend.Count);
CreateMyListView();
Information(u);
}
}else{
Application.Exit();
}
}
private void pictureBox1_Click(object sender, EventArgs e)
{
Information info = new Information(u);
info.Show();
}
private void button2_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void button1_Click(object sender, EventArgs e)
{
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -