本文整理汇总了C#中System.Windows.Controls.Label.SetCurrentValue方法的典型用法代码示例。如果您正苦于以下问题:C# Label.SetCurrentValue方法的具体用法?C# Label.SetCurrentValue怎么用?C# Label.SetCurrentValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.Label
的用法示例。
在下文中一共展示了Label.SetCurrentValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AssociatedDocListBoxItem
public AssociatedDocListBoxItem(String labeltext, String imageUri, String _scatteruri, ArtworkModeWindow lb, string description)
{
_helpers = new Helpers();
_description = description;
scatteruri = _scatteruri;
_lb = lb;
opened = false;
dp = new DockPanel();
this.Content = dp;
//if image
if (_helpers.IsImageFile(_scatteruri))
{
image = new Image();
_helpers = new Helpers();
FileStream stream = new FileStream(imageUri, FileMode.Open);
System.Drawing.Image dImage = System.Drawing.Image.FromStream(stream);
System.Windows.Controls.Image wpfImage = _helpers.ConvertDrawingImageToWPFImage(dImage);
stream.Close();
wpfImage.SetCurrentValue(DockPanel.DockProperty, Dock.Left);
wpfImage.SetCurrentValue(HeightProperty, 50.0);
wpfImage.SetCurrentValue(WidthProperty, 50 * wpfImage.Source.Width / wpfImage.Source.Height);
dp.Children.Add(wpfImage);
label = new Label();
label.Content = labeltext;
label.FontSize = 18;
label.SetCurrentValue(DockPanel.DockProperty, Dock.Right);
dp.Children.Add(label);
this.PreviewTouchDown += new EventHandler<TouchEventArgs>(onTouch);
this.PreviewMouseDown += new MouseButtonEventHandler(onTouch);
lb.getAssociatedDocToolBar().Items.Add(this);
}
//equivalent for videos
else if (_helpers.IsVideoFile(_scatteruri))
{
if (_helpers.IsDirShowFile(_scatteruri)) //can easily create nice thumbnails of the video using DirectShow
{
image = new Image();
imageUri = System.IO.Path.GetFullPath(imageUri);
int decrement = System.IO.Path.GetExtension(imageUri).Length;
imageUri = imageUri.Remove(imageUri.Length - decrement, decrement);
imageUri += ".bmp";
FileStream stream = new FileStream(imageUri, FileMode.Open);
System.Drawing.Image dImage = System.Drawing.Image.FromStream(stream);
System.Windows.Controls.Image wpfImage = _helpers.ConvertDrawingImageToWPFImage(dImage);
stream.Close();
wpfImage.SetCurrentValue(DockPanel.DockProperty, Dock.Left);
wpfImage.SetCurrentValue(HeightProperty, 50.0);
wpfImage.SetCurrentValue(WidthProperty, 50 * wpfImage.Source.Width / wpfImage.Source.Height);
dp.Children.Add(wpfImage);
label = new Label();
label.Content = labeltext;
label.FontSize = 18;
label.SetCurrentValue(DockPanel.DockProperty, Dock.Right);
dp.Children.Add(label);
this.PreviewTouchDown += new EventHandler<TouchEventArgs>(onTouch);
this.PreviewMouseDown += new MouseButtonEventHandler(onTouch);
lb.getAssociatedDocToolBar().Items.Add(this);
}
//Code for not actually creating thumbnails of videos, but instead creating paused, unplayable media elements to act as thumbnails
else
{
MediaElement thumVid = new MediaElement();
thumVid.Source = new Uri(scatteruri, UriKind.RelativeOrAbsolute);
thumVid.LoadedBehavior = MediaState.Manual;
thumVid.ScrubbingEnabled = true;
thumVid.Play();
thumVid.Pause();
thumVid.Position = new TimeSpan(0, 0, 0, 0);
thumVid.SetCurrentValue(DockPanel.DockProperty, Dock.Left);
thumVid.SetCurrentValue(HeightProperty, 50.0);
thumVid.SetCurrentValue(WidthProperty, 50 * thumVid.Width / thumVid.Height);
dp.Children.Add(thumVid);
label = new Label();
label.Content = labeltext;
label.FontSize = 18;
label.SetCurrentValue(DockPanel.DockProperty, Dock.Right);
dp.Children.Add(label);
this.PreviewTouchDown += new EventHandler<TouchEventArgs>(onTouch);
this.PreviewMouseDown += new MouseButtonEventHandler(onTouch);
lb.getAssociatedDocToolBar().Items.Add(this);
}
}
}