■ Labelのキャプションを書き換える方法
配置したラベルのキャプションを書き換える場合には次のようにします。
なお配置したラベルへの文字列代入は次のようにします。
char str[] = "Microtechnica"; strcpy(Label1_Caption, str);
代入にはstrcpy関数を使います。
書き換える場合には一度スクリーンの背景色(Screenx.Color)で文字列を上書きして文字列を見えなくし、その上に新たにテキストを別の色で描画して書き換えます。
void Clear_Label1() { unsigned saved_color; saved_color = Label1.Font_Color; Label1.Font_Color = Screen1.Color; DrawLabel(&Label1); Label1.Font_Color = saved_color;
}
void main(){
Clear_Label1(); strcpy(Label1_Caption, str); DrawLabel(&Label1);
}
|