聊天軟體 遇到困雖了 |
尚未結案
|
阿峰
一般會員 發表:1 回覆:1 積分:0 註冊:2005-04-14 發送簡訊給我 |
目前做的 能連線 能對話
但是表情符號上就怪怪的 能顯示出來了 但是會有問題
圖的位置錯勿,還有只能顯現一個表情 不知道要怎麼改才好~"~
請大大們教我 或是能提供我一個範例嗎???拜托 //把訊息中的表情變成圖
procedure TForm1.ShowMessage(Msg:String); var i,nu:integer; Posnu:integer; BMP:TBitmap; SS:TStringStream; const Picnu:array[0..9] of string=('<#0#>','<#1#>','<#2#>', '<#3#>','<#4#>','<#5#>','<#6#>','<#7#>','<#8#>','<#9#>'); begin For i:= 0 to 9 do begin Posnu:=Pos(picnu[i],Msg); if Posnu <> 0 then begin RichEdit1.Text:=RichEdit1.Text Copy(Msg,1,Posnu-1); Delete(Msg,1,Posnu 4); //顯示表情 BMP:=TBitmap.Create; BMP.LoadFromFile('Pictures\' inttostr(i) '.bmp'); SS := TStringStream.Create(BitmapToRTF(BMP)); AddImage(RichEdit1,SS); SS.Free; BMP.Free; GoBottom(RichEdit1); end; end; RichEdit1.Text:=RichEdit1.Text #13#10; end; |
ko
資深會員 發表:28 回覆:785 積分:444 註冊:2002-08-14 發送簡訊給我 |
|
阿峰
一般會員 發表:1 回覆:1 積分:0 註冊:2005-04-14 發送簡訊給我 |
|
暗黑破壞神
版主 發表:9 回覆:2301 積分:1627 註冊:2004-10-04 發送簡訊給我 |
|
boson
中階會員 發表:74 回覆:155 積分:85 註冊:2004-07-31 發送簡訊給我 |
這樣試試看 :
i:=Pos('<#', Msg); while (i > 0) do begin if (i 2 <= length(Msg)) and (Msg[i 2] in ['0'..'9']) and (copy(Msg,i 3,2) = '#>') then begin RichEdit1.Text:=RichEdit1.Text Copy(Msg,1,i-1); BMP:=TBitmap.Create; Try BMP.LoadFromFile('Pictures\' Msg[i 2] '.bmp'); SS := TStringStream.Create(BitmapToRTF(BMP)); AddImage(RichEdit1,SS); finally BMP.Free; end; GoBottom(RichEdit1); Msg:=copy(Msg,i 5,length(Msg)); end else begin RichEdit1.Text:=RichEdit1.Text Copy(Msg,1,i 1); Msg:=copy(Msg,i 2,length(Msg)); end; i:=Pos('<#', Msg); end;我隨便寫寫, 沒 compile 過, 不知道正不正確 ? 若有一點小錯誤, 請自行修正 同時, 建議將 BMP 移到 while 迴圈外面來 create, 效率高得多 發表人 - boson 於 2005/05/10 23:25:08 |
ko
資深會員 發表:28 回覆:785 積分:444 註冊:2002-08-14 發送簡訊給我 |
|
Ktop_Robot
站務副站長 發表:0 回覆:3511 積分:0 註冊:2007-04-17 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |