アプリ(中級)
| アプリ(入門) | Tips | ダウンロード | プログラム
| コラム

CBアプリ工房


ホーム > Tips [ 1 | 2 | 3 | OneLine1 ]  

Borland C++Builder 一行 Tips1

更新 : 2009/01/29

 



OneLine Tips (30)

●
フォームの背景色を赤にする
    Form1->Color = clRed;

●Image1 をクリアする
     Image1->Picture = NULL;

●フィルタの設定
    OpenDialog1->Filter = "テキストファイル (*.txt) | *.txt | 全てのファイル (*.*) | *.*";

●フォルダを削除する
    RemoveDir ("C:\\test")

●来月を返す
    TDate nextMonth = IncMonth(Now(), 1);


●棒グラフにデータを追加する
    Series1->Add(85, "数学" , clRed);

●メモリリークの不具合を回避する
    CheckListBox1->Clear();

●Memo1 の幅と高さを減らす
    InflateRect(&RECT(Memo1->ClientRect), -10, -10);

●4 番目のアイコンを取り出す
    ExtractIconEx("shell32.dll", 4, &icon32, &icon16, 1);

●コントロールのサイズを 20% 大きくする
     ScaleBy(120, 100);

●指定したバイト数を別のストリームへコピーする
    memory_stream2->CopyFrom(memory_stream, 10);


●アスキーコードを返す
    int ii = putchar('Z');

●メモリ解放のいらない Image 配列を宣言
   
vector<auto_ptr<TImage> > sImage;

●レポートファイルを読み込む
     QRPrinter()->Load("REPORT.QRP");

●文字列を 64 ビット整数に変換
     __int64 srcNum = _atoi64("10000000000000");


●FD の空き容量を取得
     int fd_free = DiskFree(1);

●OS のバージョンを取得する
    ShowMessage(Win32Platform);

●メモ帳に文字列を送る
    SendMessage(chwnd, WM_SETTEXT, 0, (LPARAM)("処理終了です!"));

●指定された数の文字を削除
    str.Delete(str.Length()-1, 2);

●ミューテックス オブジェクトを作成
    HANDLE hMutex = CreateMutex(NULL, true, "UniqueName");

●インストールされている Font を格納
    ListBox1->Items->Assign(Screen->Fonts);

●Objects に TColor を記録
    StringGrid1->Objects[2][1] = (TObject*)StringGrid1->Canvas->Font->Color;

●Windows を終了
    ExitWindowsEx(EWX_SHUTDOWN, 0);

●ポインタのクラス名を取得
    sprintf(buf, "My name is %s", typeid(*Test).name());

●Caption を複数行表示
    Params.Style |= BS_MULTILINE;

●ノード選択時のイメージを変更
    Node->SelectedIndex = Node->ImageIndex;

●二つ目と三つ目のパネル幅を固定
    StatusBar1->Panels->Items[0]->Width = ClientWidth - (120 + 50);

●Shift キーの押下を判定する
    if (Shift.Contains(ssShift)) ShowMessage("押された");

●アイコンの数を得る
    int num = (int)ExtractIcon(Handle, "shell32.dll", -1);

●関連づけられているプログラムを探す
    char file[256]; 
    FindExecutable("c:\\temp\\error.txt", NULL, file);



[ ホーム | ページトップ | 前へ | ブック | リンク | サイトマップ ]
Copyright(c) 2003 Shibu All rights reserved.