none
VB2010 - how add images with RTF?

    Question

  • with RTF Richtextbox, we can add images, inclued animated, tables and more.

    i'm trying creating a sub for add the image:

    Public Function imageToHex(img As Image) As String
    
            Dim ms As New MemoryStream
            img.Save(ms, ImageFormat.Gif)
    
            Dim bytes() As Byte = ms.ToArray()
    
            Dim hex As String = BitConverter.ToString(bytes)
            Return hex.Replace("-", "")
        End Function
    
        Public Sub InsertImageRTF(ByVal strImage As String)
            Dim btFileStream() As Byte
            btFileStream = My.Computer.FileSystem.ReadAllBytes(strImage)
            'RichTextBox1.Text = System.Text.Encoding.UTF7.GetString(btFileStream)
            Dim s As Image = Image.FromFile(strImage)
            Dim strRTF As String = ""
            strRTF = "{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Calibri;}}{\*\generator Msftedit 5.41.21.2510;}\viewkind4\uc1\pard\sa200\sl276\slmult1\lang9\f0\fs22 testing\par\par\pard\sa200\sl240\slmult1{\pict\wmetafile8\" + s.Width.ToString + "\pich" + s.Height.ToString + "\picwgoal5924\pichgoal1860 hex " + imageToHex(s) + "}}"
            Me.Rtf = strRTF 'me it's my usercontrol inherited from richtextbox
            Debug.Print(Me.Rtf)
        End Sub

    heres the output:

    - on richtextbox: "testing

    31"

    - on Debug:

    "{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Calibri;}}
    {\*\generator Msftedit 5.41.21.2512;}\viewkind4\uc1\pard\sa200\sl276\slmult1\lang9\f0\fs22 testing\par
    \par
    \pard\sa200\sl240\slmult1 31\par
    }"

    heres the output of image:

    4749463839611F001800D50700401410554008FFE620FADA10FAD60CFFE21CF6CA00FFFFFFFFDE18F2B600F2BE006D4C04594008F6C600EEB200CE8D00EEAA00F6C200E69900A56904DE9500E69D00F2C200FACE04D6AA006D5004F2C600B28D00A57104CE8500997104C28900EAA100AE7D00715004EAAA00FAD204EEAE00FFDE14AA7504CAA5009D7D04AE8904DEB600DEAE00956504C27D00AE8500EEBA00E6A500E29100FAD60800000000000000000000000000000000000000000000000000000000000000000000000021FF0B4E45545343415045322E30030100000021FE1D4275696C74207769746820474946204D6F766965204765617220342E300021FE2144657369676E20627920416977616E2028616977616E4079616E6465782E7275290021F904090A0034002C000000001F0018000006FE409A70482C1A8FC8A472C96C3A9FD080740A3D06322A4CA381096502D5612075210C06049221E1015719288209512820100383E2C3886E08740500000283066B276E4D2217810007078F910411230B4E017F058591838391060E1C8A4A012B03758F9E9F006B0FA449011AA89C9092A00914B048B2049B82AB83790EBA4D012C809B02CBCC6811101DBB449E012F06A8CACC767A2013019E4684CB00220A06C9757600030A10320BE285D385CB040121E62403AB0616251513D68DDB37C4D3B27D0C3E24B0D0E
    050BF04102AB860008080807D83A6ED23501140000F311C2448E00002080A2DBE6D5C07A048478C42022CE0F0A082840E1316B811D6311C0E8D9645A65071F9338CD1A34982000021F904090A0034002C02000400190012000006EC409A70480C188FC4A45218C8A8308D062694092C9781D485301810488684C77A1D32500413A25040200606C58751A6053684351B0028F0C327644B22177A02000707888A11230B57770405027E8A7C7C8A0E1C82452B036C8796978A090F9C43011A9F02A1898BA414A74C1A9294879797060EB1582C7993ACC1025E11101DA77C012F06036BC294087120974300C1220A06BF936D7E0A10D6AC0034D6E10121D9335DB816250003E203B8AC030C1F091606FA061609101500080CA3F62E60C0001E62384890C0010410140A122828C4A0BC710116707850414287090B02F09137B11AB9244790981C4723080021F904090A0034002C04000300160013000006E3409A70280C188FC464329051611A0D4C2813502E5317C260402019609EAA95C640114C884201812018141F8635B021A4056AFCC060489CC4442217690578020000058811230B4B75798500070793950E1C8034012B037987958888950F9A011A9E8693A2A30014A61A0485929495B5AEA62C76850287AC88101DA62F06B2BCBD7A6F20139A00220A0603847869080A10A24300020121D0245B085C000A25DBBD0034DBDB
    0C1F09117C7CAC03E803ACBD011E232509090EE632001010600F913A7B04000458C0E14105091D26004038319DBA8405371D31A2AE62426DEAC610496731080021F904090A0034002C020003001A0013000006FD409A70480C188FC4A47218C8A8308D062694092CAF81D485301810480698C77A2532500413A25040200806C5875116063684B580BD1F180C0927645722176B057B0000028A0411230B65770488880007079799060E1C8349012B037C978AA699090F9F451AA3028C99A6A50914AB4C1A94AF9A9998990EB5582C24878CB28A11101DB6762F06A388AFAF057E0A2013B6A6220ACEC46D6D0A23120BA6438BAF0121DB245D08030071251513E68C348BE6030C1F09117F06A6102AB8003040973B53AFDC05F030A24482040E008090D122000002020E02B0E78E0041000116707850414287090B2C76FC28E4E2C78D768E1829F7D163397B75946C8419040021F904090A0034002C010004001C0012000006FE409A7048A4058EC8A272290C645498460313CA0498D840EA42180C082443C273C51619288209512820100383E2C3300F031B02BB000008FA066227656622177B000707898B0411230B767804057F8B7D7D8B060E1C844B012B036D89989900620F9E4A011AA2968A8C9A0914AA45AC94027CA57D710EB466012C7A9502C5C65F11101DB53498012F06A2C4C66E7220130198437EC500220A06C36
    D6E00030A10320BDC7FCD7FC5040121E02403A50616251513E5DDF598C5F5187C4860A141A07B09205470C100000101FE0034AB47C02180001E62384890C0010410145A64A3584E62B38AFE9A2CE0F0A082840E131694E165715BB355488E28916832080021F904090A0034002C000004001E0012000006FE409A704814068EC8A272490C645498460313CA04985863EA42180C082443C273CD2A19288209512820100383E2C330373704360050D8C7C527657622177A07070087005F11230B763401787D887B7B88710E1C8258012B039496978B620F9C4C011AA0898A8788086214A74BA9046DA2965E060EB276012C790502C3C4028C101DB34296912F06036CC5026E72201357CCCBC40034220A06C1C27D05031610328F00DB34EAEAC6000121DF24A204722512D78BC38BA2C303DC187C4860A1818183161240A8E0A20E0002EFF6B00348E021B7001E46384890C0010410325A60A3D86F594580DC8C2CE0F0A082840E131608F2637108B7944590245172534801100021F904090A0034002C020004001B0012000006F9409A70480C188FC4A4B29851611A0D4C2813585A6981D485301810488684A77A2532500413A25040200606C5875116063604040050D817E06127645722177A0707008800025E11230B6577048A7B96895D060E1C834A012B039596956F610F9D49011AA18889AD0003086114A8451A047DA37B
    8D700EB457012C790502C5C68D040D101DB534962F06036CC7026D6120130196438CC5000A06C3C4006B030A25320BDD0200CEECC594E0A35E06162512D903DEA196C5A11F092C343040D0420208155C300040A0D136580C237A18E12041020710405068B13014A5504222F2C3B280C3830A123A4C5840668FC776219DA53A6244493B9841000021F904090A0034002C03000400180012000006E3409A70380C188FC4A49216C8A8308D062694092C9581D485301810488684C77A1532500413A25040200606C587510E6C080040212F28C0C327644A2217000707868802025E11230B4B768679948A5D060E1C82452B939493026F610F9B42011A89888796086114A54C1A789F7C8C700EAF582C046B8BBE8B8D101DA59406036CBF7DAD0A201301004300BE0006BC7ACA7E1610320B8BD0D2D2027806945D04712512CE0200039FC0000916D40606160A10152E0C8C9434ED00F0B88BE12041020710405068F14C20B47F0E010458C0E14105091D262C7806104FB47F448E20F9F830080021F904090A0034002C020003001A0013000006FE409A70480C188FC4A47218C8A8308D062694092CAF81D485301810480698C77A2532500413A25040200806C5875116063684B580BD1F180C0927645722176B000002887D0411230B657704050007079597025D060E1C8349012B039588A5970308800F9F451AA397A5A4087E091
    4AC4C1A04989796A77E0EB6582C2408B1A5026F11101DB7762F06037C02D37D712013B7A5220AD07A6C6B030A23120BA54389D30021DC5C00265E712515D8D4003489E8A31F0916A506160A205470C16040BA51C7340108E021860300091C400041A1450000041422BA374AD7A8000B383C9020A1C38405173B02182504E3CA8D768E1839F752D7B97B7594D8B34723080021F904090A0034002C010003001C0013000006FE409A7048A4058EC8A272290C645498460313CA0498D840EA42180C082403CC73C51619288209512820100483E2C3300F031B025BD0E60F0C060927656622176C050000028A055F11230B76787A8C07070097005E060E1C844B012B0389988A8A987F090FA04A011AA499A7A800088114AD45AF04A59A97A99DB866012C7A89B38A8F101DB944012F06BC0502D4D48E722013CDA734220A06037B7C6C030A231292DC428BD4000121DF245E08030006162515DAEC8C348BEC040030F890C0C22C0B09204870C16053BB7AA7A8D533E221868304091C400021A3C5150004044004E0AF5EC0804616707850414287090B3E9ADC44D25F4088CE901C21920C64094D7F40ED28215933080021F904090A0034002C02000400190012000006EC409A70480C188FC4A45218C8A8308D062694092C9781D485301810488684C77A1D32500413A25040200606C58751A6053684351B0028F0C327644B22177A
    02000707888A11230B57770405027E8A7C7C8A0E1C82452B036C8796978A090F9C43011A9F02A1898BA414A74C1A9294879797060EB1582C7993ACC1025E11101DA77C012F06036BC294087120974300C1220A06BF936D7E0A10D6AC0034D6E10121D9335DB816250003E203B8AC030C1F091606FA061609101500080CA3F62E60C0001E62384890C0010410140A122828C4A0BC710116707850414287090B02F09137B11AB9244790981C4723080021F904090A0034002C04000300160013000006E3409A70280C188FC464329051611A0D4C2813502E5317C260402019609EAA95C640114C884201812018141F8635B021A4056AFCC060489CC4442217690578020000058811230B4B75798500070793950E1C8034012B037987958888950F9A011A9E8693A2A30014A61A0485929495B5AEA62C76850287AC88101DA62F06B2BCBD7A6F20139A00220A0603847869080A10A24300020121D0245B085C000A25DBBD0034DBDB0C1F09117C7CAC03E803ACBD011E232509090EE632001010600F913A7B04000458C0E14105091D26004038319DBA8405371D31A2AE62426DEAC610496731080021F904090A0034002C020003001A0013000006FD409A70480C188FC4A47218C8A8308D062694092CAF81D485301810480698C77A2532500413A25040200806C5875116063684B580BD1F180C0927645722176B057B0000028A0
    411230B65770488880007079799060E1C8349012B037C978AA699090F9F451AA3028C99A6A50914AB4C1A94AF9A9998990EB5582C24878CB28A11101DB6762F06A388AFAF057E0A2013B6A6220ACEC46D6D0A23120BA6438BAF0121DB245D08030071251513E68C348BE6030C1F09117F06A6102AB8003040973B53AFDC05F030A24482040E008090D122000002020E02B0E78E0041000116707850414287090B2C76FC28E4E2C78D768E1829F7D163397B75946C8419040021F904090A0034002C010004001C0012000006FE409A7048A4058EC8A272290C645498460313CA0498D840EA42180C082443C273C51619288209512820100383E2C3300F031B02BB000008FA066227656622177B000707898B0411230B767804057F8B7D7D8B060E1C844B012B036D89989900620F9E4A011AA2968A8C9A0914AA45AC94027CA57D710EB466012C7A9502C5C65F11101DB53498012F06A2C4C66E7220130198437EC500220A06C36D6E00030A10320BDC7FCD7FC5040121E02403A50616251513E5DDF598C5F5187C4860A141A07B09205470C100000101FE0034AB47C02180001E62384890C0010410145A64A3584E62B38AFE9A2CE0F0A082840E131694E165715BB355488E28916832080021F904090A0034002C000004001E0012000006FE409A704814068EC8A272490C645498460313CA04985863EA42180C082443C273CD
    2A19288209512820100383E2C330373704360050D8C7C527657622177A07070087005F11230B763401787D887B7B88710E1C8258012B039496978B620F9C4C011AA0898A8788086214A74BA9046DA2965E060EB276012C790502C3C4028C101DB34296912F06036CC5026E72201357CCCBC40034220A06C1C27D05031610328F00DB34EAEAC6000121DF24A204722512D78BC38BA2C303DC187C4860A1818183161240A8E0A20E0002EFF6B00348E021B7001E46384890C0010410325A60A3D86F594580DC8C2CE0F0A082840E131608F2637108B7944590245172534801100021F904090A0034002C020004001B0012000006F9409A70480C188FC4A4B29851611A0D4C2813585A6981D485301810488684A77A2532500413A25040200606C5875116063604040050D817E06127645722177A0707008800025E11230B6577048A7B96895D060E1C834A012B039596956F610F9D49011AA18889AD0003086114A8451A047DA37B8D700EB457012C790502C5C68D040D101DB534962F06036CC7026D6120130196438CC5000A06C3C4006B030A25320BDD0200CEECC594E0A35E06162512D903DEA196C5A11F092C343040D0420208155C300040A0D136580C237A18E12041020710405068B13014A5504222F2C3B280C3830A123A4C5840668FC776219DA53A6244493B9841000021F904090A0034002C0300040018001200000
    6E3409A70380C188FC4A49216C8A8308D062694092C9581D485301810488684C77A1532500413A25040200606C587510E6C080040212F28C0C327644A2217000707868802025E11230B4B768679948A5D060E1C82452B939493026F610F9B42011A89888796086114A54C1A789F7C8C700EAF582C046B8BBE8B8D101DA59406036CBF7DAD0A201301004300BE0006BC7ACA7E1610320B8BD0D2D2027806945D04712512CE0200039FC0000916D40606160A10152E0C8C9434ED00F0B88BE12041020710405068F14C20B47F0E010458C0E14105091D262C7806104FB47F448E20F9F830080021F904090A0034002C020003001A0013000006FE409A70480C188FC4A47218C8A8308D062694092CAF81D485301810480698C77A2532500413A25040200806C5875116063684B580BD1F180C0927645722176B000002887D0411230B657704050007079597025D060E1C8349012B039588A5970308800F9F451AA397A5A4087E0914AC4C1A04989796A77E0EB6582C2408B1A5026F11101DB7762F06037C02D37D712013B7A5220AD07A6C6B030A23120BA54389D30021DC5C00265E712515D8D4003489E8A31F0916A506160A205470C16040BA51C7340108E021860300091C400041A1450000041422BA374AD7A8000B383C9020A1C38405173B02182504E3CA8D768E1839F752D7B97B7594D8B34723080021F904050A003400
    2C010003001C0013000006FE409A7048A4058EC8A272290C645498460313CA0498D840EA42180C082403CC73C51619288209512820100483E2C3300F031B025BD0E60F0C060927656622176C050000028A055F11230B76787A8C07070097005E060E1C844B012B0389988A8A987F090FA04A011AA499A7A800088114AD45AF04A59A97A99DB866012C7A89B38A8F101DB944012F06BC0502D4D48E722013CDA734220A06037B7C6C030A231292DC428BD4000121DF245E08030006162515DAEC8C348BEC040030F890C0C22C0B09204870C16053BB7AA7A8D533E221868304091C400021A3C5150004044004E0AF5EC0804616707850414287090B3E9ADC44D25F4088CE901C21920C64094D7F40ED28215933080021F904090A0034002C010003001C00130000063E409A70482C1A8FC8A472C96C3A9FD0A7A0401308A2450100A0E5628505C0E1401B0306DFB4724B63A7C5E3B2F9BDAD03D4F8E49D9037E48D777F828378410021F904090F0034002C010003001C0013000006FE409A70480C188FC4A43219C8A8308D062694092CAFC240EA42180C082403CC63C52619288209512820100483E2C3300F031B025BD0E60F0C060927656622176C057C028B055F11230B7678048989000002975E060E1C844B012B037D000707A5A77F090F9F4A011AA399A79797A78114AD4C1A94B2B4B5009CB866012C246CA8A7A6A7111
    01DB9452F06A305BEB4722013CF34B4220AD27B6D6C030A231291DB9743988B0021DE245E080071162512D9DB8B99F9EB03001F092C00A2950042051775000C60E78FD6227F013CC47090200100082028B428334F404300DBFC11500820C0020E0F2A48E830610147912485CC230932CB11234934CD54B7CDCE0512903583000021F904090A0034002C010003001C0013000006FE409A7048A4058EC8A272290C645498460313CA0498D840EA42180C082403CC73C51619288209512820100483E2C3300F031B025BD0E60F0C060927656622176C057C028B055F11230B7678047D00000296025E060E1C844B012B036D000707A5A79B090F9F4A011AA3A596B3A7088114AD45AF94B2B3B27F0EB866012C7AA8A7A6A70411101DB944012F06B1BE967F0A2013CFB334220AD37B7C6C080A231291DC42978B000121DF245E085F722515DAEB983497EB04000C1F1258000408800208155C30003080DD005F8B1E1AF110C3170410145A5C0140401337861C431A59C0E18104091D262CD8F8D09FC47D2E2D41437284883591EAF6D959024027028D200021F904090F0034002C010003001C0013000006FE409A704814068EC8A27269CCA8308D0626940930AF81D485301810480698C77A2D32500413A25040200806C587511E063684B580BD1F180C0927646522176B057B028A055E11230B75770488000002958A5D060E1C83
    4B012B0305000707A4A6029A090F9E4A011A03A495B3A603088014AD45AF04B2B3B29A0EB965012CBDA5A6C8008D101DBA44012F06BDBF958C712013BAB342220A06B6886C6B030A23120BDC42968A00340121DF5CB65E0616251513EC973496ECB134187C4860E18F01001A124090E06259BB58B332B97BE7E19703082028B4080080402A6ECB3A8A34B280C3830A123A4C58C031562F80FD5E56DA85E4C8904A2E27F6DB59478904BB8941000021F904090A0034002C010003001C0013000006FE409A7048A4058EC8A272290C645498460313CA0498D840EA42180C082403CC73C51619288209512820100483E2C3300F031B025BD0E60F0C060927656622176C057C028B055F11230B7678047D00000296025E060E1C844B012B036D000707A5A79B090F9F4A011AA3A596B3A7088114AD45AF94B2B3B27F0EB866012C7AA8A7A6A70411101DB944012F06B1BE967F0A2013CFB334220AD37B7C6C080A231291DC42978B000121DF245E005F722515DAEB983497EB04000C1F12583030CB820208155C3098C76E80AF450E8D7888E12001000710405068710500014DDCE6791C696401870715247498B0A0A3437F11F7C1B4040DC91122D648AADB67670905009E3482000021F904090F0034002C010003001C0013000006FE409A70480C188FC4A43219C8A8308D062694092CAFC240EA42180C082403CC63C5261928820
    9512820100483E2C3300F031B025BD0E60F0C060927656622176C057C028B055F11230B7678048989000002975E060E1C844B012B037D000707A5A77F090F9F4A011AA399A79797A78114AD4C1A94B2B4B5009CB866012C246CA8A7A6A711101DB9452F06A305BEB4722013CF34B4220AD27B6D6C030A231291DB9743988B0021DE245E080071162512D9DB8B99F9EB03001F092C00A2950042051775000C60E78FD6227F013CC47090200100082028B428334F404300DBFC11500820C0020E0F2A48E830610147912485CC230932CB11234934CD54B7CDCE0512903583000021F904090A0034002C010003001C0013000006FE409A7048A4058EC8A272290C645498460313CA0498D840EA42180C082403CC73C51619288209512820100483E2C3300F031B025BD0E60F0C060927656622176C057C028B055F11230B7678047D00000296025E060E1C844B012B036D000707A5A79B090F9F4A011AA3A596B3A7088114AD45AF94B2B3B27F0EB866012C7AA8A7A6A70411101DB944012F06B1BE967F0A2013CFB334220AD37B7C6C080A231291DC42978B000121DF245E085F722515DAEB983497EB04000C1F1258000408800208155C30003080DD005F8B1E1AF110C3170410145A5C0140401337861C431A59C0E18104091D262CD8F8D09FC47D2E2D41437284883591EAF6D959024027028D200021F904090F0034002C0100
    03001C0013000006FE409A704814068EC8A27269CCA8308D0626940930AF81D485301810480698C77A2D32500413A25040200806C587511E063684B580BD1F180C0927646522176B057B028A055E11230B75770488000002958A5D060E1C834B012B0305000707A4A6029A090F9E4A011A03A495B3A603088014AD45AF04B2B3B29A0EB965012CBDA5A6C8008D101DBA44012F06BDBF958C712013BAB342220A06B6886C6B030A23120BDC42968A00340121DF5CB65E0616251513EC973496ECB134187C4860E18F01001A124090E06259BB58B332B97BE7E19703082028B4080080402A6ECB3A8A34B280C3830A123A4C58C031562F80FD5E56DA85E4C8904A2E27F6DB59478904BB8941000021F904090A0034002C02000300170014000006E3409A7048A4058EC8A29218C8A8308D062694092C8B81D485301810480698C77AA531500413A25040200806C587710D6C086B015B3F30181227644522176B057A0289055E11230B4A76048700000294895D060E1C8242012B0305000707A3A50299090F9D461A03A394B1A503087F14AC011A04B0B1B0990EB7582CBBA4A5C5008C101DB82F06BBBD94A2000A201364B134220A06B4876C089596128F34E1960121DBCF5DB189005695E1BB0C1F09D089F896E597A800461E31282570D0CE92BF72AF76ED32B280C3830AE6F01D04B0EBD5414F480AEA13E2EFE215731ECB28C
    12624080021F90409140034002C02000300180013000006E9409A704814068EC8A2B218C8A8308D062694092C9581D485301810480698C77A1532500413A25040200806C587510E6C086B015B3F30181227644A221708008702897C0411230B4A8791000F1188895D060E1C823400049F9F0F040D9500977D090F9C9D92A09507A603087F14AB34019E030F5E0D00B002980EB59004879F03AFB18C101DAB00030006001212D088057D0A2013649200220AD2966DD80A23128F9D8A00B721E187B25E06162515DCEAA6C0EC0C1F927E1A092048704187553E68463C1C4A90C0010410145A707AE689A291051C1E5490D061C20267C5AC314172E40A3B7665CA04010021F904090F0034002C02000300180013000006E9409A704814068EC8A2B218C8A8308D062694092C9581D485301810480698C77A1532500413A25040200806C587510E6C086B015B3F30181227644A22176B050088027C0411230B4B018892000F11008A5D060E1C82430004A0A00F040D960203087F0F9D46939FA0A6087D0914AC34011A88A2A00D97990EB5582C9FBA5DB18C101DB69104921212CD7C7120136492428806A892026B030A23128F34978A00B7210A0688A85E06162515D5E402E503E70C1F937E160910122EE8904B74EADC2D0F881224700001848C169D00DC6B76CFC8020E0F2A48E83061012B62F70C0E419264C939916596040100
    21F904050F0034002C01000300180013000006EE409A704814068EC8A2B218C8A8308D062694092C9581D485301810480698C77A1532500413A25040200806C587510E6C086B015B3F30181227644A22176B057A0089055E11230B4B76048993000F0D005D060E1C8243012B0004A2A20F0411977D090F9D461A0394A1A21100087F14AC34011A9207B1A504A89AB7582C248992B1A6A111101DB8012F06A1931212927D0A2013649342220A8979936D0A23128F340002EB00B9210A06C85D700A2515DBE902EA02AF340C1F092819B0A00042051774D2255AD72F978711891238800082428B4E98A6350CB080C3830A123A4C58C04A632226488E5C69D7AE4C99200021F904090F0034002C0100030018001300000644409A70482C1A8FC8A472C96C3A9F4E8110F02C50878047E3BA1C7069840781B6854E8584C897490D83CBCD03607C25C09784F95992771A68575280668485868788894A410021F904050F0034002C01000300170013000006EB409A7048A4058EC8A29218C8A8308D062694092C8B81D485301810480698C77AA531500413A25040200806C587710D6C086B015B3F30181227644522176B057A0289008B11230B4A76047B8B94000F0D000E1C8242012B036C0004A3A30F0411980F9C461AA0000795A2A3110014AB011A92AF94A5A398B6582C78AFB0048B5C03B41DB72F06AEA294121203002013649
    434220ACE088B7A059410328F34008902000121DC5C8B5E06162515D7E6E989C60C1F0916951609102AB8A063EE9B006A463CC470B0C8410910145A700240CD9831230B383CA820A1C38405ABA05103C004C9912B244996B912040021F904050F0034002C0C0008000B00080000062C409A505810028CC721E0D138268584C780D61C1AA191E7314A23540F00022DE9754EC734C9E0584C16D1B4200021F904050F0034002C0C0008000C00080000062F409A70381002868023F2D1381E94C2C183406B0E914242044A3B121E3482D548558A95006A97262128056B5A311E040021F904090F0034002C010003001900130000064E409A70482C1A8FC8A472C96C3A9FD023214203009E82EAD0FA685C9907EB90407B4CBDD1EA9530FD3AC3E4C780806E1E0E3482985D67AE6906001212036E4B0205620A256A698E8F9091929345410021F904090A0034002C03000300180012000006DA409A70380C188FC4A49216C8A8308D062694092C9581D485301810480698C77A1532500413A25040200806C587510E6C086B015B3F30181227644A22176B057A0289055E11230B4B76047B00000294025D060E1C82452B036C000707A2A499090F9D42011AA0A294B0A4087F14AA4C1A92AFB0AF7D0E94582C78A5A4A3A40411959644B006AEBB947DB0890042C996CD797A6B08D6899695C903000624E2005E7125D2DFEB04000916
    BB160A10DDD334E7F9E231BE000E102028B458A70C803B7700022CE0F0A082840E131658B146AD1A3E2247900C812524080021F904090A0034002C030003001A0013000006EC409A70280C188FC4A47218C8A8308D062694092CAF81D485301810480698C77A2532500413A25040200806C587512E6E086B015B3F30181227645722176B057A0289055E11230B6501778787000002955D060E1C8249012B037B000707A3A57D090F9D44011AA197A59595A57F14AB4C9594B1B2B40EB657969705A6A5A4A511101DB734C1B297B2B2712013B7C1898900936D8B0A23128FCC954295D895045CE606162512D4CCD700EFD7D806D00910152E740003D803E4E500C47090A0120410145A90014040C03F71D6000458C0E14105091D262C58F88F00BF78E3C41539622409268620EBD4890732080021F90409140034002C04000300180013000006E7409A7018281A87C824329051611A0D4C2813505A03A90B613020900C304FD53A64A0082644A18040100C8A0F834C0B6C086AC15A3F30181227634A22176A057A0202008B0411230B57777B878B0D0F8B98004A012B037B8A001111040F5BA69A4B1A9E890007000DA7999B1A04878AAEA3A45D001482442C7894AEB0BB000300BE42012F069E948C1212000A0004A849220ACD796B980A10328B34984421DA5B03088B06162515135500898A651F09167E9910152E73C6ACC78
    87888E1204182452028B418534DC031714416707850414287090B181EB3167093912249166DBC46878C265441000021F904090F0034002C04000300180013000006E5409A7018281A87C824329051611A0D4C2813505A03A90B613020900C304FD53A64A0082644A18040100C8A0F834C0B6C086AC15A3F30181227634A22176A057A02008A5D11230B57777B87000D0F8A970082442B037B891111040F5C5B04004A011A9D939404AE9899A81A04878900A1A2AF0E149A42012C78AC0D5B038B001DBD752F06ABB604121297A6C934220ACC86B6000316108A42974421D7C4088A0616251513550002EFA7420C1F09117E9810152E73DBF0C5441E469448904011080A2DC6002020A0D837220B383CA820A1C384050A8B99FA878A81915EC64CD11949E354BC200021F904050F0034002C05000300170013000006EC409A7018281A87C82431A3C2341A985026A054065217C260402019601E6A55C840114C884201812018141FC638B021A4056AFCC060489CC449221769050200877A0411230B56758505000D0F8795000E1C8042012B036A001111040F045AA5000F9A34011A9E860DA50496000914AAAC049FA2A3A700060EB649012C7691B0BDB211101DB72F06B99104121295B22013AA34220A06036995690387128D954421DC5AE2006E162515D80002F300430C1F091106960910152E0C000CA0278E88871125121C
    2A0182420B2AEC04ACAB476401870715247498B000A2385905AD14615004C9A18F14C7A8AC4731080021F904090F0034002C0500030017001300000645409A70482C1A8FC8A472C96C3A9F3480500015021A0FE9106060022234C28340042496577294D84547C8E3E8C199B686B54D0041B2BE2BE8420576235585868788898A46410021F904050F0034002C06000300170013000006E9409A7018281A87C82431A3C2341A985026A054065217C260402019601E6A55C840114C884201812018141FC638B021A4056AFCC060489CC449221708008502877A0411230B5675000D0F8593005B060E1C8042012B9016040F04A2A2957D0F9A34011A0011A39485087D14A8AA90A2A1048507A50EB349012CAC5C0385B9BB8A101DB42F060004121293B97B0A2013A834220ACD867885030A23128D934421DB33C4956E162515D7008800430C1F091694160910122E0C95872ACDDBE4218683420E4A80A0D0828A3301EA066E5AC0E14105091D262C70486C9A4424468E0CF9E6ECE3982AF30606010021F904050F0034002C060008000D000800000637401A0D00A01504C2A410D07810934524D34278D00850C0001021609FC9C3B0E1B512C04BF26008C01EC44B8244F2FC2A9F88023B4F0B020021F904090A0034002C030003001A001300000657409A70482C1A8FC8A472C96C3A9FCF0BA200356E0885824028004003AB41167
    038900FCF80464CAE12BD05B2B70A10741167F4B3BE0500A842734C7C76764402804B7E767E825084858E4E848D6E8191964395999C45410021F904050A0034002C010004001C0012000006FA409A7048A4058EC8A272290C645498460313CA0498D840EA42180C082443C273C51619288209512820100383E2C3300F031B021B0028F0E36227656622177B07070088005F11230B7678047E897C7C89710E1C834B012B039496978C620F9C4A011AA08A8B8889086214A745A9937EA27F99B266012C7A0502C1C2028D101DB33496012F06036CC3026E72201301964300C200220A06BFC07E05031610320BD9C100C902E8040021DD24A204722512138CE903A2C1FB0C1F092C343040D0420208155C30004080D835460C2306F030C24182040E208090D1C2DA3E77FB8444DCA7CEC8020E0F2A48E8306141993F11B1254385E4881275258300003B
    i see that my header picture RTF have that text, that i don't need, but the image isn't drawed.

    so seems that i'm doing several errors.

    but before i continue is best ask: what is the RTF header for draw an image?


    • Edited by Cambalinho Friday, April 21, 2017 9:02 PM
    Friday, April 21, 2017 9:01 PM

All replies

  • Hi Cambalinho,

    Please refer to the code below.

    Public Sub loadImage()
            Dim GetPicture As New OpenFileDialog
            GetPicture.Filter = "Bitmaps (*.bmp), GIFs (*.gif), JPEGs (*.jpg)|*.bmp;*.gif;*.jpg|Bitmaps (*.bmp)|*.bmp|GIFs (*.gif)|*.gif|JPEGs (*.jpg)|*.jpg"
            GetPicture.FilterIndex = 1
            GetPicture.InitialDirectory = "D:\"
            If GetPicture.ShowDialog = DialogResult.OK Then
                Dim SelectedPicture As String = GetPicture.FileName
                Dim img As Image = Image.FromFile(SelectedPicture)
                Clipboard.SetImage(img)
                rtb1.Paste()
            End If
        End Sub

    Hope it is helpful to you.

    Best regards,

    Cherry Bu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, April 24, 2017 7:07 AM
    Moderator
  • Hi Cambalinho,

    Please refer to the code below.

    Public Sub loadImage()
            Dim GetPicture As New OpenFileDialog
            GetPicture.Filter = "Bitmaps (*.bmp), GIFs (*.gif), JPEGs (*.jpg)|*.bmp;*.gif;*.jpg|Bitmaps (*.bmp)|*.bmp|GIFs (*.gif)|*.gif|JPEGs (*.jpg)|*.jpg"
            GetPicture.FilterIndex = 1
            GetPicture.InitialDirectory = "D:\"
            If GetPicture.ShowDialog = DialogResult.OK Then
                Dim SelectedPicture As String = GetPicture.FileName
                Dim img As Image = Image.FromFile(SelectedPicture)
                Clipboard.SetImage(img)
                rtb1.Paste()
            End If
        End Sub

    Hope it is helpful to you.

    Best regards,

    Cherry Bu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    i'm sorry,  but the Paste() method is limited: copy only the 1st frame of the image.
    Monday, April 24, 2017 10:18 AM
  • Displaying an animated GIF in a .NET RichTextBox control is problematic. See the below link for an alternative:

    https://www.codeproject.com/Articles/134358/TRichTextBox-A-universal-RichTextBox-which-can-dis


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Tuesday, April 25, 2017 12:17 PM
  • that project, i had tested(try it), have several problems too and it's C#.

    i'm working on OLE code, i think that i will get more lucky

    https://www.codeproject.com/Articles/12135/Inserting-images-into-a-RichTextBox-control-the-OL

    theres 1 nice way for change the frame on embeded picturebox(i'm testing the code).

    but i can't translate the code to VB .NET using a code translator, please readers don't use it, or you will get the same errors that i have.

    Tuesday, April 25, 2017 3:54 PM
  • Hi Cambalinho,

    You can use TelerikCodeConverter tool to convert C# into VB code.

    Tool link:

    http://converter.telerik.com/

    Best Regards,

    Cherry Bu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, May 4, 2017 9:50 AM
    Moderator
  • thanks for that
    Saturday, May 6, 2017 11:34 AM
  • before close these topic, need ask: where i can find a RTF tutorial for richtextbox?(yes. we know that some RTF isn't compatible with richtextbox, that's why i'm asking.. what is compatible and how use it?)
    Saturday, May 6, 2017 11:37 AM