📄 contacttreectrl.cs
字号:
ColumnCollection columns2 = this.ParseStringToColumnCollection(this._moodPhraseTextCol);
if (columns2 != null)
{
buddy.MoodPhraseCols = columns2;
this._moodPhraseCols = columns2;
}
int nHeight = 1;
if (this._contactShowMode == ShowMode.SingleRow)
{
nHeight = 1;
}
else
{
nHeight = 2;
}
this.setItemHeight(base.Handle, buddy, nHeight);
this._modifyColumnRectTopOnly = false;
return 0;
}
private void InvalidateColumnImage(PaintTreeColumn col, int offsetY)
{
Rectangle rc = col.ColumnRec;
rc.Y += offsetY;
if ((col.image != null) && col.image.CanPlay)
{
col.image.NextFrame(100);
base.Invalidate(rc);
}
}
private void InvalidateImage(PaintTreeNode paintNode)
{
if (((paintNode != null) && ((paintNode.Parent != null) && paintNode.Parent.IsExpanded)) && this.RectIntercept(paintNode.Bounds, this._clientRectangle))
{
Rectangle columnRec;
Rectangle bounds = paintNode.Bounds;
if (this._contactShowMode == ShowMode.SingleRow)
{
PaintTreeColumn column = paintNode.Columns[1];
columnRec = column.ColumnRec;
if (this.RectIntercept(columnRec, this._clientRectangle) && column.image.CanPlay)
{
column.image.NextFrame(100);
base.Invalidate(columnRec);
}
column = paintNode.Columns[0];
columnRec = column.ColumnRec;
if (this.RectIntercept(columnRec, this._clientRectangle) && column.image.CanPlay)
{
column.image.NextFrame(100);
base.Invalidate(columnRec);
}
column = paintNode.Columns[9];
columnRec = column.ColumnRec;
if (this.RectIntercept(columnRec, this._clientRectangle) && column.image.CanPlay)
{
column.image.NextFrame(100);
base.Invalidate(columnRec);
}
}
else
{
PaintTreeColumn column2 = paintNode.Columns[0];
columnRec = column2.ColumnRec;
if (this.RectIntercept(columnRec, this._clientRectangle) && column2.image.CanPlay)
{
column2.image.NextFrame(100);
base.Invalidate(columnRec);
}
column2 = paintNode.Columns[1];
columnRec = column2.ColumnRec;
if (this.RectIntercept(columnRec, this._clientRectangle) && column2.image.CanPlay)
{
column2.image.NextFrame(100);
base.Invalidate(columnRec);
}
column2 = paintNode.Columns[2];
columnRec = column2.ColumnRec;
if (this.RectIntercept(columnRec, this._clientRectangle) && column2.image.CanPlay)
{
column2.image.NextFrame(100);
base.Invalidate(columnRec);
}
column2 = paintNode.Columns[9];
columnRec = column2.ColumnRec;
if (this.RectIntercept(columnRec, this._clientRectangle) && column2.image.CanPlay)
{
column2.image.NextFrame(100);
base.Invalidate(columnRec);
}
column2 = paintNode.Columns[5];
columnRec = column2.ColumnRec;
if (this.RectIntercept(columnRec, this._clientRectangle) && column2.image.CanPlay)
{
column2.image.NextFrame(100);
base.Invalidate(columnRec);
}
column2 = paintNode.Columns[7];
columnRec = column2.ColumnRec;
if (this.RectIntercept(columnRec, this._clientRectangle) && column2.image.CanPlay)
{
column2.image.NextFrame(100);
base.Invalidate(columnRec);
}
}
}
}
private void InvalidateImage(PaintTreeNode paintNode, int offsetY)
{
if (paintNode != null)
{
ContactBuddyNode node = paintNode as ContactBuddyNode;
if (node != null)
{
if (this._contactShowMode == ShowMode.SingleRow)
{
this.InvalidateColumnImage(paintNode.Columns[1], offsetY);
this.InvalidateColumnImage(paintNode.Columns[0], offsetY);
this.InvalidateColumnImage(paintNode.Columns[9], offsetY);
}
else
{
for (int i = 0; i < paintNode.Columns.ColumnCount; i++)
{
if (paintNode.Columns[i].ColumnType == PaintTreeColumnType.IMAGE)
{
this.InvalidateColumnImage(paintNode.Columns[i], offsetY);
}
}
}
int columnCount = node.NickNameCols.ColumnCount;
for (int j = 0; j < columnCount; j++)
{
PaintTreeColumn col = node.NickNameCols[j];
if (col.ColumnType == PaintTreeColumnType.IMAGE)
{
this.InvalidateColumnImage(col, offsetY);
}
}
columnCount = node.MoodPhraseCols.ColumnCount;
for (int k = 0; k < columnCount; k++)
{
PaintTreeColumn column2 = node.MoodPhraseCols[k];
if (column2.ColumnType == PaintTreeColumnType.IMAGE)
{
this.InvalidateColumnImage(column2, offsetY);
}
}
}
}
}
private void InvalideNode(TreeNode node)
{
PaintTreeNode node2 = node as PaintTreeNode;
int count = node2.Columns.Count;
this._OffsetY = this._clientRectangle.Y - base.Nodes[0].Bounds.Y;
Rectangle area = new Rectangle(0, 0, 0, 0);
int num = 0;
for (int i = 0; i < node2.Columns.ColumnCount; i++)
{
Rectangle columnRec = node2.Columns[i].ColumnRec;
if (i == (node2.Columns.Count - 1))
{
columnRec.Width++;
}
if (num == 0)
{
area.X = columnRec.Left;
area.Y = node.Bounds.Y;
area.Height = columnRec.Height + 2;
}
num += columnRec.Width;
area.Width = num;
if (node2.Columns[i].bHoverRectangle)
{
Rectangle rc = this.CaculateBorder(area);
rc.Width += 2;
base.Invalidate(rc);
num = 0;
}
}
}
public bool IsPointInPlusMinus(TreeNode node, System.Drawing.Point pt)
{
if (!base.ShowPlusMinus)
{
return false;
}
Rectangle bounds = node.Bounds;
Rectangle plusMinusImagRectangle = this.GetPlusMinusImagRectangle(bounds, bounds.Height);
plusMinusImagRectangle.Height = node.Bounds.Height;
return (((pt.X >= plusMinusImagRectangle.Left) && (pt.X <= plusMinusImagRectangle.Right)) && ((pt.Y >= plusMinusImagRectangle.Top) && (pt.Y <= plusMinusImagRectangle.Bottom)));
}
protected bool NeedReCaculate(ContactBuddyNode buddyNode)
{
if (buddyNode != null)
{
if (this._RePaintFullClient)
{
return true;
}
Rectangle columnRec = this._mobileStatusImgCol.ColumnRec;
if (((this._moodPhraseTextCol.ColumnRec.Right <= columnRec.Left) && (columnRec.Right == this._clientRectangle.Right)) && !buddyNode.NeedCaculate)
{
return false;
}
}
return true;
}
private bool NeedRePaint(ContactBuddyNode buddyNode)
{
Rectangle columnRec = this._mobileStatusImgCol.ColumnRec;
if (((this._moodPhraseTextCol.ColumnRec.Right <= columnRec.Left) && (columnRec.Right == this._clientRectangle.Right)) && !buddyNode.NeedCaculate)
{
return false;
}
return true;
}
protected override void OnMouseClick(MouseEventArgs e)
{
TreeNode nodeAt = base.GetNodeAt(e.get_Location());
if (nodeAt != null)
{
base.SelectedNode = nodeAt as PaintTreeNode;
}
}
protected override void OnMouseWheel(MouseEventArgs e)
{
if (this.OnContactMouseWheel != null)
{
this.OnContactMouseWheel(this, e);
}
}
protected override void OnPaint(PaintEventArgs e)
{
this._clientRectangle = base.ClientRectangle;
Graphics g = e.Graphics;
this.PaintBackGround(g);
if (base.Nodes.Count != 0)
{
Region region = new Region(e.ClipRectangle);
g.Clip = region;
using (SolidBrush brush2 = (this._brush = new SolidBrush(SystemColors.ControlText)))
{
if (this._sf != null)
{
this._sf.Dispose();
}
this._sf = new StringFormat(StringFormatFlags.NoWrap);
this._sf.LineAlignment = StringAlignment.Center;
this._sf.Alignment = StringAlignment.Near;
this._sf.Trimming = StringTrimming.EllipsisCharacter;
this.PaintNode(g, base.ClientRectangle);
}
g.ResetClip();
region.Dispose();
}
}
private void PaintBackGround(Graphics g)
{
TreeDrawHelper.FillRectangle(g, this._clientRectangle, this._bkColor);
if (this._backGroundImg != null)
{
System.Drawing.Point location = new System.Drawing.Point((this._clientRectangle.Width - this._backGroundImg.Width) / 2, (this._clientRectangle.Height - this._backGroundImg.Height) / 2);
Rectangle rect = new Rectangle(location, this._backGroundImg.Size);
TreeDrawHelper.DrawImage(g, rect, this._backGroundImg, false);
}
}
private void paintContactColumn(Graphics g, PaintTreeColumn col)
{
Rectangle columnRec = col.ColumnRec;
if (this.RectIntercept(columnRec, this._clipedRectangle))
{
if (col.ColumnType == PaintTreeColumnType.IMAGE)
{
AmigoImage image = col.image;
if (image != null)
{
if (col.Column == 2)
{
columnRec.Inflate(-2, -2);
}
TreeDrawHelper.DrawImage(g, columnRec, image.CurrentImage, false);
}
}
else
{
this._brush.Color = col.ColumnColor;
TreeDrawHelper.DrawString(g, col.ColumnFont, this._brush, col.ColumnRec, col.ColumnText, this._sf);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -