⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 richedit2.pas

📁 类似QQ的源码程序
💻 PAS
📖 第 1 页 / 共 5 页
字号:
  if RichEdit.FVer10 then
    Exit;
  InitFormat(Format);
  with Format do
  begin
    dwMask := CFM_SUPERSCRIPT;
    dwEffects := Ord(Value) shl 16;
  end;
  SetAttributes(Format);
end;

function TTextAttributes98.GetOffset: Double;
var
  Format: TCharFormat2W;
begin
  if RichEdit.FVer10 then
    begin
      Result:= 0;
      Exit;
    end;
  GetAttributes(Format);
  Result := Format.yOffset/20;
end;

procedure TTextAttributes98.SetOffset(Value: Double);
var
  Format: TCharFormat2W;
begin
  if RichEdit.FVer10 then
    Exit;
  InitFormat(Format);
  with Format do
  begin
    dwMask := CFM_OFFSET;
    yOffset := Round(Value*20);
  end;
  SetAttributes(Format);
end;

function TTextAttributes98.GetSpacing: Double;
var
  Format: TCharFormat2W;
begin
  if RichEdit.FVer10 then
    begin
      Result:= 0;
      Exit;
    end;
  GetAttributes(Format);
  Result := Format.sSpacing/20;
end;

procedure TTextAttributes98.SetSpacing(Value: Double);
var
  Format: TCharFormat2W;
begin
  if RichEdit.FVer10 then
    Exit;
  InitFormat(Format);
  with Format do
  begin
    dwMask := CFM_SPACING;
    sSpacing := Round(Value*20);
  end;
  SetAttributes(Format);
end;

function TTextAttributes98.GetKerning: Double;
var
  Format: TCharFormat2W;
begin
  if RichEdit.FVer10 then
    begin
      Result:= 0;
      Exit;
    end;
  GetAttributes(Format);
  Result := Format.wKerning/20;
end;

procedure TTextAttributes98.SetKerning(Value: Double);
var
  Format: TCharFormat2W;
begin
  if RichEdit.FVer10 then
    Exit;
  InitFormat(Format);
  with Format do
  begin
    dwMask := CFM_KERNING;
    wKerning := Round(Value*20);
  end;
  SetAttributes(Format);
end;

function TTextAttributes98.GetUnderlineType: TUnderlineType;
var
  Format: TCharFormat2W;
begin
  if RichEdit.FVer10 then
    begin
      Result:= TUnderlineType(fsUnderline in FOldAttr.Style);
      Exit;
    end;
  GetAttributes(Format);
  if (Format.dwEffects and Integer(CFE_UNDERLINE)) <>0 then
    Result := TUnderlineType(Format.bUnderlineType)
  else
    Result:= ultNone;
end;

procedure TTextAttributes98.SetUnderlineType(Value: TUnderlineType);
var
  Format: TCharFormat2W;
begin
  if RichEdit.FVer10 then
    begin
      if Value=ultNone then
        FOldAttr.Style:= FOldAttr.Style-[fsUnderline]
      else
        FOldAttr.Style:= FOldAttr.Style+[fsUnderline];
      Exit;
    end;
  InitFormat(Format);
  with Format do
  begin
    dwMask := CFM_UNDERLINETYPE;
    bUnderlineType := Byte(Value);
  end;
  SetAttributes(Format);
end;

function TTextAttributes98.GetAnimation: TAnimationType;
var
  Format: TCharFormat2W;
begin
  if RichEdit.FVer10 then
    begin
      Result:= aniNone;
      Exit;
    end;
  GetAttributes(Format);
  Result := TAnimationType(Format.bAnimation);
end;

procedure TTextAttributes98.SetAnimation(Value: TAnimationType);
var
  Format: TCharFormat2W;
begin
  if RichEdit.FVer10 then
    Exit;
  InitFormat(Format);
  with Format do
  begin
    dwMask := CFM_ANIMATION;
    bAnimation := Byte(Value);
  end;
  SetAttributes(Format);
end;

function TTextAttributes98.GetBold: Boolean;
var
  Format: TCharFormat2W;
begin
  if RichEdit.FVer10 then
    begin
      Result:= fsBold in FOldAttr.Style;
      Exit;
    end;
  GetAttributes(Format);
  Result := Format.dwEffects and CFE_BOLD <>0;
end;

procedure TTextAttributes98.SetBold(Value: Boolean);
var
  Format: TCharFormat2W;
begin
  if RichEdit.FVer10 then
    begin
      if Value then
        FOldAttr.Style:= FOldAttr.Style+[fsBold]
      else
        FOldAttr.Style:= FOldAttr.Style-[fsBold];
      Exit;
    end;
  InitFormat(Format);
  with Format do
  begin
    dwMask := CFM_BOLD;
    if Value then
      dwEffects:= CFE_BOLD;
  end;
  SetAttributes(Format);
end;

function TTextAttributes98.GetItalic: Boolean;
var
  Format: TCharFormat2W;
begin
  if RichEdit.FVer10 then
    begin
      Result:= fsItalic in FOldAttr.Style;
      Exit;
    end;
  GetAttributes(Format);
  Result := Format.dwEffects and CFE_ITALIC <>0;
end;

procedure TTextAttributes98.SetItalic(Value: Boolean);
var
  Format: TCharFormat2W;
begin
  if RichEdit.FVer10 then
    begin
      if Value then
        FOldAttr.Style:= FOldAttr.Style+[fsItalic]
      else
        FOldAttr.Style:= FOldAttr.Style-[fsItalic];
      Exit;
    end;
  InitFormat(Format);
  with Format do
  begin
    dwMask := CFM_ITALIC;
    if Value then
      dwEffects:= CFE_ITALIC;
  end;
  SetAttributes(Format);
end;

function TTextAttributes98.GetStrikeOut: Boolean;
var
  Format: TCharFormat2W;
begin
  if RichEdit.FVer10 then
    begin
      Result:= fsstrikeOut in FOldAttr.Style;
      Exit;
    end;
  GetAttributes(Format);
  Result := Format.dwEffects and CFE_STRIKEOUT <>0;
end;

procedure TTextAttributes98.SetStrikeOut(Value: Boolean);
var
  Format: TCharFormat2W;
begin
  if RichEdit.FVer10 then
    begin
      if Value then
        FOldAttr.Style:= FOldAttr.Style+[fsStrikeout]
      else
        FOldAttr.Style:= FOldAttr.Style-[fsStrikeout];
      Exit;
    end;
  InitFormat(Format);
  with Format do
  begin
    dwMask := CFM_STRIKEOUT;
    if Value then
      dwEffects:= CFE_STRIKEOUT;
  end;
  SetAttributes(Format);
end;

function TTextAttributes98.GetSmallCaps: Boolean;
var
  Format: TCharFormat2W;
begin
  if RichEdit.FVer10 then
    begin
      Result:= False;
      Exit;
    end;
  GetAttributes(Format);
  Result := Format.dwEffects and CFE_SMALLCAPS <>0;
end;

procedure TTextAttributes98.SetSmallCaps(Value: Boolean);
var
  Format: TCharFormat2W;
begin
  if RichEdit.FVer10 then
    Exit;
  InitFormat(Format);
  with Format do
  begin
    dwMask := CFM_SMALLCAPS;
    if Value then
      dwEffects:= CFE_SMALLCAPS;
  end;
  SetAttributes(Format);
end;

function TTextAttributes98.GetAllCaps: Boolean;
var
  Format: TCharFormat2W;
begin
  if RichEdit.FVer10 then
    begin
      Result:= False;
      Exit;
    end;
  GetAttributes(Format);
  Result := Format.dwEffects and CFE_ALLCAPS <>0;
end;

procedure TTextAttributes98.SetAllCaps(Value: Boolean);
var
  Format: TCharFormat2W;
begin
  if RichEdit.FVer10 then
    Exit;
  InitFormat(Format);
  with Format do
  begin
    dwMask := CFM_ALLCAPS;
    if Value then
      dwEffects:= CFE_ALLCAPS;
  end;
  SetAttributes(Format);
end;

function TTextAttributes98.GetHidden: Boolean;
var
  Format: TCharFormat2W;
begin
  if RichEdit.FVer10 then
    begin
      Result:= False;
      Exit;
    end;
  GetAttributes(Format);
  Result := Format.dwEffects and CFE_HIDDEN <>0;
end;

procedure TTextAttributes98.SetHidden(Value: Boolean);
var
  Format: TCharFormat2W;
begin
  if RichEdit.FVer10 then
    Exit;
  InitFormat(Format);
  with Format do
  begin
    dwMask := CFM_HIDDEN;
    if Value then
      dwEffects:= CFE_HIDDEN;
  end;
  SetAttributes(Format);
end;

function TTextAttributes98.GetOutline: Boolean;
var
  Format: TCharFormat2W;
begin
  if RichEdit.FVer10 then
    begin
      Result:= False;
      Exit;
    end;
  GetAttributes(Format);
  Result := Format.dwEffects and CFE_OUTLINE <>0;
end;

procedure TTextAttributes98.SetOutline(Value: Boolean);
var
  Format: TCharFormat2W;
begin
  if RichEdit.FVer10 then
    Exit;
  InitFormat(Format);
  with Format do
  begin
    dwMask := CFM_OUTLINE;
    if Value then
      dwEffects:= CFE_OUTLINE;
  end;
  SetAttributes(Format);
end;

function TTextAttributes98.GetShadow: Boolean;
var
  Format: TCharFormat2W;
begin
  if RichEdit.FVer10 then
    begin
      Result:= False;
      Exit;
    end;
  GetAttributes(Format);
  Result := Format.dwEffects and CFE_SHADOW <>0;
end;

procedure TTextAttributes98.SetShadow(Value: Boolean);
var
  Format: TCharFormat2W;
begin
  if RichEdit.FVer10 then
    Exit;
  InitFormat(Format);
  with Format do
  begin
    dwMask := CFM_SHADOW;
    if Value then
      dwEffects:= CFE_SHADOW;
  end;
  SetAttributes(Format);
end;

function TTextAttributes98.GetEmboss: Boolean;
var
  Format: TCharFormat2W;
begin
  if RichEdit.FVer10 then
    begin
      Result:= False;
      Exit;
    end;
  GetAttributes(Format);
  Result := Format.dwEffects and CFE_EMBOSS <>0;
end;

procedure TTextAttributes98.SetEmboss(Value: Boolean);
var
  Format: TCharFormat2W;
begin
  if RichEdit.FVer10 then
    Exit;
  InitFormat(Format);
  with Format do
  begin
    dwMask := CFM_EMBOSS;
    if Value then
      dwEffects:= CFE_EMBOSS;
  end;
  SetAttributes(Format);
end;

function TTextAttributes98.GetImprint: Boolean;
var
  Format: TCharFormat2W;
begin
  if RichEdit.FVer10 then
    begin
      Result:= False;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -