Подсмотрел у кого-то и поразвивал примочку для вывода панельки «About…» в панели настройки веб-части.
Сам класс панели :
public class About: Microsoft.SharePoint.WebPartPages .ToolPart
{
public About()
{
this . Title = "O веб -части..." ;
}
string bCard="© DkmS, 2005..06 ";
/// <summary>
/// Parent Webpart
/// </summary>
public WebPart ParentWP{
get{return parent;}
set {parent= value;}
}
protected override void OnInit(EventArgs e) {
base .OnInit (e);
}
public override void ApplyChanges(){}
public override void SyncChanges(){}
public override void CancelChanges(){}
protected override void RenderToolPart(HtmlTextWriter output){
output .Write("<center>" );
output.Write( "<div title='"+bCard +"'>");
output.Write("<br><b>My cool WebPart.</b><br><br>" );
output.Write("</div>");
output . Write("</center>");
output.Write("<br><br><hr>" );
}
}
public class About: Microsoft.SharePoint.WebPartPages .ToolPart
{
public About()
{
this . Title = "O веб -части..." ;
}
string bCard="© DkmS, 2005..06 ";
/// <summary>
/// Parent Webpart
/// </summary>
public WebPart ParentWP{
get{return parent;}
set {parent= value;}
}
protected override void OnInit(EventArgs e) {
base .OnInit (e);
}
public override void ApplyChanges(){}
public override void SyncChanges(){}
public override void CancelChanges(){}
protected override void RenderToolPart(HtmlTextWriter output){
output .Write("<center>" );
output.Write( "<div title='"+bCard +"'>");
output.Write("<br><b>My cool WebPart.</b><br><br>" );
output.Write("</div>");
output . Write("</center>");
output.Write("<br><br><hr>" );
}
}
Использование:
В вызывающем классе изменяем метод
public override ToolPart[] GetToolParts() {
ToolPart[] baseTP = base .GetToolParts ();
ToolPart[] myTP =new ToolPart[3];
WebPartToolPart std=baseTP[ 0] as WebPartToolPart;
CustomPropertyToolPart myprops=baseTP[1] as CustomPropertyToolPart;
myTP[0]=myprops;
myTP[2]=std;
About about=new About();
about.ParentWP= this;
myTP[1]=about;
return myTP;
}
Комментариев нет:
Отправить комментарий