/// <summary> 刷新节点内容的尺寸 /// /// </summary> public override void RefreshContentSize() { Title_Label.Font = FolderTitle_Font.ByScaling(CurrentScaling); //按照比例缩放 Title_Label.Padding = FolderTitle_Padding.ByScaling(CurrentScaling); //按照比例缩放 Title_panel.Width = Title_Label.Width; this.Height = Title_Label.Height; File_Panel.Visible = IsFiles; //该文件夹下是否有文件 int widthCount = 0; //文件图标所占的宽度 if (IsFiles) //如果有文件就计算文件图标所占的宽度 { foreach (Control ImgItem in File_Panel.Controls) { ImgItem.Size = new Size(Title_Label.Height, Title_Label.Height); widthCount += ImgItem.Margin.Left; widthCount += ImgItem.Margin.Right; widthCount += ImgItem.Width; } } this.Width = widthCount + Title_panel.Width; }