Results 1 to 7 of 7

Thread: [RESOLVED] convert existing RTB to TransparentRTB

Hybrid View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2013
    Posts
    24

    Resolved [RESOLVED] convert existing RTB to TransparentRTB

    Hi.

    I have a richtextbox created in the design view.
    I coded several things for it and now I realised I need it to be transparent.

    I found some TranbsparentRTB class codes and inserted one in my project (it inherits the RichTextBox class).

    My problem is how to tell it that the excepbox wich is defined as System.Windows.Forms.RichTextBox is now a TransparentRichTextBox...
    I changed in Form.Designer.vb to Me.excepBox = New TransparentRichTextBox but then several errors appear on another locations because it treats it like a 1-dimensional array...

    Where is my error?
    the way I call the class?

    any (basic) help is appreciated.
    Thanks

  2. #2
    Junior Member mnemonic_digit's Avatar
    Join Date
    Feb 2013
    Posts
    20

    Re: convert existing RTB to TransparentRTB

    i think you should post more of your code snippets. please post your full code here if it's possible.

  3. #3
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: convert existing RTB to TransparentRTB

    It's a control... so you'll need to grab it from your toolbox and add it to your form... much like you did the original RTB...

    Personally, I'd put it in its own project/assembly, compile it, add it to your toolbox, then reference it from your app... then drop it onto your form (or just drop it onto the form, and VS will automatically reference the assembly for you.)

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  4. #4
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,020

    Re: convert existing RTB to TransparentRTB

    Generally, this is a custom control.
    I found some TranbsparentRTB class codes and inserted one in my project (it inherits the RichTextBox class).
    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal | Programming
    Projects: GitHub | jsFiddle
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Jan 2013
    Posts
    24

    Re: convert existing RTB to TransparentRTB

    thanks a lot.
    just dragged the control from the toolbox... :-)

  6. #6
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: [RESOLVED] convert existing RTB to TransparentRTB

    you could've edited your form's designer.vb file. you can find the file by clicking 'Show all files' in the Solution Explorer window.
    assuming the name of the control is TransparentRichTextBox:

    Code:
    <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
    Partial Class Form1
        Inherits System.Windows.Forms.Form
    
        'Form overrides dispose to clean up the component list.
        <System.Diagnostics.DebuggerNonUserCode()> _
        Protected Overrides Sub Dispose(ByVal disposing As Boolean)
            Try
                If disposing AndAlso components IsNot Nothing Then
                    components.Dispose()
                End If
            Finally
                MyBase.Dispose(disposing)
            End Try
        End Sub
    
        'Required by the Windows Form Designer
        Private components As System.ComponentModel.IContainer
    
        'NOTE: The following procedure is required by the Windows Form Designer
        'It can be modified using the Windows Form Designer.  
        'Do not modify it using the code editor.
        <System.Diagnostics.DebuggerStepThrough()> _
        Private Sub InitializeComponent()
            Me.RichTextBox1 = New System.Windows.Forms.RichTextBox 'change to New TransparentRichTextBox
            Me.SuspendLayout()
            '
            'RichTextBox1
            '
            Me.RichTextBox1.Location = New System.Drawing.Point(12, 12)
            Me.RichTextBox1.Name = "RichTextBox1"
            Me.RichTextBox1.Size = New System.Drawing.Size(100, 96)
            Me.RichTextBox1.TabIndex = 0
            Me.RichTextBox1.Text = ""
            '
            'Form1
            '
            Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
            Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
            Me.ClientSize = New System.Drawing.Size(284, 262)
            Me.Controls.Add(Me.RichTextBox1)
            Me.Name = "Form1"
            Me.Text = "Form1"
            Me.ResumeLayout(False)
    
        End Sub
        Friend WithEvents RichTextBox1 As System.Windows.Forms.RichTextBox 'change to TransparentRichTextBox
    
    End Class

  7. #7
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: [RESOLVED] convert existing RTB to TransparentRTB

    Yeaaaah..... I thought about that too... but seems like when I try to do something like that, it just never goes well...


    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width