午夜在线视频一区二区-亚洲一区成人免费电影-超碰欧美一区二区三区-大香蕉大香蕉日本大香蕉

| 項(xiàng)目咨詢 |積分體系 | 加入收藏 | 設(shè)為首頁(yè) | RSS
您當(dāng)前的位置:首頁(yè) > 市場(chǎng) > 百科 > 技術(shù) > 夸父專(zhuān)欄

基于RICHVIEW的EMR開(kāi)發(fā)文檔十一

時(shí)間:2013-10-08 20:45:39  來(lái)源:  作者:
更多

 http://blog.sina.com.cn/game7788

   夸父
段落縮進(jìn)
在輸入文字的過(guò)程中,如果按下回車(chē)鍵,新成生的段落會(huì)與當(dāng)前段落對(duì)齊,下面例子只處理了回車(chē),如果要實(shí)現(xiàn)自動(dòng)換行時(shí)也達(dá)到同樣效果,可以在其文字錄入事情中作相同處理!
實(shí)現(xiàn)過(guò)程主要是通得到當(dāng)前光標(biāo)所在段落(行)前面的空格數(shù),然后在新段落頭中插入同相的數(shù)目的空格
function GetLeadingSpacesCount(rve: TCustomRichViewEdit): Integer; 
var StartItemNo, ItemNo, i: Integer; 
    s: String; 
begin 
  rve := rve.TopLevelEditor; 
  ItemNo := rve.CurItemNo; 
  while not rve.IsParaStart(ItemNo) do 
    dec(ItemNo); 
  Result := 0; 
  StartItemNo := ItemNo; 
  while ItemNo
    if (ItemNo>StartItemNo) and rve.IsParaStart(ItemNo) then 
      exit; //如果在段落頭則不處理
    if rve.GetItemStyle(ItemNo)<0 then //如果不是文字也不處理
      exit; 
    s := rve.GetItemText(ItemNo); 
    for i := 1 to Length(s) do 
      if s[i]=' ' then 
        inc(Result) //計(jì)算空格數(shù)
      else 
        exit; 
    inc(ItemNo); 
  end; 
end; 
//通過(guò)空格數(shù)返回字符個(gè)數(shù),空格也是字符
function GetSpaces(Count: Integer): String; 
var i: Integer; 
begin 
  SetLength(Result, Count); 
  for i := 1 to Count do 
    Result[i] := ' '; 
end;
 
最后在KeyDown下面實(shí)現(xiàn)
 if Key=VK_RETURN then begin 
    RichViewEdit1.InsertText(#13+GetSpaces(GetLeadingSpacesCount(RichViewEdit1))); 
    Key := 0; 
  end; 
來(lái)頂一下
返回首頁(yè)
返回首頁(yè)
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
欄目更新
欄目熱門(mén)