コード例 #1
0
ファイル: Message.cs プロジェクト: ChenDRAG/QQchy
        public Message(string ChatText, int ChatType, Bitmap Portrait, string ChatName = "2017011518")
        {
            InitializeComponent();
            ChatLabel.Text       = ChatText;
            FriendNameLabel.Text = ChatName;
            MyNameLabel.Text     = Info.UserName;
            this.Height          = ChatLabel.Height + 60;
            if (ChatType == 0)
            {
                ChatLabel.Location = new Point(80, 40);
                ChatLabel.BringToFront();
            }
            else if (ChatType == 1)
            {
                ChatLabel.Location = new Point(this.Width - ChatLabel.Width - 70, 40);
                ChatLabel.BringToFront();
                ChatLabel.BackColor = Color.Aqua;
            }
            Bitmap ShowPortrait = new Bitmap(Portrait);

            if (ChatType == 0)
            {
                this.FriendPortrait.Image = ShowPortrait;
                MyPortrait.Visible        = false;
                MyNameLabel.Visible       = false;
            }
            else if (ChatType == 1)
            {
                this.MyPortrait.Image   = new Bitmap(Info.headP);//TODO
                FriendPortrait.Visible  = false;
                FriendNameLabel.Visible = false;
            }
        }
コード例 #2
0
ファイル: SendBox.cs プロジェクト: karma19350/Mychat
        public int SendType;                                                                           //=1;
        public SendBox(string ChatText, int ChatType, Bitmap Portrait, string ChatName = "2016011435") //添加对话显示
        {
            InitializeComponent();
            string CurrentTime;

            CurrentTime = DateTime.Now.Hour.ToString();
            if (DateTime.Now.Minute < 10)//以两位数显示分钟
            {
                CurrentTime += ":" + "0" + DateTime.Now.Minute.ToString();
            }
            else
            {
                CurrentTime += ":" + DateTime.Now.Minute.ToString();
            }
            TimeLabel.Text       = CurrentTime;
            ChatLabel.Text       = ChatText;
            FriendNameLabel.Text = ChatName;
            MyNameLabel.Text     = BasicInfo.UserName;
            SendType             = ChatType;
            this.Height          = ChatLabel.Height + 65;
            if (ChatType == 0)
            {
                ChatLabel.Location = new Point(80, 40);
                ChatLabel.BringToFront();
            }
            else if (ChatType == 1)
            {
                ChatLabel.Location = new Point(this.Width - ChatLabel.Width - 70, 40);
                ChatLabel.BringToFront();
            }
            Bitmap ShowPortrait = new Bitmap(Portrait);

            if (ChatType == 0)
            {
                this.FriendPortrait.Image = ShowPortrait;
                MyPortrait.Visible        = false;
                MyNameLabel.Visible       = false;
            }
            else if (ChatType == 1)
            {
                this.MyPortrait.Image   = ShowPortrait;
                FriendPortrait.Visible  = false;
                FriendNameLabel.Visible = false;
            }
        }