📄 contacttreectrl.cs
字号:
this._moodPhraseTextCol.ColumnRec = rect;
rect.X = rect.Right;
rect.Width = 1;
this._statusTextCol.ColumnRec = rect;
AmigoImage image3 = this._mobileStatusImgCol.image;
int width = 0;
int height = 0;
if (image3 == null)
{
width = 0;
height = this._defaultMobileStatusImage.Height;
}
else
{
width = image3.Width;
height = image3.Height;
}
rect.X = this._clientRectangle.Right - width;
rect.Width = width;
rect = this.adjustImageBounds(rect, height);
this._mobileStatusImgCol.ColumnRec = rect;
buddyNode.NeedCaculate = true;
}
else
{
top += this._nDiagnosedY;
if (paintNode.get_Level() == 0)
{
rect.X = bounds.Left - this._groupIndent;
}
else
{
rect.X = bounds.Left - this._doubleRowIdent;
}
rect.Y = top;
rect.Width = this._buddyImgCol.image.Width;
rect.Height = this._buddyImgCol.image.Height;
rect = this.adjustImageBounds(rect, maxHeight);
rect.Inflate(-2, -2);
this._buddyImgCol.ColumnRec = rect;
int right = 0;
rect.X = rect.Right + 1;
rect.Y = (top + (((maxHeight / 2) - this._defaultUpdateInfoImage.Height) / 2)) - 1;
rect.Width = this._onLineStatusImgCol.image.Width;
rect.Height = this._onLineStatusImgCol.image.Height;
rect = this.adjustImageBounds(rect, this._defaultMobileStatusImage.Height);
this._onLineStatusImgCol.ColumnRec = rect;
right = rect.Right;
rect.X = rect.X;
rect.Y = (top + (maxHeight / 2)) + (((maxHeight / 2) - this._defaultUpdateInfoImage.Height) / 2);
if (this._updateBuddyInfoImgCol.image == null)
{
rect.Width = 0;
rect.Height = this._defaultUpdateInfoImage.Height;
}
else if (this._updateBuddyInfoImgCol.image.CurrentImage == null)
{
rect.Width = 0;
rect.Height = this._defaultUpdateInfoImage.Height;
}
else
{
rect.Width = this._updateBuddyInfoImgCol.image.Width;
rect.Height = this._updateBuddyInfoImgCol.image.Height;
}
rect = this.adjustImageBounds(rect, this._defaultUpdateInfoImage.Height);
this._updateBuddyInfoImgCol.ColumnRec = rect;
rect.X = rect.Right;
rect.Y = top;
ef = g.MeasureString(this._nickNameTextCol.ColumnText, this._nickNameTextCol.ColumnFont);
rect.Width = (int) Math.Ceiling((double) ef.Width);
rect.Height = maxHeight / 2;
this._nickNameTextCol.ColumnRec = rect;
rect.X = rect.Right;
rect.Y = top;
ef = g.MeasureString(this._moodPhraseTextCol.ColumnText, this._moodPhraseTextCol.ColumnFont);
rect.Width = (int) Math.Ceiling((double) ef.Width);
rect.Height = bounds.Height / 2;
this._moodPhraseTextCol.ColumnRec = rect;
AmigoImage image1 = this._mobileStatusImgCol.image;
int num6 = 0;
int num7 = 0;
rect.X = this._clientRectangle.Right - num6;
rect.Y = top;
rect.Width = num6;
rect.Height = num7;
rect = this.adjustImageBounds(rect, this._defaultMobileStatusImage.Height);
this._mobileStatusImgCol.ColumnRec = rect;
rect.X = right;
rect.Y = top + (maxHeight / 2);
rect.Width = this._crbtToMeImgCol.image.Width;
rect.Height = this._crbtToMeImgCol.image.Height;
rect = this.adjustImageBounds(rect, this._defaultMobileStatusImage.Height);
this._crbtToMeImgCol.ColumnRec = rect;
rect.X = rect.Right;
rect.Y = top + this._defaultToMeImage.Height;
ef = g.MeasureString(this._crbtToMeTextCol.ColumnText, this._crbtToMeTextCol.ColumnFont);
rect.Width = ((int) Math.Ceiling((double) ef.Width)) + 1;
rect.Height = this._defaultToMeImage.Height;
this._crbtToMeTextCol.ColumnRec = rect;
rect.X = right + ((this._clientRectangle.Right - right) / 2);
rect.Y = top + this._defaultToMeImage.Height;
rect.Width = this._crbtToBuddyImgCol.image.Width;
rect.Height = this._crbtToBuddyImgCol.image.Height;
rect = this.adjustImageBounds(rect, this._defaultToMeImage.Height);
this._crbtToBuddyImgCol.ColumnRec = rect;
rect.X = rect.Right;
rect.Y = top + (maxHeight / 2);
ef = g.MeasureString(this._crbtToBuddyTextCol.ColumnText, this._crbtToBuddyTextCol.ColumnFont);
rect.Width = ((int) Math.Ceiling((double) ef.Width)) + 1;
rect.Height = this._defaultToMeImage.Height;
this._crbtToBuddyTextCol.ColumnRec = rect;
}
}
}
private bool CanPaint(TreeNode node)
{
PaintTreeNode node2 = node as PaintTreeNode;
Rectangle a = node2.Bounds;
if ((a.Width != 0) || (a.Height != 0))
{
if ((node.Parent != null) && !node.Parent.IsExpanded)
{
return false;
}
Rectangle rectangle2 = Rectangle.Intersect(a, this._clipedRectangle);
if ((rectangle2.Width == 0) && (rectangle2.Height == 0))
{
return false;
}
}
return true;
}
internal ColumnTypeEnum ChangeColumnType(BuddyColumnTypeEnum coltype)
{
int num = (int) coltype;
if (num <= 9)
{
return (ColumnTypeEnum) num;
}
return (ColumnTypeEnum) (num + 2);
}
internal ColumnTypeEnum ChangeGroupColumnType(GroupColumnEnum coltype)
{
int num = (int) coltype;
if (num <= 1)
{
return (ColumnTypeEnum) (num + 10);
}
return (ColumnTypeEnum) (num + 10);
}
private void contactModeChange()
{
int nHeight = 1;
if (this._contactShowMode == ShowMode.SingleRow)
{
nHeight = 2;
}
else
{
nHeight = 1;
}
this.SuspendLayout();
base.BeginUpdate();
this.SetContactModeHeight(nHeight);
base.Invalidate();
this.ResumeLayout();
base.EndUpdate();
}
private void DrawPlusMinusImg(Graphics g, Rectangle bounds, bool expanded)
{
int nHeight = this.StreamExpandImg.Height;
Rectangle rect = this.GetPlusMinusImagRectangle(bounds, nHeight);
this.PlusImgRect = rect;
if (expanded)
{
TreeDrawHelper.DrawImage(g, rect, this.StreamExpandImg, false);
this.PlusImg = this.StreamExpandImg;
}
else
{
TreeDrawHelper.DrawImage(g, rect, this.StreamCollapseImg, false);
this.PlusImg = this.StreamCollapseImg;
}
}
internal Rectangle getActiveBuddyColBounds(ColumnCollection cols, ColumnTypeEnum col)
{
int num = (int) col;
if (num > 10)
{
num -= 2;
}
for (int i = 0; i < cols.ColumnCount; i++)
{
if (i == num)
{
return cols[i].ColumnRec;
}
}
return Rectangle.Empty;
}
internal int getActiveColIndex(ColumnCollection cols, System.Drawing.Point pt)
{
int num = -1;
for (int i = 0; i < cols.ColumnCount; i++)
{
if (cols[i].ColumnRec.Contains(pt))
{
num = i;
if (!cols[i].Visible)
{
return -1;
}
return num;
}
}
return num;
}
internal Rectangle getActiveGroupColBounds(ColumnCollection cols, ColumnTypeEnum col)
{
int num = (int) col;
if (num > 1)
{
num -= 11;
}
for (int i = 0; i < cols.ColumnCount; i++)
{
if (i == num)
{
return cols[i].ColumnRec;
}
}
return Rectangle.Empty;
}
protected virtual int GetNickNameLeft(Rectangle rect)
{
return (rect.X - this._indent);
}
protected Rectangle GetPlusMinusImagRectangle(Rectangle bounds, int nHeight)
{
Rectangle rectangle = bounds;
rectangle.Y = rectangle.Top + ((rectangle.Height - nHeight) / 2);
rectangle.X = rectangle.Left - this._groupIndent;
rectangle.Width = 11;
rectangle.Height = 11;
return rectangle;
}
private void InitializeComponent()
{
ComponentResourceManager manager = new ComponentResourceManager(typeof(ContactTreeCtrl));
this.imageList1 = new ImageList(base.components);
this.SuspendLayout();
this.imageList1.ImageStream = (ImageListStreamer) manager.GetObject("imageList1.ImageStream");
this.imageList1.TransparentColor = Color.Fuchsia;
this.imageList1.Images.SetKeyName(0, "collapsed.bmp");
this.imageList1.Images.SetKeyName(1, "expanded.bmp");
this.ResumeLayout(false);
}
public int InsertBuddyGroup(NodeKey positionKey, ContactGroupNode gNode)
{
TreeView view = this;
view.Nodes.Insert(positionKey.IndexOfOwner, gNode);
return 0;
}
public int InsertBuddyNode(ContactGroupNode group, NodeKey positionKey, ContactBuddyNode buddy)
{
TreeNode node = group;
buddy.Text = "BuddyText";
buddy.NeedCaculate = true;
if (node == null)
{
TreeView view = this;
view.Nodes.Insert(positionKey.IndexOfOwner, buddy);
}
else
{
TreeNode node2 = buddy;
node2.Tag = buddy.Tag;
node.Nodes.Insert(positionKey.IndexOfOwner, buddy);
}
this._nickNameTextCol = buddy.Columns[3];
this._moodPhraseTextCol = buddy.Columns[4];
ColumnCollection columns = this.ParseStringToColumnCollection(this._nickNameTextCol);
if (columns != null)
{
buddy.NickNameCols = columns;
this._nickNameCols = columns;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -