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


C# Documents.Run类代码示例

本文整理汇总了C#中Windows.UI.Xaml.Documents.Run的典型用法代码示例。如果您正苦于以下问题:C# Run类的具体用法?C# Run怎么用?C# Run使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Run类属于Windows.UI.Xaml.Documents命名空间,在下文中一共展示了Run类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Scenario4

        public Scenario4()
        {
            this.InitializeComponent();
            //read language related resource file .strings/en or zh-cn/resources.resw
            Run run1 = new Run();
            run1.Text = ResourceManagerHelper.ReadValue("Description4_p1");
            Run run2 = new Run();
            run2.Text = ResourceManagerHelper.ReadValue("Description4_p2");
            this.textDes.Inlines.Add(run1);
            this.textDes.Inlines.Add(new LineBreak());
            this.textDes.Inlines.Add(run2);
            this.txtBoxAddress.PlaceholderText = ResourceManagerHelper.ReadValue("IP");

            penSize = minPenSize + penSizeIncrement * selectThickness;
            // Initialize drawing attributes. These are used in inking mode.
            InkDrawingAttributes drawingAttributes = new InkDrawingAttributes();
            drawingAttributes.Color = Windows.UI.Colors.Red;
            drawingAttributes.Size = new Size(penSize, penSize);
            drawingAttributes.IgnorePressure = false;
            drawingAttributes.FitToCurve = true;

            inkCanvas.InkPresenter.UpdateDefaultDrawingAttributes(drawingAttributes);
            inkCanvas.InkPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.Mouse | Windows.UI.Core.CoreInputDeviceTypes.Pen | Windows.UI.Core.CoreInputDeviceTypes.Touch;
            inkCanvas.InkPresenter.StrokesCollected += InkPresenter_StrokesCollected;
            inkCanvas.InkPresenter.StrokesErased += InkPresenter_StrokesErased;
            this.SizeChanged += Scenario4_SizeChanged;
            this.radioBtnClient.Checked += radioBtnClient_Checked;
            this.radioBtnServer.Checked += radioBtnServer_Checked;
        }
开发者ID:XPOWERLM,项目名称:More-Personal-Computing,代码行数:29,代码来源:Scenario4.xaml.cs

示例2: Scenario3

        public Scenario3()
        {
            this.InitializeComponent();
            //read language related resource file .strings/en or zh-cn/resources.resw
            Run run1 = new Run();
            run1.Text = ResourceManagerHelper.ReadValue("Description3_p1");
            Run run2 = new Run();
            run2.Text = ResourceManagerHelper.ReadValue("Description3_p2");
            this.textDes.Inlines.Add(run1);
            this.textDes.Inlines.Add(new LineBreak());
            this.textDes.Inlines.Add(run2);

            // Initialize the InkCanvas
            inkCanvas.InkPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.Mouse | Windows.UI.Core.CoreInputDeviceTypes.Pen | Windows.UI.Core.CoreInputDeviceTypes.Touch;

            // By default, pen barrel button or right mouse button is processed for inking
            // Set the configuration to instead allow processing these input on the UI thread
            inkCanvas.InkPresenter.InputProcessingConfiguration.RightDragAction = InkInputRightDragAction.LeaveUnprocessed;

            inkCanvas.InkPresenter.InputProcessingConfiguration.Mode = InkInputProcessingMode.Inking;

            inkCanvas.InkPresenter.UnprocessedInput.PointerPressed += UnprocessedInput_PointerPressed;
            inkCanvas.InkPresenter.UnprocessedInput.PointerMoved += UnprocessedInput_PointerMoved;
            inkCanvas.InkPresenter.UnprocessedInput.PointerReleased += UnprocessedInput_PointerReleased;

            // Handlers to clear the selection when inking or erasing is detected
            inkCanvas.InkPresenter.StrokeInput.StrokeStarted += StrokeInput_StrokeStarted;
            inkCanvas.InkPresenter.StrokesErased += InkPresenter_StrokesErased;

            SizeChanged += Scenario3_SizeChanged;
        }
开发者ID:XPOWERLM,项目名称:More-Personal-Computing,代码行数:31,代码来源:Scenario3.xaml.cs

示例3: OnNavigatedTo

        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.
        /// This parameter is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            // TODO: Prepare page for display here.

            // TODO: If your application contains multiple pages, ensure that you are
            // handling the hardware Back button by registering for the
            // Windows.Phone.UI.Input.HardwareButtons.BackPressed event.
            // If you are using the NavigationHelper provided by some templates,
            // this event is handled for you.

            string article = "If a device fails to provide a certain format, you " +
            "can supplement the functionality by making it available. Your app can" +
            " use the file-conversion APIs (see the BitmapEncoder and BitmapDecoder" +
            " classes in the Windows.Grapics.Imaging namespace) to convert the scanner’s " +
            "native file type to the desired file type. You can even add text " +
            "recognition features so that your users can scan papers into reconstructed " +
            "documents with formatted, selectable text. You can provide filters or other " +
            "enhancements so that scanned images can be adjusted by a user. Ultimately, you " +
            "should not feel limited by what your users’ devices can or cannot do.";

            string[] words = article.Split(' ');

            foreach (string word in words)
            {
                Run run = new Run();
                run.Text = word + " ";
                myTextBlock.Inlines.Add(run);
            }
        }
开发者ID:KaranKamath,项目名称:QuickRead,代码行数:34,代码来源:MainPage.xaml.cs

示例4: DisplayMessage

        private void DisplayMessage()
        {
            ChatMessage msg = null;
            while ((msg = DequeueChatMessage()) != null)
            {
                // create the paragraph
                Paragraph p = new Paragraph();
                Run rnMyText = new Run();
                p.FontWeight = FontWeights.Bold;

                // if the message is from the currently logged in user, then set the color to gray
                if (msg.From == _username)
                {
                    p.Foreground = new SolidColorBrush(Colors.Gray);
                    rnMyText.Text = string.Format("{0} (me): {1}", msg.From, msg.MessageText);
                }
                else
                {
                    p.Foreground = new SolidColorBrush(Colors.Green);
                    rnMyText.Text = string.Format("{0}: {1}", msg.From, msg.MessageText);
                }

                // add the text to the paragraph tag
                p.Inlines.Add(rnMyText);

                // add the paragraph to the rich text box
                rtbChatLog.Blocks.Add(p);
            }
        }
开发者ID:jixer,项目名称:wcf-windows-8-web-sockets,代码行数:29,代码来源:ChatRoom.xaml.cs

示例5: ToRun

 public static Run ToRun(this Span span)
 {
     if (string.IsNullOrEmpty(span.Text))
         return new Run();
     Run run = new Run { Text = span.Text };
     if (span.ForegroundColor != Color.Default)
         run.Foreground = span.ForegroundColor.ToBrush();
     return run;
 }
开发者ID:DIGIHOME-MK,项目名称:Xamarin-forms-winrt,代码行数:9,代码来源:ConvertExtensions.cs

示例6: appendLog

 /// <summary>
 /// Helper to create log entries
 /// </summary>
 /// <param name="logEntry"></param>
 void appendLog(string logEntry, Color c)
 {
     Run r = new Run();
     r.Text = logEntry;
     Paragraph p = new Paragraph();
     p.Foreground = new SolidColorBrush(c);
     p.Inlines.Add(r);
     logResults.Blocks.Add(p);
 }
开发者ID:ckc,项目名称:WinApp,代码行数:13,代码来源:Scenario6_ScriptNotify.xaml.cs

示例7: RefreshView

        private void RefreshView()
        {
            // anything?
            if (string.IsNullOrEmpty(Markup))
            {
                this.Content = null;
                return;
            }

            // get the lines...
            var lines = new List<string>();
            using (var reader = new StringReader(this.Markup))
            {
                while(true)
                {
                    string buf = reader.ReadLine();
                    if (buf == null)
                        break;
                    lines.Add(buf);
                }
            }

            // walk...
            var block = new RichTextBlock();
            for (int index = 0; index < lines.Count; index++)
            {
                string nextLine = null;
                if (index < lines.Count - 1)
                    nextLine = lines[index + 1];

                // create a paragraph... and add it to the block...
                var para = new Paragraph();
                block.Blocks.Add(para);

                // create a "run" and add it to the paragraph...
                var run = new Run();
                run.Text = lines[index];
                para.Inlines.Add(run);

                // heading?
                if (nextLine != null && nextLine.StartsWith("="))
                {
                    // make it bigger, and then skip the next line...
                    para.FontSize = 20;
                    index++;
                }
                else if (nextLine != null && nextLine.StartsWith("-"))
                {
                    para.FontSize = 18;
                    index++;
                }
            }

            // set...
            this.Content = block;
        }
开发者ID:jimgrant,项目名称:ProgrammingWindowsStoreApps,代码行数:56,代码来源:MarkupViewer.cs

示例8: CreateTextBlock

        private Block CreateTextBlock(string content)
        {
            var para = new Paragraph();

            var run = new Run() { Text = content };

            para.Inlines.Add(run);

            return para;
        }
开发者ID:twfx7758,项目名称:DoubanGroup.UWP,代码行数:10,代码来源:TopicContentBehavior.cs

示例9: MakeInline

        /// <summary>
        /// Create the <see cref="Inline"/> instance for the measurement calculation.
        /// </summary>
        /// <param name="children">The children.</param>
        /// <returns>The instance.</returns>
        public override Inline MakeInline(IList<Inline> children)
        {
            if (children.Count > 0)
            {
                throw new InvalidOperationException("Raw text nodes must be leaf nodes.");
            }

            var run = new Run();
            UpdateInline(run);
            return run;
        }
开发者ID:chukcha-wtf,项目名称:react-native-windows,代码行数:16,代码来源:ReactRunShadowNode.cs

示例10: EscribirEnRichTextBox

        void EscribirEnRichTextBox(string texto, RichTextBlock rtb)
        {
            rtb.Blocks.Clear();

            Run run = new Run();
            run.Text = texto;

            Paragraph parrafo = new Paragraph();
            parrafo.Inlines.Add(run);

            rtb.Blocks.Add(parrafo);
        }
开发者ID:icebeam7,项目名称:Ahorcado_Estados,代码行数:12,代码来源:DetalleEstado.xaml.cs

示例11: OnNavigatedTo

 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     rootPage = MainPage.Current;
     this.activeAccount = (Account)e.Parameter;
     //read language related resource file .strings/en or zh-cn/resources.resw
     Run run1 = new Run();
     run1.Text = string.Format(ResourceManagerHelper.ReadValue("SelecteHelloDs1"),activeAccount.Name);
     Run run2 = new Run();
     run2.Text = ResourceManagerHelper.ReadValue("SelecteHelloDs2");
     this.textHelloDes.Inlines.Add(run1);
     this.textHelloDes.Inlines.Add(new LineBreak());
     this.textHelloDes.Inlines.Add(run2);
 }
开发者ID:XPOWERLM,项目名称:More-Personal-Computing,代码行数:13,代码来源:SelecteHello.xaml.cs

示例12: OutputWithFormat

 /// <summary>
 /// Outputs text with formating.
 /// </summary>
 /// <param name="target">The target <see cref="TextBlock"/>.</param>
 /// <param name="toOutput">String to output.</param>
 /// <param name="fontStyle">The font style.</param>
 /// <param name="fontWeight">The font weight.</param>
 /// <param name="fontColor">Color of the font.</param>
 public static void OutputWithFormat(this TextBlock target, string toOutput,
     FontStyle fontStyle = FontStyle.Normal,
     FontWeight fontWeight = default(FontWeight),
     Color fontColor = default(Color))
 {
     var formatted = new Run
     {
         Text = toOutput,
         FontStyle = fontStyle,
         FontWeight = fontWeight.Equals(default(FontWeight)) ? FontWeights.Normal : fontWeight,
         Foreground = fontColor.Equals(default(Color)) ? new SolidColorBrush(Colors.Black) : new SolidColorBrush(fontColor)
     };
     target.Inlines.Add(formatted);
 }
开发者ID:grimlor,项目名称:StackTraceTool,代码行数:22,代码来源:TextBlockOutputHelpers.cs

示例13: getEvent

        public async void getEvent()
        {
            _Event = await Client.GetEventFromIdAsync(CurrentEvent);
            organizer = _Event.username;

            EventDetail.CardTitle = _Event.title;
            BeginTime.CardTitle = "Begin: " + _Event.beginTime.ToString(@"MMM. dd, yyyy a\t hh:mm tt");
            EndTime.CardTitle = "End: " + _Event.endTime.ToString(@"MMM. dd, yyyy a\t hh:mm tt");

            // Add organizer's name
            Run r = new Run();
            r.Text = _Event.username; // get the name instead of the username
            OrganizerName.Inlines.Add(r);

            // Display thumbnail
            if (!string.IsNullOrEmpty(_Event.thumbnail))
            {
                StorageFile file = await StorageFile.GetFileFromPathAsync(_Event.thumbnail);
                BitmapImage bmp = new BitmapImage();
                await bmp.SetSourceAsync(await file.OpenReadAsync());
                EventThumbnail.Source = bmp;
            }

            // Set descripiton
            EventDescription.Document.SetText(TextSetOptions.FormatRtf, _Event.description);

            // Set number of tickets left
            ticketLeft.Text = _Event.ticket + " left";
            if (_Event.ticket == 0)
            {
                ticketType.Foreground = new SolidColorBrush(Colors.LightGray);
                ticketLeft.Foreground = new SolidColorBrush(Colors.LightGray);
                ticketRegister.IsEnabled = false;
            }

            // Set location
            var location = await Client.GetLocationFromIdAsync(_Event.location);
            EventLocation.CardTitle = location.address;
            EventMap.Center = new Geopoint(new BasicGeoposition()
            {
                Latitude = location.latitude,
                Longitude = location.longitude
            });
            EventMap.ZoomLevel = 15;

            MapIcon icon = new MapIcon();
            icon.Location = EventMap.Center;
            icon.NormalizedAnchorPoint = new Point(0.5, 1.0);
            EventMap.MapElements.Add(icon);
        }
开发者ID:HuyTranQ,项目名称:EVENeT,代码行数:50,代码来源:EventDetailPage.xaml.cs

示例14: MainPage

        public MainPage()
        {
            this.InitializeComponent();

            var underline = new Underline();
            var run = new Run();
            run.Text = "コードビハインドから下線を追加";

            underline.Inlines.Add(run);

            this.textBlock.Inlines.Add(underline);

            //this.DataContext = new MainPageViewModel() { underlineText = "アンダーラインを引きたい場合" };
            this.DataContext = new MainPageViewModel() { normalText = "アンダーラインを引きたくない場合" };
        }
开发者ID:coelacanth77,项目名称:UnderlineSample,代码行数:15,代码来源:MainPage.xaml.cs

示例15: OnWikiTextChanged

        private static void OnWikiTextChanged(DependencyObject depObj, DependencyPropertyChangedEventArgs e)
        {
            var txtBox = depObj as TextBlock;
            if (txtBox == null)
                return;
            if (!(e.NewValue is string))
                return;


            var html = e.NewValue as string;

            while (html.Contains("\r\n\r\n"))
            {
                html = html.Replace("\r\n\r\n", "\r\n");
            }

            var lines = html.Split(new char[] { '\n' });

            int i = 0;
            foreach (var line in lines)
            {
                i++;
                var run = new Run() { Text = line };
                if (line.StartsWith("#"))
                {
                    int strength = 1;
                    while (line.Length > strength)
                    {
                        if (line[strength] != '#') break;
                        strength++;
                    }

                    run.Text = run.Text.Replace("#", "").Trim();

                    run.FontWeight = new Windows.UI.Text.FontWeight() { Weight = 600 };

                    switch (strength)
                    {
                        case 3:  run.FontSize = 20; break;
                        case 4:  run.FontSize = 26; break;
                    }
                }

                if (i < lines.Length) run.Text += "\n\n";

                txtBox.Inlines.Add(run);
            }
        }
开发者ID:eurofurence,项目名称:ef-app_wp,代码行数:48,代码来源:WikiTextBoxProperties.cs


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