Skip to content
This repository has been archived by the owner on Nov 11, 2018. It is now read-only.

Commit

Permalink
更新最新版本
Browse files Browse the repository at this point in the history
  • Loading branch information
七殇骑士 committed Jan 17, 2017
1 parent 31354d8 commit 5bfa6f3
Show file tree
Hide file tree
Showing 395 changed files with 20,594 additions and 830 deletions.
1,252 changes: 1,252 additions & 0 deletions Controls/TabControl.cs

Large diffs are not rendered by default.

691 changes: 691 additions & 0 deletions Controls/UpDownButton.cs

Large diffs are not rendered by default.

375 changes: 296 additions & 79 deletions Controls/WChatBox.Designer.cs

Large diffs are not rendered by default.

637 changes: 574 additions & 63 deletions Controls/WChatBox.cs

Large diffs are not rendered by default.

32 changes: 14 additions & 18 deletions Controls/WChatList.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using YUNkefu.Core.Entity;
Expand All @@ -22,10 +21,10 @@ class WChatList : ListBox
public WChatList()
{
InitializeComponent();
DrawMode = System.Windows.Forms.DrawMode.OwnerDrawVariable;
DrawMode = DrawMode.OwnerDrawVariable;
SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);
UpdateStyles();
BorderStyle = System.Windows.Forms.BorderStyle.None;
BorderStyle = BorderStyle.None;
Cursor = Cursors.Hand;

}
Expand Down Expand Up @@ -57,7 +56,7 @@ protected override void OnPaint(PaintEventArgs e)
e.Graphics.FillRectangle(Brushes.LightGray, bound);
}
e.Graphics.DrawLine(new Pen(Color.FromArgb(50,Color.Black)), new Point(bound.X, bound.Y + 70), new Point(bound.X + Width, bound.Y + 70));
using (Font f = new System.Drawing.Font("微软雅黑", 11))
using (Font f = new Font("微软雅黑", 11))
{
if (user.Icon != null)
{
Expand All @@ -73,18 +72,18 @@ protected override void OnPaint(PaintEventArgs e)
{
string time_str = list_unread[list_unread.Count - 1].Time.ToShortTimeString();
Size time_size = TextRenderer.MeasureText(time_str, f2);
e.Graphics.DrawString(time_str, f2, new SolidBrush(Color.FromArgb(248,248,255)), new PointF(bound.X + Width - time_size.Width - 13, bound.Y + 8)); //最后一条未读消息时间
e.Graphics.DrawString(time_str, f2, new SolidBrush(Color.FromArgb(0, 0, 0)), new PointF(bound.X + Width - time_size.Width - 13, bound.Y + 8)); //最后一条未读消息时间

string latest_msg = list_unread[list_unread.Count - 1].Msg.ToString(); //最后一条未读消息
latest_msg = latest_msg.Length <= 10 ? latest_msg : latest_msg.Substring(0, 10) + "...";
latest_msg = "[" + list_unread.Count + "条] " + latest_msg;
Size latest_msg_size = TextRenderer.MeasureText(latest_msg, f2);
e.Graphics.DrawString(latest_msg, f2, new SolidBrush(Color.FromArgb(248,248,255)), new PointF(bound.X + 70, bound.Y + 40));
e.Graphics.DrawString(latest_msg, f2, new SolidBrush(Color.FromArgb(0, 0, 0)), new PointF(bound.X + 70, bound.Y + 40));
}
using (Font f3 = new Font("微软雅黑", 8)) //未读消息条数 小红圆点
{
e.Graphics.FillEllipse(Brushes.Red, new Rectangle(bound.X + 10 + 50 - 9, bound.Y + 10 - 9, 18, 18));
e.Graphics.DrawString((list_unread.Count < 10 ? list_unread.Count.ToString() : "*"), f3, Brushes.White, new PointF(bound.X + 10 + 50 - 5, bound.Y + 10 - 7));
e.Graphics.DrawString((list_unread.Count < 10 ? list_unread.Count.ToString() : "..."), f3, Brushes.White, new PointF(bound.X + 10 + 50 - 5, bound.Y + 10 - 7));
}
}
else //否则 显示最新的一条消息
Expand All @@ -95,12 +94,12 @@ protected override void OnPaint(PaintEventArgs e)
{
string time_str = latest.Time.ToShortTimeString();
Size time_size = TextRenderer.MeasureText(time_str, f2);
e.Graphics.DrawString(time_str, f2, new SolidBrush(Color.FromArgb(248,248,255)), new PointF(bound.X + Width - time_size.Width - 13, bound.Y + 8)); //最后一条未读消息时间
e.Graphics.DrawString(time_str, f2, new SolidBrush(Color.FromArgb(255,69,0)), new PointF(bound.X + Width - time_size.Width - 13, bound.Y + 8)); //最后一条未读消息时间

string latest_msg = latest.Msg.ToString(); //最新一条消息
latest_msg = latest_msg.Length <= 10 ? latest_msg : latest_msg.Substring(0, 10) + "...";
Size latest_msg_size = TextRenderer.MeasureText(latest_msg, f2);
e.Graphics.DrawString(latest_msg, f2, new SolidBrush(Color.FromArgb(248,248,255)), new PointF(bound.X + 70, bound.Y + 40));
e.Graphics.DrawString(latest_msg, f2, new SolidBrush(Color.FromArgb(0, 0, 0)), new PointF(bound.X + 70, bound.Y + 40));
}
}
}
Expand Down Expand Up @@ -136,10 +135,7 @@ protected override void OnDoubleClick(EventArgs e)
if (SelectedIndex != -1)
{
//开启聊天
if (StartChat != null)
{
StartChat(Items[SelectedIndex] as WXUser);
}
StartChat.Invoke(Items[SelectedIndex] as WXUser);
}
}
/// <summary>
Expand Down Expand Up @@ -173,15 +169,15 @@ protected override void OnMouseLeave(EventArgs e)

private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.timer1 = new System.Windows.Forms.Timer(this.components);
components = new System.ComponentModel.Container();
timer1 = new Timer(components);
this.SuspendLayout();
//
// timer1
//
this.timer1.Enabled = true;
this.timer1.Interval = 200;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
timer1.Enabled = true;
this.timer1.Interval = 2;
this.timer1.Tick += new EventHandler(this.timer1_Tick);
this.ResumeLayout(false);

}
Expand Down
18 changes: 8 additions & 10 deletions Controls/WFriendsList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public WFriendsList()
UpdateStyles();
BorderStyle = System.Windows.Forms.BorderStyle.None;
Cursor = Cursors.Hand;

InitializeComponent();
timer1.Start();

Expand All @@ -53,20 +52,20 @@ protected override void OnPaint(PaintEventArgs e)
}
if (_mouse_over == i)
{
e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(20, 248,248,255)), bound);
e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(5, 248,248,255)), bound);//边框颜色
}
if (SelectedIndex == i)
{
e.Graphics.FillRectangle(Brushes.LightGray, bound);
e.Graphics.FillRectangle(Brushes.Gainsboro, bound);
}
e.Graphics.DrawLine(new Pen(Color.FromArgb(50, Color.Black)), new Point(bound.X, bound.Y + 50), new Point(bound.X + Width, bound.Y + 50));
e.Graphics.DrawLine(new Pen(Color.FromArgb(50, Color.Black)), new Point(bound.X, bound.Y + 70), new Point(bound.X + Width, bound.Y + 70));
using (Font f = new System.Drawing.Font("微软雅黑", 11))
{
if (user.Icon != null)
{
e.Graphics.DrawImage(user.Icon, new Rectangle(bound.X + 8, bound.Y + 8, 34, 34)); //头像
e.Graphics.DrawImage(user.Icon, new Rectangle(bound.X + 8, bound.Y + 8, 50, 50)); //头像
}
e.Graphics.DrawString(user.ShowName, f, Brushes.Black, new PointF(bound.X + 50, bound.Y + 16)); //昵称
e.Graphics.DrawString(user.ShowName, f, Brushes.Black, new PointF(bound.X + 70, bound.Y + 16)); //昵称
}
}
else //分类项
Expand All @@ -79,7 +78,7 @@ protected override void OnPaint(PaintEventArgs e)
using (Font f = new Font("微软雅黑", 15))
{
e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(150, Color.Gray)), bound);
e.Graphics.DrawString(Items[i].ToString(), f, Brushes.Black, new PointF(bound.X + 10, bound.Y + 3));
e.Graphics.DrawString(Items[i].ToString(), f, Brushes.Gainsboro, new PointF(bound.X + 10, bound.Y + 3));
}
}
}
Expand All @@ -95,11 +94,11 @@ protected override void OnMeasureItem(MeasureItemEventArgs e)
{
if (Items[e.Index] as WXUser != null) //好友项
{
e.ItemHeight = 50;
e.ItemHeight = 70;
}
else //分类项
{
e.ItemHeight = 30;
e.ItemHeight = 28;
}
}
}
Expand Down Expand Up @@ -168,7 +167,6 @@ private void InitializeComponent()
// timer1
//
this.timer1.Enabled = true;
this.timer1.Interval = 200;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
this.ResumeLayout(false);

Expand Down
94 changes: 47 additions & 47 deletions Controls/WPersonalInfo.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 1 addition & 8 deletions Controls/WPersonalInfo.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using YUNkefu.Core.Entity;

Expand Down Expand Up @@ -101,10 +97,7 @@ private void btnBack_Click(object sender, EventArgs e)
/// <param name="e"></param>
private void btnSendMsg_Click(object sender, EventArgs e)
{
if (StartChat != null)
{
StartChat(_friendUser);
}
StartChat.Invoke(_friendUser);
}
/// <summary>
/// 刷新头像
Expand Down
14 changes: 7 additions & 7 deletions Controls/WTabControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class WTabControl : TabControl
public WTabControl()
{
SizeMode = TabSizeMode.Fixed;
ItemSize = new System.Drawing.Size(this.Width / 3 - 1, 80);
ItemSize = new System.Drawing.Size(this.Width / 3 - 1, 60);
Alignment = TabAlignment.Top;
//自绘
base.SetStyle(
Expand All @@ -35,16 +35,16 @@ protected override void OnPaint(PaintEventArgs e)
base.OnPaint(e);
if (ItemSize.Width != ClientRectangle.Width / 3 - 1)
{
ItemSize = new Size(ClientRectangle.Width / 3 - 1, 80);
ItemSize = new Size(ClientRectangle.Width / 3 - 1, 60);
}
using (SolidBrush sb = new SolidBrush(Color.FromArgb(0,0,0)))
using (SolidBrush sb = new SolidBrush(Color.FromArgb(245,245,245)))
{
Rectangle all_back = new Rectangle(1, 1, Width - 2, Height - 2); //整个背景区域
e.Graphics.FillRectangle(sb, all_back);

Rectangle back = new Rectangle(1, 1, Width - 3, Height - ItemSize.Height - 2); //客户区
e.Graphics.FillRectangle(Brushes.White, back);
e.Graphics.DrawRectangle(Pens.Gray, back);
e.Graphics.DrawRectangle(Pens.White, back);//矩形边框

using (Font f = new Font("微软雅黑", 12))
{
Expand All @@ -56,16 +56,16 @@ protected override void OnPaint(PaintEventArgs e)

if (this.SelectedTab == tab || TabPages.IndexOf(tab) == _mouse_over)
{
using (SolidBrush bsb = new SolidBrush(Color.FromArgb(0,128,0)))
using (SolidBrush bsb = new SolidBrush(Color.FromArgb(128,128,128)))
{
e.Graphics.FillRectangle(bsb, tab_rect);
}
e.Graphics.DrawString(tab.Text, f, Brushes.White, new PointF(tab_rect.X + (tab_rect.Width - size_tab_text.Width)/2, tab_rect.Y + 20));
e.Graphics.DrawString(tab.Text, f, Brushes.MintCream, new PointF(tab_rect.X + (tab_rect.Width - size_tab_text.Width) / 2, tab_rect.Y + 20));
}
else
{
e.Graphics.FillRectangle(sb, tab_rect);
e.Graphics.DrawString(tab.Text, f, Brushes.White, new PointF(tab_rect.X + (tab_rect.Width - size_tab_text.Width) / 2, tab_rect.Y + 20));
e.Graphics.DrawString(tab.Text, f, Brushes.Black, new PointF(tab_rect.X + (tab_rect.Width - size_tab_text.Width) / 2, tab_rect.Y + 20));
}
}
}
Expand Down
Loading

0 comments on commit 5bfa6f3

Please sign in to comment.