Загрузить RTF текст из файла ресурса в TRichEditDelphi , Файловая система , РесурсыЗагрузить RTF текст из файла ресурса в TRichEdit
Оформил: DeeCo (* Load RTF file from resource: You can store any kind of file as a RCDATA resource. The following example shows this with an RTF file. Create a text file called textres.rc and put the following line in it: TESTDOC RCDATA "textdoc.rtf" Next, compile that using the Borland Resource Compiler, which is provided with Delphi. brcc32.exe textres.rc Your next step is to include the compiled resource (.RES) file into your executable, which can be done with the {$R} compiler directive. *) (* Man kann eine beliebige Datei als RCDATA Ressource in eine Exe-Datei einbinden. Das folgende Beispiel zeigt, wie man einen RTF-Text aus einer Ressource ladt und in einem TRichEdit anzeigt. Erstelle zuerst eine Datei "textres.rc" mit folgendem Inhalt: TESTDOC RCDATA "textdoc.rtf" Kompiliere diese mit brcc32.exe: brcc32.exe textres.rc Es wurde nun eine textres.res Datei erzeugt. *) implementation {$R *.dfm} {$R textres.res} // <---- your resource file! procedure TForm1.Button1Click(Sender: TObject); var rs: TResourceStream; begin rs := TResourceStream.Create(hinstance, 'TESTDOC', RT_RCDATA); try Richedit1.PlainText := False; TempStream.Position := 0; Richedit1.Lines.LoadFromStream(rs); finally rs.Free; end; end; Статья Загрузить RTF текст из файла ресурса в TRichEdit раздела Файловая система Ресурсы может быть полезна для разработчиков на Delphi и FreePascal. Комментарии и вопросыМатериалы статей собраны из открытых источников, владелец сайта не претендует на авторство. Там где авторство установить не удалось, материал подаётся без имени автора. В случае если Вы считаете, что Ваши права нарушены, пожалуйста, свяжитесь с владельцем сайта.
|
||||
©KANSoftWare (разработка программного обеспечения, создание программ, создание интерактивных сайтов), 2007 |