如何在label中显示指定位置文档的内容,在线等!
在Form的Oncreate里写
Label1-> Caption.后面就不会了...我实在查不到啊,急用,拜托各位兄弟了!!!
[解决办法]
呵呵,直接在Oncreate里面加入:
Label1-> Caption = "D:\\1.txt ";
就可以了
[解决办法]
//---------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h "
//---------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm "
TForm1 *Form1;
//---------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
if( OpenDialog1-> Execute() )
Edit1-> Text = ExtractFilePath(OpenDialog1-> FileName);
}
//---------------------------------------
[解决办法]
加个Memo控件 Memo1
Memo1-> Visiable=false;
Memo1-> Clear();
Memo1-> Text-> LoadFromFile( "D:\\1.txt ");
Label1-> Caption=Memo1-> Text;
Memo1-> Clear();
希望楼下有更好的方法