---------------sp2中增加一张
图片----------------------
Image myImage3 = new Image();
BitmapImage bi3 = new BitmapImage();
bi3.BeginInit();
bi3.UriSource = new Uri("images/help.jpg", UriKind.Relative);
bi3.EndInit();
myImage3.Stretch = Stretch.Fill;
myImage3.Source = bi3;
sp2.Children.Add(myImage3);
//-----------------------------------------------------------
Label lb2 = new Label();
lb2.FontWeight = FontWeights.Bold;
lb2.Content = "右键菜单显示路由信息";
sp2.Children.Add(lb2);
sp.Children.Add(sp2);
ToolTip ttp = new ToolTip();
ttp.Content = sp;
return (ttp);
}
public SearchWindow()
{
this.InitializeComponent();
//----------------------------动态brush示例---------------------------
//Brush br_en = this.FindResource("Brush_province_enable") as Brush;
//Path pp = this.FindName("point_shandong") as Path;
//pp.Fill = br_en;
//----------------------------动态brush示例完毕---------------------------
//---------------------遍历ping table,改变点的状态--------------------------
Brush br_en = this.FindResource("Brush_province_enable") as Brush;
Brush br_dis = this.FindResource("Brush_province_disable") as Brush;
webscanTableAdapters.PINGTableAdapter da = new webscanTableAdapters.PINGTableAdapter();
webscan.PINGDataTable pt = da.GetData();
string point_name, point_brush, storyboard_name,tooltip_target_name;
Path pp;
FrameworkElement tooltip_target;
Storyboard my_sb;
foreach (DataRow myRow in pt.Rows)
{
point_name = myRow["point_name"].ToString();
point_brush = myRow["point_brush"].ToString();
storyboard_name = myRow["STORYBOARD"].ToString();
tooltip_target_name = myRow["TOOLTIP_TARGET"].ToString();
pp = this.FindName(point_name) as Path;
tooltip_target = (FrameworkElement)this.FindName(tooltip_target_name);
//------------------------------点的颜色-------------------------
try
{
pp.Fill = (Brush)this.FindResource(point_brush);
}
catch { }
//------------------------------storyboard-------------------------
try
{
my_sb = (Storyboard)this.FindResource(storyboard_name);
if (myRow["remark"].ToString() == "关闭")
my_sb.Begin(this);
}
catch { }
//-------------------------tooltip------------------------
try
{
tooltip_target.ToolTip = GetToolTip(myRow["name"].ToString(),myRow["remark"].ToString());
}
catch { }
}
//---------------------遍历ping table,改变点的状态--------------------------
// Insert code required on object creation below this point.
EventManager.RegisterClassHandler(typeof(SearchBox), SearchBox.SearchEvent, new RoutedEventHandler(this.OnSearch));
EventManager.RegisterClassHandler(typeof(SearchWindow), SearchWindow.CloseSearchResult, new RoutedEventHandler(this.OnCloseSearchResult));
this.searchResultModel = (SearchResultModel)((ObjectDataProvider)this.Resources["SearchResultModelDS"]).Data;
}
private ToolTip GetToolTip(string name, string remark)
{
StackPanel sp = new StackPanel();
Label lb = new Label(