国产黄色免费网站,人人干人人干人人干,免费大黄网站在线看,国产情侣一区二区三区,99精品国产福利免费一区二区,国产亚洲成归v人片在线观看,伊人88

2023信創(chuàng)獨(dú)角獸企業(yè)100強(qiáng)
全世界各行各業(yè)聯(lián)合起來(lái),internet一定要實(shí)現(xiàn)!

讓彩色光標(biāo)出現(xiàn)在Delphi程序中

2004-02-14 eNet&Ciweek

  在Delphi中用Loadcursor()得到的光標(biāo)只有黑白兩色,怎樣在程序中得到彩色光標(biāo)呢?筆者嘗試制作了以下程序:

    方法一 用Loadcursorfromfile()從外部調(diào)入圖標(biāo)作為光標(biāo)

    Loadcursorfromfile()函數(shù)可以讀*CUR,*ICO,*ANI為后綴的文件作為光標(biāo),其中ICO為彩色圖標(biāo)格式(可用Image Editor制作),ANI為動(dòng)畫光標(biāo)格式。以下為打開一圖標(biāo)作為光標(biāo)的演示程序段,當(dāng)光標(biāo)移動(dòng)到測(cè)試區(qū)域內(nèi)光標(biāo)會(huì)變成選定的圖案;

    {設(shè):opendialog1:Topendialog;Bitbtn1:Tbitbtn}

    procedure TForm1.BitBtn1Click(Sender:Tobject);

    var tt:pchar;size:integer;s:string;

    begin

    if opendialog1.Execute then

    begin

    size:=length(opendialog1.filename);

    getmem(tt,size);

    s:=opendialog1.filename;

    strpcopy(tt,s);

    screen.cursors[2]:=loadcursorfromfile(tt);

    bf.cursor:=2;

    freemem(tt,size);

    end;

    end;

    方法二 從資源文件加載彩色光標(biāo)

    用方法一發(fā)送程序時(shí)必須包含*CUR文件,因而從資源文件中加載彩色光標(biāo)是更可行的方法。用圖標(biāo)存放彩色光標(biāo),使用時(shí)把圖標(biāo)存入臨時(shí)文件,用Loadcursorfromfile()從臨時(shí)文件讀出彩色光標(biāo)。

    程序段:

    procedure ZloadfromResourse(screenindex:integer;name:Pchar);

    var td:ticon;

    begin

    try

    td:=ticon.Create;

    td.Handle:=LoadIcon(Hinstance,name);

    td.SaveToFile(′temp.cur′);

    screen.Cursors[screenindex]:=loadcursorfromfile(′temp.cur′);

    deletefile(′temp.cur′);

    finally

    td.free;

    end;

    end;

    此程序把名字為name的圖標(biāo)變?yōu)樾蛱?hào)為screenindex的光標(biāo);

    例:

    ZloadfromResourse(2,′myicon′);

    Form1.cursor:=2;

    注意:′myicon′這個(gè)圖標(biāo)一定要在資源文件中,否則會(huì)出現(xiàn)異常。

相關(guān)頻道: eNews

您對(duì)本文或本站有任何意見,請(qǐng)?jiān)谙路教峤?,謝謝!

投稿信箱:tougao@enet16.com