Example #1
0
 protected override void OnMeasureItem(MeasureItemEventArgs e) //设置各项高度
 {
     try
     {
         if (e.Index >= 0)
         {
             base.OnMeasureItem(e);
             SKMsgCore.SKFriend i = Items[e.Index] as SKMsgCore.SKFriend;
             if (i != null)
             {
                 if (i.isCategory)
                 {
                     e.ItemHeight = 30;
                 }
                 else
                 {
                     e.ItemHeight = 60;
                 }
             }
         }
     }
     catch
     {
     }
 }
Example #2
0
        /// <summary>
        /// 刷新(会调用内核刷新)
        /// </summary>
        public void refresh()
        {
            Action refresh_act = () =>
            {
                msg_core.refresh();
                listBox1.Items.Clear();
                SKMsgCore.SKFriend me_title = new SKMsgCore.SKFriend("我自己", "", "");
                me_title.isCategory = true;
                listBox1.Items.Add(me_title);
                listBox1.Items.Add(msg_core.me);
                SKMsgCore.SKFriend my_friend_title = new SKMsgCore.SKFriend("我的好友", "", "");
                my_friend_title.isCategory = true;
                listBox1.Items.Add(my_friend_title);
                foreach (SKMsgCore.SKFriend f in msg_core.friend_list)
                {
                    if (f.stu_num != msg_core.my_stu_num)
                    {
                        listBox1.Items.Add(f);
                    }
                }
            };

            if (this.Visible)
            {
                listBox1.Invoke(refresh_act);
            }
            //msg_core.refresh();
            //listBox1.Items.Clear();
            //foreach (SKMsgCore.SKFriend f in msg_core.friend_list)
            //{
            //    listBox1.Items.Add(f);
            //}
        }
Example #3
0
        private void 发起群聊ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            List <SKMsgCore.SKFriend> _friends_ = new List <SKMsgCore.SKFriend>();

            foreach (object i in listBox1.SelectedItems)
            {
                SKMsgCore.SKFriend fi = (i as SKMsgCore.SKFriend);
                _friends_.Add(fi);
            }
            msg_core.new_g_window(_friends_);
        }
Example #4
0
 public SKMsgWindow(SKMsgCore.SKFriend _friend, SKMsgCore _core)
 {
     InitializeComponent();
     friend      = _friend;
     core        = _core;
     label1.Text = friend.show_name + "(" + friend.stu_num + ")";
     label2.Text = friend.comment;
     if (friend.Img != null)
     {
         pictureBox1.Image = friend.Img;
     }
     this.Visible = true;
     file_init();
 }
Example #5
0
 protected override void OnMouseMove(MouseEventArgs e) //鼠标滑过
 {
     base.OnMouseMove(e);
     for (int i = 0; i < Items.Count; ++i)
     {
         Rectangle rect = this.GetItemRectangle(i);
         if (rect.Contains(e.Location))
         {
             UnderMouseItem = Items[i] as SKMsgCore.SKFriend;
             Invalidate();
             break;
         }
     }
 }
Example #6
0
 protected override void OnPaint(PaintEventArgs e) //重绘
 {
     base.OnPaint(e);
     //e.Graphics.DrawImage(Resources._12321, new Point(0, 0)); //背景
     //e.Graphics.DrawImage(Resources.bk, new Rectangle(0, 0, Width, Height)); //半透明
     for (int i = 0; i < Items.Count; ++i)
     {
         SKMsgCore.SKFriend item = Items[i] as SKMsgCore.SKFriend;
         if (item != null)
         {
             Rectangle bound = GetItemRectangle(i);
             if (item.isCategory)                         //分类
             {
                 if (in_select(item, this.SelectedItems)) //选中项
                 {
                     e.Graphics.FillRectangle(Brushes.Gray, bound);
                     e.Graphics.DrawString(item.stu_num, new Font("微软雅黑", 12), Brushes.White, new PointF(bound.Left + 5, bound.Top + 6));
                 }
                 else if (item == UnderMouseItem) //鼠标滑过
                 {
                     e.Graphics.FillRectangle(Brushes.Ivory, bound);
                     e.Graphics.DrawString(item.stu_num, new Font("微软雅黑", 12), Brushes.Black, new PointF(bound.Left + 5, bound.Top + 6));
                 }
                 else  //正常项
                 {
                     e.Graphics.DrawString(item.stu_num, new Font("微软雅黑", 12), Brushes.Black, new PointF(bound.Left + 5, bound.Top + 6));
                 }
             }
             else  //项
             {
                 if (in_select(item, this.SelectedItems))
                 {
                     e.Graphics.FillRectangle(Brushes.Gray, bound);
                     if (item.Img != null)
                     {
                         e.Graphics.DrawImage(item.Img, new Rectangle(bound.Left + 5, bound.Top + 6, 40, 48));
                     }
                     e.Graphics.DrawString(item.show_name + "(" + item.stu_num + ")", new Font("微软雅黑", 10), Brushes.White, new PointF(bound.Left + 5 + 50, bound.Top + 6));
                     e.Graphics.DrawString("个性签名:“" + item.comment + "”", new Font("微软雅黑", 11), Brushes.White, new PointF(bound.Left + 5 + 50, bound.Top + 20 + 6));
                 }
                 else if (item == UnderMouseItem)
                 {
                     e.Graphics.FillRectangle(Brushes.Ivory, bound);
                     if (item.Img != null)
                     {
                         e.Graphics.DrawImage(item.Img, new Rectangle(bound.Left + 5, bound.Top + 6, 40, 48));
                     }
                     e.Graphics.DrawString(item.show_name + "(" + item.stu_num + ")", new Font("微软雅黑", 10), Brushes.Black, new PointF(bound.Left + 5 + 50, bound.Top + 6));
                     e.Graphics.DrawString("个性签名:“" + item.comment + "”", new Font("微软雅黑", 11), Brushes.Black, new PointF(bound.Left + 5 + 50, bound.Top + 20 + 6));
                 }
                 else
                 {
                     if (item.Img != null)
                     {
                         e.Graphics.DrawImage(item.Img, new Rectangle(bound.Left + 5, bound.Top + 6, 40, 48));
                     }
                     e.Graphics.DrawString(item.show_name + "(" + item.stu_num + ")", new Font("微软雅黑", 10), Brushes.Black, new PointF(bound.Left + 5 + 50, bound.Top + 6));
                     e.Graphics.DrawString("个性签名:“" + item.comment + "”", new Font("微软雅黑", 11), Brushes.Black, new PointF(bound.Left + 5 + 50, bound.Top + 20 + 6));
                 }
             }
         }
     }
 }
Example #7
0
 /// <summary>
 /// 窗口调用的添加好友
 /// </summary>
 /// <param name="id"></param>
 /// <param name="remarks"></param>
 /// <param name="comment"></param>
 /// <param name="img"></param>
 public SKMsgCore.SKFriend add_friend(string id, string remarks, string comment, Bitmap img)
 {
     SKMsgCore.SKFriend f = msg_core.add_friend(id, remarks, comment, img);
     refresh();
     return(f);
 }