当前位置:编程学习 > C#/ASP.NET >>

为什么paragraph设置了ToolTip,但是把鼠标移动到段落上,ToolTip却没有显示?


            Run rr = new Run("mmmmm");
            rr.Background = Brushes.Green;
            rr.Foreground = Brushes.Red;

            Paragraph pp = new Paragraph();
            pp.ToolTip = "aaa";
            pp.Inlines.Add(rr);

            this.richTextBox2.Document.Blocks.Add(pp);


--------------------编程问答--------------------  完整的贴出来 --------------------编程问答-------------------- 前台xaml代码:



<Window x:Class="Test.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow">


    <Grid>
        <RichTextBox name="richTextBox2"></RichTextBox>
    </Grid>

</Window>

后台xaml.cs代码:
[code=C#]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Test
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            Run rr = new Run("mmmmm");
            rr.Background = Brushes.Green;
            rr.Foreground = Brushes.Red;

            Paragraph pp = new Paragraph();
            pp.ToolTip = "aaa";
            pp.Inlines.Add(rr);

            this.richTextBox2.Document.Blocks.Add(pp);
        }
     }






[/code]









引用 1 楼  的回复:
 完整的贴出来
--------------------编程问答--------------------
引用 1 楼  的回复:
 完整的贴出来




前台xaml代码:



<Window x:Class="Test.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow">


    <Grid>
        <RichTextBox name="richTextBox2"></RichTextBox>
    </Grid>

</Window>


后台xaml.cs代码:



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Test
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            Run rr = new Run("mmmmm");
            rr.Background = Brushes.Green;
            rr.Foreground = Brushes.Red;

            Paragraph pp = new Paragraph();
            pp.ToolTip = "aaa";
            pp.Inlines.Add(rr);

            this.richTextBox2.Document.Blocks.Add(pp);
        }
     }








补充:.NET技术 ,  C#
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,