当前位置: 首页>>代码示例>>C#>>正文


C# RichTextBox.GetValue方法代码示例

本文整理汇总了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;
//.........这里部分代码省略.........
开发者ID:JimLynn,项目名称:MessageCloud,代码行数:101,代码来源:StatusView.xaml.cs

示例2: GetExcludeMentions

 public static bool GetExcludeMentions(RichTextBox richTextBox)
 {
     if (richTextBox == null)
     throw new ArgumentNullException("richTextBox");
       else
     return (bool) richTextBox.GetValue(IntellisenseExtension.ExcludeMentionsProperty);
 }
开发者ID:unbearab1e,项目名称:FlattyTweet,代码行数:7,代码来源:IntellisenseExtension.cs

示例3: GetIgnorePrefix

 public static bool GetIgnorePrefix(RichTextBox richTextBox)
 {
     if (richTextBox == null)
     throw new ArgumentNullException("richTextBox");
       else
     return (bool) richTextBox.GetValue(IntellisenseExtension.IgnorePrefixProperty);
 }
开发者ID:unbearab1e,项目名称:FlattyTweet,代码行数:7,代码来源:IntellisenseExtension.cs

示例4: GetBindableDocument

 public static FlowDocument GetBindableDocument(RichTextBox obj)
 {
     return (FlowDocument)obj.GetValue(BindableDocumentProperty);
 }
开发者ID:schuster-rainer,项目名称:scripting-shell,代码行数:4,代码来源:BindableRichTextBox.cs

示例5: GetPreventTextInput

 public static bool GetPreventTextInput(RichTextBox obj)
 {
     return (bool) obj.GetValue(PreventTextInputProperty);
 }
开发者ID:ArildF,项目名称:linqtwit,代码行数:4,代码来源:RichTextBoxBehavior.cs

示例6: GetDragsWindow

 public static Window GetDragsWindow(RichTextBox obj)
 {
     return (Window)obj.GetValue(DragsWindowProperty);
 }
开发者ID:ArildF,项目名称:linqtwit,代码行数:4,代码来源:ControlBehaviors.cs


注:本文中的System.Windows.Controls.RichTextBox.GetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。