?? cmsitemdefine.pas
字號:
+'\C'+xposstr +yposstr //X坐標 y坐標
+'\f'+ FontType //字體大小 1616,2424,3232
+inttostr(CmsTxt.FSize)+inttostr(CmsTxt.FSize) //字體
+'\b'+bgcolor //背景顏色
+'\s'+shcolor //前景顏色
+'\c'+transferTColorToCCCStr(CmsTxt.FColor) //字符顏色
//+fdistance //字符間距 //去掉字間距
+tmptxt;
content := Content +tmpstr;
end;
Result := content ;
end;
/////////////////////////////////////////////////////////////////////////////////
// 功能 :將字符串根據分隔符轉換到字符串數組中
/////////////////////////////////////////////////////////////////////////////////
procedure splitToList(sourceStr,splitStr:String; s:TStrings);
var
p,slen:integer;
ss,items:string;
begin
s.Clear;
ss:= sourceStr;
slen :=length(splitStr); //分解字符長度
p := pos(splitStr,ss);
while p>0 do
begin
items := copy(ss,1,p-1) ;
if trim(items)<>'' then s.Add(items);
delete(ss,1,p+slen-1);
p := pos(splitStr,ss);
end;
if trim(ss)<>'' then s.Add(ss);
end;
/////////////////////////////////////////////////////////////////////////////////
{
[list]
item_no=2
item0=200,1,2,\fk3232\C000000\c255255000000sadasdasdas
item1=200,1,2,\fk3232\C000000\c255255000000assssssssssssss
}
//將字符串類型轉換為情報板發送格式
/////////////////////////////////////////////////////////////////////////////////
function TurnStrToCmsPublishFormat(s:string) :TCMSPublishInfo;
var tmpstr,s1,str :string;
s_lists,s_listsc,s_listsx : TStringList;
leafcount,lastleafcount,bmpcount,txtcount :integer;
i,j,k,mpos,npos:integer;
CmsTxt :TCMSTXT;
CmsBmp :TCMSBMP;
Cmsleaf:TCMSDisplayLeaf;
CmsDisInfo :TCMSPublishInfo;
fonttype :string;
leafindex:integer;
begin
s_lists := TStringList.Create; //播放列表分組
s_listsc:= TStringList.Create; //處理換行文字部分
splitToList(s,#13#10,s_lists); //劃分為數組
leafcount := s_lists.count-2; //總的屏數
lastleafcount := leafcount;
leafindex := 1;
for i := 1 to leafcount do
begin
if i>cms_leaflen then Break; //大于最大值,跳出
tmpstr := s_lists.Strings[i+1]; //當前行的文字信息
bmpcount :=0;
txtcount :=0;
mpos := pos('\',tmpstr);
//首先計算前面一段 itemx=100,0,100,
//item0=aaaaaa,bb,cc,str 延遲時間,入屏方式,播放速度
s1 := copy(tmpstr,1,mpos-1);
//處理s1
mpos := pos('=',s1);
if mpos=0 then
begin
lastleafcount := lastleafcount-1;
Continue;
end;
s1 := copy(s1,mpos+1,length(s1));
mpos := pos(',',s1);
Cmsleaf.DelayTime := strtoint(copy(s1,1,mpos-1)); //延遲時間
delete(s1,1,mpos);
Cmsleaf.LeafID := i; //當前屏的序號
mpos := pos(',',s1);
Cmsleaf.PlayInMode := strtoint(copy(s1,1,mpos-1)); //入屏方式
delete(s1,1,mpos);
mpos := pos(',',s1);
Cmsleaf.PlaySpeed := strtoint(copy(s1,1,mpos-1)); //播放速度
//處理剩下的部分
s1 := copy(tmpstr,mpos,length(tmpstr));
splitToList(s1,'\C',s_listsc);
for j :=0 to s_listsc.Count-1 do
begin
s1 := s_listsc.Strings[j]; //000000\Bbbb ; 000000\fh1616\文字;
mpos := pos('\B',s1); //判斷是否圖片
if mpos>0 then
begin
bmpcount := bmpcount+1;
CmsBmp.X := strtoint(copy(s1,1,3)); //000
CmsBmp.Y := strtoint(copy(s1,4,3)); //000
npos := pos('\B',s1);
if npos>0 then begin
for k := 1 to 3 do CmsBmp.BmpName[k] := copy(s1,npos+2,3)[k]; //圖片名稱
end;
CmsBmp.Height :=0;
CmsBmp.Width :=0;
if bmpcount<=cms_bmplen then Cmsleaf.cmsbmpItem[bmpcount] := CmsBmp
else bmpcount := cms_bmplen;
end;
mpos := pos('\c',s1); //判斷文字 C021021\fh1616\c255000000000\W我愛你,我的老婆
if mpos>0 then
begin
txtcount := txtcount+1;
//背景顏色
npos := pos('\b',s1);
if npos>0 then CmsTxt.bColor := rgb(strtoint(copy(s1,npos+2,3)),
strtoint(copy(s1,npos+5,3)),
strtoint(copy(s1,npos+8,3)))
else CmsTxt.bColor := 0;
//陰影色
npos := pos('\s',s1);
if npos>0 then CmsTxt.sColor := rgb(strtoint(copy(s1,npos+2,3)),
strtoint(copy(s1,npos+5,3)),
strtoint(copy(s1,npos+8,3)))
else CmsTxt.sColor := 0;
//字符間距
npos := pos('\S',s1);
if npos>0 then CmsTxt.Fdistance := strtoint(copy(s1,npos+2,2))
else CmsTxt.Fdistance := 0;
//字體
npos := pos('\f',s1);
if npos>0 then
begin
fonttype := copy(s1,npos+2,1); //h,
CmsTxt.FSize := strtoint(Copy(s1,npos+3,2));
end
else
begin
fonttype :='h';
CmsTxt.FSize := 32; //默認值為32*32
end;
CmsTxt.FStype := 1;
if fonttype='h' then CmsTxt.FStype := 1;
if fonttype='k' then CmsTxt.FStype := 2;
if fonttype='s' then CmsTxt.FStype := 3;
//字符顏色
npos := pos('\c',s1);
if npos>0 then
begin
CmsTxt.FColor := rgb(strtoint(copy(s1,npos+2,3)),
strtoint(copy(s1,npos+5,3)),
strtoint(copy(s1,npos+8,3))) ;
str := trim(copy(s1,npos+14,length(s1)-npos-14+1));
end else begin
CmsTxt.FColor := 0;
str:='';
end;
{//文字部分
npos := pos('\S',s1);
if npos>0 then
begin
str := copy(s1,npos+4,length(s1));
str := AnsiReplaceStr(str,'\A',#13#10);
end else str :='';
}
CmsTxt.Txtcount := length(str);
CmsTxt.XPos := strtoint(copy(s1,1,3));
CmsTxt.YPos := strtoint(copy(s1,4,3));
for k := 1 to length(str) do CmsTxt.Txtstring[k] := str[k];
//CmsTxt.Txtstring :='';
if txtcount<=cms_txtlen then Cmsleaf.cmsTxtItem[txtcount] := CmsTxt
else txtcount := cms_txtlen;
end;
end;
Cmsleaf.BmpCount := bmpcount; //當前屏的圖片數量
Cmsleaf.TxtCount := txtcount; //當前屏的文字數量
CmsDisInfo.CMSPlayItems[leafindex] := Cmsleaf;
inc(leafindex);
end;
CmsDisInfo.CMSHeight := 0;
CmsDisInfo.CMSWidth := 0;
CmsDisInfo.LeafCount := lastleafcount;
CmsDisInfo.CMSPort := 0;
CmsDisInfo.CMSID := '0000000000';
result := CmsDisInfo;
s_lists.Free;
s_listsc.Free;
end;
////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////
function ReadFromTxtFile(fileName:string) :string;
var
f:textfile;
filestr:string;
tempch:char;
begin
AssignFile(f,fileName);
reset(f);
while not eof(f) do
begin
read(f,tempch);
filestr:=filestr+tempch;
end;
CloseFile(F);
result := filestr;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -