none
RichTextBox text alignment in RTL languages RRS feed

  • Question

  • For programmers, the Middle East, as well as languages ​​that are written from right to left there is a problem in the tool RichTextBox
    Property and specifically adjust the text JustifiedText where there is no property in the tool to adjust the text of my right and left
    Existing alignment tool is to the right or to the left or to the center
    Can be done to adjust the tool RichTextBox through code and the text will appear already is set from both sides
    But will remain the last line of visible text from left to right

    Please see the attachment below which illustrates the problem when you click on Obash (Align sides)

    https://www.mediafire.com/?7xso5u9g47p9n7t

    http://social.msdn.microsoft.com/Forums/getfile/510829


    Is it possible toadda new feature to adjust thefull textofmy right and left(JustifiedText)?
    Thank you

    السلام عليكم

    السؤال يتعلق بـ : فيجوال ستديو دوت نت

    بالنسبة لمبرمجي الشرق الأوسط وكذلك اللغات التي تكتب من اليمين لليسار هنالك مشكلة في أداة RichTextBox
    وتحديداً خاصية ضبط النص JustifiedText حيث لا توجد خاصية في الأداة لضبط النص من جهتي اليمين واليسار
    الموجود حالياً هو محاذاة الأداة لليمين أو لليسار أو للوسط
    يمكن عمل ضبط لأداة RichTextBox عن طريق الكود وسيظهر بالفعل النص مضبوطاً من الجهتين
    ولكن سيبقى السطر الأخير من النص ظاهراً من اليسار لليمين

    تفضلوا بمشاهدة المرفق التالي الذي يوضح المشكلة عند النقر على أوبش (محاذاة الجانبين)

    https://www.mediafire.com/?7xso5u9g47p9n7t

    فهل يمكن إضافة خاصية جديدة لضبط النص كاملاً من جهتي اليمين واليسار (JustifiedText) ؟
    شكراً لكم


    Tuesday, August 12, 2014 12:26 PM

Answers

  • As Cor Ligthert  mentioned "No Microsoft will not solve your problem in the next version of Visual Studio Net. Simply because there is no new development on the Windows Forms technology anymore. 

    The current user interface for desktop is WPF (Windows Presentation Foundation)."

    Therefore perhaps you would want to host a WPF User Control containing a WPF RichTextBox in your Windows Form. The WPF RichTextBox seems to use "padding" to set left, right, top and bottom margins.

    As a test I created a new Windows Forms application then clicked on it to view the Code Window.

    I then added an imports statement Imports System.Windows.Forms.Integration and then had to add a reference in Assemblies, Framework to Windows.Forms.Integration.

    Next I went to Project tab, Add new item, selected WPF which displayed User Control so I selected that. A WPF designer window was created. And for that window the toolbox displays WPF tools.

    Well the User Control is some size already when the WPF designer window opens. And I dragged a WPF RichTextBox onto it. This part I'm unfamiliar with as when you finally create the control and drag it onto the Form the user control is resizeable but the RichTextBox in it does not resize with it. Perhaps because the RTB needs to be set to Dock = Fill somehow but I've not gone that far yet. Or perhaps a property for the User Control needs to be set.

    I use Option Strict On always. Anyhow when I built the app at this point all kinds of errors displayed. So I clicked on the first one and selected what Option Strict On wanted to do to correct the error and clicked on that. All the other errors went away. But a new window called UserControl.g.vb popped up which is I believe a designer generated code window.

    So then I made the name of the RichTextBox to be RichTextBox1 in the XAML file. It had to be added as the first parameters to the right of RichTextBox.

    For some reason UserControl1 and UserControl11 appear when typing UserControl in the Form Load sub. In order to reference RichTextBox1 I had to precede it with UserControl11 rather than UserControl1 for some reason. I've no idea where UserControl11 term came from, what created that name or anything else as the XAML and g.vb files clearly show UserControl1.

    Anyhow in the Form Load event I set the "padding" and Font Size for RichTextBox1. I set the padding to 50 for each edge of the RTB. And you can see in the bottom pic below that it works. I didn't try RightToLeft or anything as I don't believe without having Arabic installed on my system that your language would display correctly.

    Also see the links displayed in the Form1 code for assistance. And the WPF RichTextBox is much different to use than the Windows Forms RichTextBox. But all WPF controls seem way enhanced with much greater capabilities than their equivalent Windows Forms control. But I don't know WPF that well. It's a whole new ballgame as the saying goes.

    The bottom pic below is different in size than the Form in the Designer Window because I altered the size of the Form in the Designer Window after taking the top pic screenshot of it.

    WPF RichTextBox class

    WPF Tutorial - Using WPF In WinForms

    Walkthrough: Hosting a WPF Composite Control in Windows Forms

    Form1 code

    Option Strict On
    
    Imports System.Windows.Forms.Integration ' Add reference, Assemblies, Framework, Windows.Forms.Integration
    
    Public Class Form1
    
        ' See link http://tech.pro/tutorial/799/wpf-tutorial-using-wpf-in-winforms
        ' WPF RichTextBox class http://msdn.microsoft.com/en-us/library/system.windows.controls.richtextbox(v=vs.110).aspx
    
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            Me.CenterToScreen()
            UserControl11.RichTextBox1.FontSize = 24.5
            UserControl11.RichTextBox1.Padding = New Windows.Thickness(50, 50, 50, 50)
        End Sub
    
    End Class

    UserControl1.XAML code

    <UserControl x:Class="UserControl1"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
                 mc:Ignorable="d" Height="194" Width="366">
        <RichTextBox  Name="RichTextBox1" HorizontalAlignment="Left" Height="400" VerticalAlignment="Top" Width="400">
            <FlowDocument>
                <Paragraph>
                    <Run Text="RichTextBox1"/>
                </Paragraph>
            </FlowDocument>
        </RichTextBox>
    </UserControl>

    UserControl1.g.vb code (your's should be generated automatically I would think)

    #ExternalChecksum("..\..\UserControl1.xaml","{406ea660-64cf-4c82-b6f0-42d48172a799}","B20A5FFAD386A19AF296CAE4749C94F1")
    '------------------------------------------------------------------------------
    ' <auto-generated>
    '     This code was generated by a tool.
    '     Runtime Version:4.0.30319.18408
    '
    '     Changes to this file may cause incorrect behavior and will be lost if
    '     the code is regenerated.
    ' </auto-generated>
    '------------------------------------------------------------------------------
    
    Option Strict Off
    Option Explicit On
    
    Imports System
    Imports System.Diagnostics
    Imports System.Windows
    Imports System.Windows.Automation
    Imports System.Windows.Controls
    Imports System.Windows.Controls.Primitives
    Imports System.Windows.Data
    Imports System.Windows.Documents
    Imports System.Windows.Forms.Integration
    Imports System.Windows.Ink
    Imports System.Windows.Input
    Imports System.Windows.Markup
    Imports System.Windows.Media
    Imports System.Windows.Media.Animation
    Imports System.Windows.Media.Effects
    Imports System.Windows.Media.Imaging
    Imports System.Windows.Media.Media3D
    Imports System.Windows.Media.TextFormatting
    Imports System.Windows.Navigation
    Imports System.Windows.Shapes
    Imports System.Windows.Shell
    
    
    '''<summary>
    '''UserControl1
    '''</summary>
    <Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
    Partial Public Class UserControl1
        Inherits System.Windows.Controls.UserControl
        Implements System.Windows.Markup.IComponentConnector
    
    
        #ExternalSource("..\..\UserControl1.xaml",7)
        <System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")> _
        Friend WithEvents RichTextBox1 As System.Windows.Controls.RichTextBox
    
        #End ExternalSource
    
        Private _contentLoaded As Boolean
    
        '''<summary>
        '''InitializeComponent
        '''</summary>
        <System.Diagnostics.DebuggerNonUserCodeAttribute(), _
         System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")> _
        Public Sub InitializeComponent() Implements System.Windows.Markup.IComponentConnector.InitializeComponent
            If _contentLoaded Then
                Return
            End If
            _contentLoaded = True
            Dim resourceLocater As System.Uri = New System.Uri("/WindowsApplication1;component/usercontrol1.xaml", System.UriKind.Relative)
    
            #ExternalSource("..\..\UserControl1.xaml",1)
            System.Windows.Application.LoadComponent(Me, resourceLocater)
    
            #End ExternalSource
        End Sub
    
        <System.Diagnostics.DebuggerNonUserCodeAttribute(), _
         System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0"), _
         System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never), _
         System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes"), _
         System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity"), _
         System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")> _
        Sub System_Windows_Markup_IComponentConnector_Connect(ByVal connectionId As Integer, ByVal target As Object) Implements System.Windows.Markup.IComponentConnector.Connect
            If (connectionId = 1) Then
                Me.RichTextBox1 = CType(target, System.Windows.Controls.RichTextBox)
                Return
            End If
            Me._contentLoaded = True
        End Sub
    End Class

    Images


    La vida loca




    Thursday, August 14, 2014 2:24 AM
  • Thank you my friend Mr. Monkeyboy
    I am sure that the tool RichTextBox where there is no solution because I have long been trying to find a solution, but I did not find a solution.
    The purpose of putting this debate are:
    Microsoft is to solve this problem in the next version of Visual Studio Dot Net.
    Microsoft has previously made ​​to solve the problem in the TreeView and ListView by adding property RightToLeftLayout
    But the future of Microsoft wished to find a solution to the RichTextBox tool by adding a new feature related to the exact alignment (JustifiedText)
    Thank you all

    No Microsoft will not solve your problem in the next version of Visual Studio Net. Simply because there is no new development on the Windows Forms technology anymore. 

    The current user interface for desktop is WPF (Windows Presentation Foundation).

     http://msdn.microsoft.com/en-us/library/vstudio/ms754130.aspx

    The forum for that is 

    http://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=wpf


    Success
    Cor

    Wednesday, August 13, 2014 5:57 PM

All replies

  • <> { || '-+ ^ %$#

    |\\\\\ }{][[ ?.<>/ ____ (+++)

    (_________This is an English Forum________)


    La vida loca

    Tuesday, August 12, 2014 12:52 PM
  • Hello

    Question concerning: Visual Studio Dot Net

    For programmers, the Middle East, as well as languages ​​that are written from right to left there is a problem in the tool RichTextBox
    Property and specifically adjust the text JustifiedText where there is no property in the tool to adjust the text of my right and left
    Existing alignment tool is to the right or to the left or to the center
    Can be done to adjust the tool RichTextBox through code and the text will appear already is set from both sides
    But will remain the last line of visible text from left to right

    Please see the attachment below which illustrates the problem when you click on Obash (Align sides)

    https://www.mediafire.com/?7xso5u9g47p9n7t

    http://social.msdn.microsoft.com/Forums/getfile/510829


    Is it possible toadda new feature to adjust thefull textofmy right and left(JustifiedText)?
    Thank you


    • Edited by sndybad Tuesday, August 12, 2014 4:00 PM
    Tuesday, August 12, 2014 4:00 PM
  • Hello

    Question concerning: Visual Studio Dot Net

    For programmers, the Middle East, as well as languages ​​that are written from right to left there is a problem in the tool RichTextBox
    Property and specifically adjust the text JustifiedText where there is no property in the tool to adjust the text of my right and left
    Existing alignment tool is to the right or to the left or to the center
    Can be done to adjust the tool RichTextBox through code and the text will appear already is set from both sides
    But will remain the last line of visible text from left to right

    Please see the attachment below which illustrates the problem when you click on Obash (Align sides)

    https://www.mediafire.com/?7xso5u9g47p9n7t

    http://social.msdn.microsoft.com/Forums/getfile/510829


    Is it possible toadda new feature to adjust thefull textofmy right and left(JustifiedText)?
    Thank you


    If http://support.microsoft.com/KB/814311 doesn't meet this requirement, maybe you could check the following thread.

    http://www.dreamincode.net/forums/topic/331185-justify-text-in-richtextbox-vbnet/

    specially the suggestion about http://geekswithblog.../10/14/182.aspx 


    remember make the reply as answer and vote the reply as helpful if it helps.

    Wednesday, August 13, 2014 8:48 AM
  • Hello

    Question concerning: Visual Studio Dot Net

    For programmers, the Middle East, as well as languages ​​that are written from right to left there is a problem in the tool RichTextBox
    Property and specifically adjust the text JustifiedText where there is no property in the tool to adjust the text of my right and left
    Existing alignment tool is to the right or to the left or to the center
    Can be done to adjust the tool RichTextBox through code and the text will appear already is set from both sides
    But will remain the last line of visible text from left to right

    Please see the attachment below which illustrates the problem when you click on Obash (Align sides)

    https://www.mediafire.com/?7xso5u9g47p9n7t

    http://social.msdn.microsoft.com/Forums/getfile/510829


    Is it possible toadda new feature to adjust thefull textofmy right and left(JustifiedText)?
    Thank you


    Check this link:

    http://stackoverflow.com/questions/15886027/align-text-to-left-side-of-checkbox-in-windows-forms


    Allow time to reverse.

    Wednesday, August 13, 2014 9:52 AM
  • Thank you my friends, but unfortunately the problem is not resolved!
    And adjust the alignment tool RichTextBox from right to left I was able to be resolved
    But for the Arabic language and the languages ​​that are written from right to left will remain the last line in RichTextBox visible from left to right
    As is shown in the picture that attached them to you
    I have seen all the links on JustifiedText but I did not find a complete solution
    Wednesday, August 13, 2014 1:03 PM
  • Thank you my friends, but unfortunately the problem is not resolved!
    And adjust the alignment tool RichTextBox from right to left I was able to be resolved
    But for the Arabic language and the languages ​​that are written from right to left will remain the last line in RichTextBox visible from left to right
    As is shown in the picture that attached them to you
    I have seen all the links on JustifiedText but I did not find a complete solution
    Wednesday, August 13, 2014 1:03 PM
  • Thank you my friends, but unfortunately the problem is not resolved!
    And adjust the alignment tool RichTextBox from right to left I was able to be resolved
    But for the Arabic language and the languages ​​that are written from right to left will remain the last line in RichTextBox visible from left to right
    As is shown in the picture that attached them to you
    I have seen all the links on JustifiedText but I did not find a complete solution

    In my opinion the standard RichTextBox does not provide a solution for your question. At least not from the couple of hours I spent attempting to find an answer with it and pasting the arabic from your original post in it constantly to see what happens.

    So I would suspect you would need to create a custom textbox that allows a left margin to be set using a class for that.  As the RichTextBox supports a Right margin but not a Left margin for some reason beyond me. And the Right margin for left to right typing doesn't allow typing past whatever it is set to which I believe may be pixels as I set it for 50 and could only type about 4 or 5 letters before word wrapping occured.

    Although because I don't have the arabic language installed on my system it's entirely possible that any testing I do is not going to work correctly since Arabic is a right to left language. But in the image below the second and third RTB are set Right to Left. Yet the cursor in RTB 3 does not set to the left of the arabic text. And I was under the impression that if you read right to left then the next character being typed would be on the left side of the text. But it isn't working that way in RTB 3.

    I don't know what properties an RTB is coded to use for the Right margin but whatever that is I suspect could be used in a class, which inherits RichTextBox, to create a RTB control that supports Left margin also.


    La vida loca


    Wednesday, August 13, 2014 3:55 PM
  • Thank you my friend Mr. Monkeyboy
    I am sure that the tool RichTextBox where there is no solution because I have long been trying to find a solution, but I did not find a solution.
    The purpose of putting this debate are:
    Microsoft is to solve this problem in the next version of Visual Studio Dot Net.
    Microsoft has previously made ​​to solve the problem in the TreeView and ListView by adding property RightToLeftLayout
    But the future of Microsoft wished to find a solution to the RichTextBox tool by adding a new feature related to the exact alignment (JustifiedText)
    Thank you all
    Wednesday, August 13, 2014 5:47 PM
  • Thank you my friend Mr. Monkeyboy
    I am sure that the tool RichTextBox where there is no solution because I have long been trying to find a solution, but I did not find a solution.
    The purpose of putting this debate are:
    Microsoft is to solve this problem in the next version of Visual Studio Dot Net.
    Microsoft has previously made ​​to solve the problem in the TreeView and ListView by adding property RightToLeftLayout
    But the future of Microsoft wished to find a solution to the RichTextBox tool by adding a new feature related to the exact alignment (JustifiedText)
    Thank you all

    No Microsoft will not solve your problem in the next version of Visual Studio Net. Simply because there is no new development on the Windows Forms technology anymore. 

    The current user interface for desktop is WPF (Windows Presentation Foundation).

     http://msdn.microsoft.com/en-us/library/vstudio/ms754130.aspx

    The forum for that is 

    http://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=wpf


    Success
    Cor

    Wednesday, August 13, 2014 5:57 PM
  • Thank youCor Ligthert
    Unfortunate thingthatMicrosoftdoes notdeveloptechnologymodels!But we hopein the futurethatMicrosoftis consideringthisbecause the problem isthat youput themexisted since thefirst versionofVisual Basicdot net.
    After allyou'veintroducedthe problemin theforum, whichguided meto him andthis is the link:

    http://social.msdn.microsoft.com/Forums/vstudio/en-US/c0ac9048-cdd5-44e5-b962-769ca73a6f0d/adjust-tool-richtextbox-from-both-sides-of-the-right-and-left-for-the-middle-east-programmers-and?forum=wpf


    Greetingsto you

    Wednesday, August 13, 2014 6:17 PM
  • As Cor Ligthert  mentioned "No Microsoft will not solve your problem in the next version of Visual Studio Net. Simply because there is no new development on the Windows Forms technology anymore. 

    The current user interface for desktop is WPF (Windows Presentation Foundation)."

    Therefore perhaps you would want to host a WPF User Control containing a WPF RichTextBox in your Windows Form. The WPF RichTextBox seems to use "padding" to set left, right, top and bottom margins.

    As a test I created a new Windows Forms application then clicked on it to view the Code Window.

    I then added an imports statement Imports System.Windows.Forms.Integration and then had to add a reference in Assemblies, Framework to Windows.Forms.Integration.

    Next I went to Project tab, Add new item, selected WPF which displayed User Control so I selected that. A WPF designer window was created. And for that window the toolbox displays WPF tools.

    Well the User Control is some size already when the WPF designer window opens. And I dragged a WPF RichTextBox onto it. This part I'm unfamiliar with as when you finally create the control and drag it onto the Form the user control is resizeable but the RichTextBox in it does not resize with it. Perhaps because the RTB needs to be set to Dock = Fill somehow but I've not gone that far yet. Or perhaps a property for the User Control needs to be set.

    I use Option Strict On always. Anyhow when I built the app at this point all kinds of errors displayed. So I clicked on the first one and selected what Option Strict On wanted to do to correct the error and clicked on that. All the other errors went away. But a new window called UserControl.g.vb popped up which is I believe a designer generated code window.

    So then I made the name of the RichTextBox to be RichTextBox1 in the XAML file. It had to be added as the first parameters to the right of RichTextBox.

    For some reason UserControl1 and UserControl11 appear when typing UserControl in the Form Load sub. In order to reference RichTextBox1 I had to precede it with UserControl11 rather than UserControl1 for some reason. I've no idea where UserControl11 term came from, what created that name or anything else as the XAML and g.vb files clearly show UserControl1.

    Anyhow in the Form Load event I set the "padding" and Font Size for RichTextBox1. I set the padding to 50 for each edge of the RTB. And you can see in the bottom pic below that it works. I didn't try RightToLeft or anything as I don't believe without having Arabic installed on my system that your language would display correctly.

    Also see the links displayed in the Form1 code for assistance. And the WPF RichTextBox is much different to use than the Windows Forms RichTextBox. But all WPF controls seem way enhanced with much greater capabilities than their equivalent Windows Forms control. But I don't know WPF that well. It's a whole new ballgame as the saying goes.

    The bottom pic below is different in size than the Form in the Designer Window because I altered the size of the Form in the Designer Window after taking the top pic screenshot of it.

    WPF RichTextBox class

    WPF Tutorial - Using WPF In WinForms

    Walkthrough: Hosting a WPF Composite Control in Windows Forms

    Form1 code

    Option Strict On
    
    Imports System.Windows.Forms.Integration ' Add reference, Assemblies, Framework, Windows.Forms.Integration
    
    Public Class Form1
    
        ' See link http://tech.pro/tutorial/799/wpf-tutorial-using-wpf-in-winforms
        ' WPF RichTextBox class http://msdn.microsoft.com/en-us/library/system.windows.controls.richtextbox(v=vs.110).aspx
    
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            Me.CenterToScreen()
            UserControl11.RichTextBox1.FontSize = 24.5
            UserControl11.RichTextBox1.Padding = New Windows.Thickness(50, 50, 50, 50)
        End Sub
    
    End Class

    UserControl1.XAML code

    <UserControl x:Class="UserControl1"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
                 mc:Ignorable="d" Height="194" Width="366">
        <RichTextBox  Name="RichTextBox1" HorizontalAlignment="Left" Height="400" VerticalAlignment="Top" Width="400">
            <FlowDocument>
                <Paragraph>
                    <Run Text="RichTextBox1"/>
                </Paragraph>
            </FlowDocument>
        </RichTextBox>
    </UserControl>

    UserControl1.g.vb code (your's should be generated automatically I would think)

    #ExternalChecksum("..\..\UserControl1.xaml","{406ea660-64cf-4c82-b6f0-42d48172a799}","B20A5FFAD386A19AF296CAE4749C94F1")
    '------------------------------------------------------------------------------
    ' <auto-generated>
    '     This code was generated by a tool.
    '     Runtime Version:4.0.30319.18408
    '
    '     Changes to this file may cause incorrect behavior and will be lost if
    '     the code is regenerated.
    ' </auto-generated>
    '------------------------------------------------------------------------------
    
    Option Strict Off
    Option Explicit On
    
    Imports System
    Imports System.Diagnostics
    Imports System.Windows
    Imports System.Windows.Automation
    Imports System.Windows.Controls
    Imports System.Windows.Controls.Primitives
    Imports System.Windows.Data
    Imports System.Windows.Documents
    Imports System.Windows.Forms.Integration
    Imports System.Windows.Ink
    Imports System.Windows.Input
    Imports System.Windows.Markup
    Imports System.Windows.Media
    Imports System.Windows.Media.Animation
    Imports System.Windows.Media.Effects
    Imports System.Windows.Media.Imaging
    Imports System.Windows.Media.Media3D
    Imports System.Windows.Media.TextFormatting
    Imports System.Windows.Navigation
    Imports System.Windows.Shapes
    Imports System.Windows.Shell
    
    
    '''<summary>
    '''UserControl1
    '''</summary>
    <Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
    Partial Public Class UserControl1
        Inherits System.Windows.Controls.UserControl
        Implements System.Windows.Markup.IComponentConnector
    
    
        #ExternalSource("..\..\UserControl1.xaml",7)
        <System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")> _
        Friend WithEvents RichTextBox1 As System.Windows.Controls.RichTextBox
    
        #End ExternalSource
    
        Private _contentLoaded As Boolean
    
        '''<summary>
        '''InitializeComponent
        '''</summary>
        <System.Diagnostics.DebuggerNonUserCodeAttribute(), _
         System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")> _
        Public Sub InitializeComponent() Implements System.Windows.Markup.IComponentConnector.InitializeComponent
            If _contentLoaded Then
                Return
            End If
            _contentLoaded = True
            Dim resourceLocater As System.Uri = New System.Uri("/WindowsApplication1;component/usercontrol1.xaml", System.UriKind.Relative)
    
            #ExternalSource("..\..\UserControl1.xaml",1)
            System.Windows.Application.LoadComponent(Me, resourceLocater)
    
            #End ExternalSource
        End Sub
    
        <System.Diagnostics.DebuggerNonUserCodeAttribute(), _
         System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0"), _
         System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never), _
         System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes"), _
         System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity"), _
         System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")> _
        Sub System_Windows_Markup_IComponentConnector_Connect(ByVal connectionId As Integer, ByVal target As Object) Implements System.Windows.Markup.IComponentConnector.Connect
            If (connectionId = 1) Then
                Me.RichTextBox1 = CType(target, System.Windows.Controls.RichTextBox)
                Return
            End If
            Me._contentLoaded = True
        End Sub
    End Class

    Images


    La vida loca




    Thursday, August 14, 2014 2:24 AM
  • Thank you, Mr. Monkeyboy
    Frankly, I tried to apply the code developed by, but did not succeed with me
    Is it possible to put me Balsors project code as an example so I'm trying to give it a try?
    Greetings to you
    Thursday, August 14, 2014 2:45 PM
  • Thank you, Mr. Monkeyboy
    Frankly, I tried to apply the code developed by, but did not succeed with me
    Is it possible to put me Balsors project code as an example so I'm trying to give it a try?
    Greetings to you

    You're not supposed to apply all of the code.

    You're supposed to add a WPF User Control to a Windows Forms project and then select a WPF RichTextBox to place in the WPF User Control.

    That's why I said to start a new project as a test with just a Windows Form.

    Copy and paste the Forms code I displayed over the code for your Form and then add the reference so the Imports statement works.

    Then add a WPF User Control and place a WPF RichTextBox on it.

    The only code you should alter in the WPF User Control XAML code is the addition of the name property with a name for your RichTextBox to the XAML code. And in your Form1 code alter the name I used "RichTextBox1" to whatever name you use.

    Then build the project.

    As a test you should do this so you can learn in the test app what you need to know to use the WPF RichTextBox the same way you use a Windows Forms RichTextBox. As their properties and other things are not the same for the most part.

    Also I reopened that project I created and dropped a second UserControl1 on it. To access the RichTextBox in that control I have to use UserControl12.RichTextBox1. So for every instance of UserControl1 dropped onto the Form it seems UserControl1 increments starting at UserControl11 and up.

    Also I don't know who or what Balsor is. But in my opinion I would test the WPF RichTextBox first as it provides much more capability it seems than a Windows Forms RichTextBox from all the info I saw it could do.

    Also WPF has been around for quite awhile. I'm using .Net 4.0 but I've seen WPF used with .Net 2.0.


    La vida loca




    Thursday, August 14, 2014 3:12 PM
  • Thank you, Mr. Monkeyboy
    I have a question regarding the phrase Cor Ligthert the following:

    No Microsoft will not solve your problem in the next version of Visual Studio Net. Simply because there is no new development on the Windows Forms technology anymore.

    Why would not you do what Krosowic?
    Microsoft has lowered the three updates to Visual Studio 2013 so far, and Microsoft are always lowered updates almost every year
    So why exclude from update tools?

    • Edited by sndybad Friday, August 15, 2014 2:35 PM
    Friday, August 15, 2014 2:30 PM