本文整理汇总了C#中System.Windows.Controls.RichTextBox.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# RichTextBox.GetValue方法的具体用法?C# RichTextBox.GetValue怎么用?C# RichTextBox.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.RichTextBox
的用法示例。
在下文中一共展示了RichTextBox.GetValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExpandShrunkLink
private static void ExpandShrunkLink(Hyperlink link, Paragraph parent, RichTextBox rtb)
{
if (link.NavigateUri.AbsoluteUri.StartsWith("http://bit.ly"))
{
WebClient getBitly = new WebClient();
getBitly.DownloadStringCompleted += (sender, e) =>
{
if (e.Error == null)
{
XElement result = XElement.Parse(e.Result);
XElement long_url = GetPath(result, "data/entry/long_url");
if (long_url != null)
{
string url = long_url.Value;
// ToolTipService.SetToolTip(link, url);
InlineUIContainer container = new InlineUIContainer();
Ellipse ellipse = new Ellipse();
ellipse.Width = 6;
ellipse.Height = 6;
ellipse.VerticalAlignment = VerticalAlignment.Center;
ellipse.Margin = new Thickness(3);
ellipse.Fill = new SolidColorBrush(Colors.Orange);
ToolTipService.SetToolTip(ellipse, url);
container.Child = ellipse;
parent.Inlines.Insert(parent.Inlines.IndexOf(link) + 1, container);
//link.Inlines.Add(container);
}
}
};
getBitly.DownloadStringAsync(new Uri("http://api.bit.ly/v3/expand?shortUrl=" + HttpUtility.UrlEncode(link.NavigateUri.AbsoluteUri) + "&login=jimlynn&apiKey=R_769e4a2d579cef3c9c18be33dc4b160c&format=xml", UriKind.Absolute));
}
else if (link.NavigateUri.AbsoluteUri.StartsWith("http://twitpic.com/"))
{
string url = link.NavigateUri.AbsoluteUri + "/full";
WebClient getTwitpic = new WebClient();
getTwitpic.DownloadStringCompleted += (sender, e) =>
{
if (e.Error == null)
{
//Regex getpic = new Regex("(<img(\\ [^=]+=\\\"[^\"]+\\\")*\\ *>)+");
Regex getpic = new Regex(@"(?<=img\s+.*src\=[\x27\x22])(?<Url>[^\x27\x22]*)(?=[\x27\x22])");
Match match = getpic.Match(e.Result);
while (match.Success)
{
//if (match.Value.Contains("/images/logo-main.png") == false)
if (match.Value.StartsWith("http://"))
{
var imgurl = match.Value;
ICommand command = rtb.GetValue(StatusView.CommandProperty) as ICommand;
if (command != null)
{
link.NavigateUri = null;
link.Command = command;
link.CommandParameter = imgurl;
}
break;
}
match = match.NextMatch();
}
}
};
getTwitpic.DownloadStringAsync(new Uri(url, UriKind.Absolute));
}
else if (link.NavigateUri.AbsoluteUri.StartsWith("http://yfrog.com/"))
{
string id = link.NavigateUri.AbsoluteUri.Substring("http://yfrog.com/".Length);
WebClient getYfrog = new WebClient();
getYfrog.DownloadStringCompleted+= (sender,e)=>
{
if (e.Error == null)
{
XElement xml = XElement.Parse(e.Result);
XNamespace ns = "http://ns.imageshack.us/imginfo/7/";
var links = xml.Element(ns + "links"); ;
if (links != null)
{
string url = links.Element(ns + "image_link").Value;
ICommand command = rtb.GetValue(StatusView.CommandProperty) as ICommand;
if (command != null)
{
link.NavigateUri = null;
link.Command = command;
link.CommandParameter = url;
//link.Command = new RelayCommand<string>(Dis
}
//Regex getimg = new Regex("<link rel=\"image_src\" href=\"([^\"]+)\" />");
//Match match = getimg.Match(e.Result);
//string url = match.Groups[1].Value;
InlineUIContainer container = new InlineUIContainer();
Ellipse ellipse = new Ellipse();
ellipse.Width = 16;
ellipse.Height = 16;
//.........这里部分代码省略.........
示例2: GetExcludeMentions
public static bool GetExcludeMentions(RichTextBox richTextBox)
{
if (richTextBox == null)
throw new ArgumentNullException("richTextBox");
else
return (bool) richTextBox.GetValue(IntellisenseExtension.ExcludeMentionsProperty);
}
示例3: GetIgnorePrefix
public static bool GetIgnorePrefix(RichTextBox richTextBox)
{
if (richTextBox == null)
throw new ArgumentNullException("richTextBox");
else
return (bool) richTextBox.GetValue(IntellisenseExtension.IgnorePrefixProperty);
}
示例4: GetBindableDocument
public static FlowDocument GetBindableDocument(RichTextBox obj)
{
return (FlowDocument)obj.GetValue(BindableDocumentProperty);
}
示例5: GetPreventTextInput
public static bool GetPreventTextInput(RichTextBox obj)
{
return (bool) obj.GetValue(PreventTextInputProperty);
}
示例6: GetDragsWindow
public static Window GetDragsWindow(RichTextBox obj)
{
return (Window)obj.GetValue(DragsWindowProperty);
}