📄 contacttreectrl.cs
字号:
}
}
private void paintContactColumn(Graphics g, PaintTreeColumn col, bool bHover)
{
Rectangle columnRec = col.ColumnRec;
if (this.RectIntercept(columnRec, this._clipedRectangle))
{
if (col.ColumnType == PaintTreeColumnType.IMAGE)
{
AmigoImage image = col.image;
if (image != null)
{
TreeDrawHelper.DrawImage(g, columnRec, image.CurrentImage, false);
}
}
else
{
this._brush.Color = col.ColumnColor;
Font columnFont = col.ColumnFont;
if (bHover)
{
FontStyle regular = FontStyle.Regular;
regular = columnFont.Style | FontStyle.Underline;
columnFont = new Font(columnFont.FontFamily, columnFont.Size, regular);
}
TreeDrawHelper.DrawString(g, columnFont, this._brush, col.ColumnRec, col.ColumnText, this._sf);
}
}
}
private void PaintContactColumnImageButton(Graphics g, PaintTreeColumn col, ImageList imageList, int status)
{
Rectangle columnRec = col.ColumnRec;
if ((this.RectIntercept(columnRec, this._clipedRectangle) && (col.ColumnType == PaintTreeColumnType.IMAGE)) && (imageList != null))
{
TreeDrawHelper.DrawImage(g, columnRec, imageList.Images[status], false);
}
}
private void paintDoubleRowContact(Graphics g, PaintTreeNode paintNode, Rectangle boundRect, bool selected)
{
if (selected)
{
Rectangle filler = new Rectangle(0, boundRect.Top + this._nDiagnosedY, this._clientRectangle.Width, boundRect.Height);
TreeDrawHelper.FillRectangle(g, filler, this._selectionColor);
}
System.Drawing.Point pt = new System.Drawing.Point();
Win32.GetCursorPos(ref pt);
pt = base.PointToClient(pt);
this.paintContactColumn(g, this._onLineStatusImgCol);
this.paintContactColumn(g, this._updateBuddyInfoImgCol);
this.paintContactColumn(g, this._buddyImgCol);
Rectangle rect = this._buddyImgCol.ColumnRec;
rect.Inflate(2, 2);
if (rect.Contains(pt))
{
DrawHelper.DrawRect(g, rect, Color.FromArgb(0x48, 0x90, 200));
}
this.paintMixedColumnsInOneRow(g, this._nickNameTextCol, this._nickNameCols);
this.paintMixedColumnsInOneRow(g, this._moodPhraseTextCol, this._moodPhraseCols);
this.paintContactColumn(g, this._mobileStatusImgCol);
this.paintStatusText(g);
if (base.GetNodeAt(pt) == null)
{
this._crbtToBuddyImgCol.ImageListStatus = 0;
}
if (this._crbtToMeTextCol.ColumnText.Length == 0)
{
if (this._crbtToBuddyTextCol.ColumnText.Length != 0)
{
this.PaintContactColumnImageButton(g, this._crbtToBuddyImgCol, this._crbtToBuddyImgCol.ImageList, this._crbtToBuddyImgCol.ImageListStatus);
if (this._crbtToBuddyTextCol.Visible)
{
ColumnTypeEnum enum2 = this.ChangeColumnType((BuddyColumnTypeEnum) this.getActiveColIndex(paintNode.Columns, pt));
this.paintContactColumn(g, this._crbtToBuddyTextCol, enum2 == ColumnTypeEnum.CrbtToBuddyText);
}
}
}
else
{
this.PaintContactColumnImageButton(g, this._crbtToMeImgCol, this._crbtToMeImgCol.ImageList, this._crbtToMeImgCol.ImageListStatus);
if (this._crbtToMeImgCol.Visible)
{
ColumnTypeEnum enum3 = this.ChangeColumnType((BuddyColumnTypeEnum) this.getActiveColIndex(paintNode.Columns, pt));
this.paintContactColumn(g, this._crbtToMeTextCol, enum3 == ColumnTypeEnum.CrbtToMeText);
}
if (this._crbtToBuddyTextCol.ColumnText.Length != 0)
{
this.PaintContactColumnImageButton(g, this._crbtToBuddyImgCol, this._crbtToBuddyImgCol.ImageList, this._crbtToBuddyImgCol.ImageListStatus);
if (this._crbtToBuddyTextCol.Visible)
{
ColumnTypeEnum enum4 = this.ChangeColumnType((BuddyColumnTypeEnum) this.getActiveColIndex(paintNode.Columns, pt));
this.paintContactColumn(g, this._crbtToBuddyTextCol, enum4 == ColumnTypeEnum.CrbtToBuddyText);
}
}
}
}
protected void paintGroupNodeColumns(Graphics g, Rectangle bounds, bool selected)
{
Rectangle rect = this._groupNameCol.ColumnRec;
Rectangle columnRec = this._onLineStatisticCol.ColumnRec;
bounds = new Rectangle(0, bounds.Top, this._clientRectangle.Width, bounds.Height);
if (selected && (this._paintSelected || (this._contactShowMode == ShowMode.DoubleRow)))
{
TreeDrawHelper.FillRectangle(g, bounds, this._selectionColor);
}
this._brush.Color = this._groupNameCol.ColumnColor;
this._sf.Trimming = StringTrimming.EllipsisCharacter;
TreeDrawHelper.DrawString(g, this._groupNameCol.ColumnFont, this._brush, rect, this._groupNameCol.ColumnText, this._sf);
this._brush.Color = this._onLineStatisticCol.ColumnColor;
TreeDrawHelper.DrawString(g, this._onLineStatisticCol.ColumnFont, this._brush, columnRec, this._onLineStatisticCol.ColumnText, this._sf);
}
private void paintMixedColumnsInOneRow(Graphics g, PaintTreeColumn motherCol, ColumnCollection includedColumns)
{
Rectangle columnRec = motherCol.ColumnRec;
int right = columnRec.Right;
if (this.RectIntercept(columnRec, this._clipedRectangle))
{
foreach (PaintTreeColumn column in includedColumns)
{
if (column.ColumnRec.Right > right)
{
if (column.ColumnType == PaintTreeColumnType.IMAGE)
{
break;
}
if (column.ColumnType == PaintTreeColumnType.TEXT)
{
column.ColumnRec.Width = right - column.ColumnRec.Left;
}
}
column.ColumnRec.Height = columnRec.Height;
this.paintContactColumn(g, column);
}
}
}
private void paintMobileStatusCol(Graphics g)
{
Rectangle columnRec = this._mobileStatusImgCol.ColumnRec;
columnRec.Y -= this._OffsetY;
if (this.RectIntercept(columnRec, this._clipedRectangle))
{
AmigoImage image = this._mobileStatusImgCol.image;
if ((image != null) && image.IsValidImage())
{
columnRec.Inflate(-1, -1);
TreeDrawHelper.DrawImage(g, columnRec, image.CurrentImage, false);
}
}
}
protected virtual void paintMoodPhraseCol(Graphics g)
{
Rectangle columnRec = this._moodPhraseTextCol.ColumnRec;
columnRec.Y -= this._OffsetY;
int right = columnRec.Right;
if (this.RectIntercept(columnRec, this._clipedRectangle))
{
Font columnFont = this._moodPhraseTextCol.ColumnFont;
this._brush.Color = this._moodPhraseTextCol.ColumnColor;
if (!this._moodPhraseCols[0].ColumnText.Equals(string.Empty))
{
Rectangle rect = this._moodPhraseCols[0].ColumnRec;
rect.X -= 5;
rect.Width = 10;
TreeDrawHelper.DrawString(g, columnFont, this._brush, rect, "", this._sf);
}
foreach (PaintTreeColumn column in this._moodPhraseCols)
{
if (column.ColumnRec.Right > right)
{
if (column.ColumnType == PaintTreeColumnType.IMAGE)
{
break;
}
if (column.ColumnType == PaintTreeColumnType.TEXT)
{
column.ColumnRec.Width = right - column.ColumnRec.Left;
}
}
Rectangle rectangle3 = column.ColumnRec;
rectangle3.Y -= this._OffsetY;
if (this.RectIntercept(columnRec, this._clipedRectangle))
{
if (column.ColumnType == PaintTreeColumnType.IMAGE)
{
AmigoImage image = column.image;
if (image.IsValidImage())
{
TreeDrawHelper.DrawImage(g, rectangle3, image.CurrentImage, false);
}
continue;
}
TreeDrawHelper.DrawString(g, columnFont, this._brush, rectangle3, column.ColumnText, this._sf);
}
}
}
}
protected virtual void paintNickNameCol(Graphics g)
{
Rectangle columnRec = this._nickNameTextCol.ColumnRec;
columnRec.Y -= this._OffsetY;
int right = columnRec.Right;
if (this.RectIntercept(columnRec, this._clipedRectangle))
{
Font columnFont = this._nickNameTextCol.ColumnFont;
this._brush.Color = this._nickNameTextCol.ColumnColor;
foreach (PaintTreeColumn column in this._nickNameCols)
{
if (column.ColumnRec.Right > right)
{
if (column.ColumnType == PaintTreeColumnType.IMAGE)
{
break;
}
if (column.ColumnType == PaintTreeColumnType.TEXT)
{
column.ColumnRec.Width = right - column.ColumnRec.Left;
}
}
Rectangle rectangle2 = column.ColumnRec;
rectangle2.Y -= this._OffsetY;
if (this.RectIntercept(rectangle2, this._clipedRectangle))
{
if (column.ColumnType == PaintTreeColumnType.IMAGE)
{
AmigoImage image = column.image;
if (image.IsValidImage())
{
TreeDrawHelper.DrawImage(g, rectangle2, image.PreviewImage, false);
}
continue;
}
TreeDrawHelper.DrawString(g, columnFont, this._brush, rectangle2, column.ColumnText, this._sf);
}
}
}
}
private void PaintNode(Graphics g, Rectangle rect)
{
g.PageUnit = GraphicsUnit.Pixel;
this._clipedRectangle = rect;
this._OffsetY = this._clientRectangle.Y - base.Nodes[0].Bounds.Y;
int num1 = this._OffsetY;
bool flag = true;
int top = 0;
if (this._clipedRectangle.Size != this._clientRectangle.Size)
{
int itemHeight = base.ItemHeight;
for (int i = 0; i < this._clipedRectangle.Height; i += itemHeight)
{
TreeNode nodeAt = base.GetNodeAt(0, (i + this._clipedRectangle.Y) + 1);
if (nodeAt == null)
{
nodeAt = base.GetNodeAt(0, (i + this._clipedRectangle.Y) + (itemHeight / 2));
}
if (nodeAt == null)
{
nodeAt = base.GetNodeAt(0, i + this._clipedRectangle.Y);
}
if (nodeAt == null)
{
return;
}
if (top == 0)
{
if (nodeAt.PrevVisibleNode == null)
{
top = 0;
}
else
{
top = nodeAt.PrevVisibleNode.Bounds.Bottom;
}
}
itemHeight = nodeAt.Bounds.Height;
if (itemHeight == 0)
{
itemHeight = base.ItemHeight;
}
if (nodeAt is ContactBuddyNode)
{
if (flag)
{
this.PaintNode(g, nodeAt, top);
}
}
else
{
this.PaintNode(g, nodeAt, top);
}
top += nodeAt.Bounds.Height;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -