cxhinteditor.pas
来自「胜天进销存源码,国产优秀的进销存」· PAS 代码 · 共 453 行 · 第 1/2 页
PAS
453 行
end;
procedure TcxHintStyleEditor.cxcbHintRoundedPropertiesChange(Sender: TObject);
begin
cxHsc.HintStyle.Rounded := cxcbHintRounded.Checked;
RefreshHint;
end;
procedure TcxHintStyleEditor.cxCbHintAniStylePropertiesChange(Sender: TObject);
begin
cxHsc.HintStyle.Animate := TcxHintAnimate(cxCbHintAniStyle.ItemIndex);
RefreshHint;
end;
procedure TcxHintStyleEditor.cxSeHintDelayPropertiesChange(Sender: TObject);
begin
cxHsc.HintStyle.AnimationDelay := Integer(cxSeHintDelay.Value);
RefreshHint;
end;
procedure TcxHintStyleEditor.cxCbHintIconTypeClick(Sender: TObject);
begin
cxHsc.HintStyle.IconType := TcxHintIconType(cxCbHintIconType.ItemIndex);
RefreshHint;
end;
procedure TcxHintStyleEditor.cxRbHIDefClick(Sender: TObject);
begin
cxHsc.HintStyle.IconSize := TcxHintIconSize(Integer(TcxRadioButton(Sender).Tag));
RefreshHint;
end;
procedure TcxHintStyleEditor.SetHsc(const Value: TCxHintStyleController);
begin
cxHsc.Assign(Value);
end;
procedure TcxHintStyleEditor.SetHintController(aDest: TCxHintStyleController);
begin
aDest.HintStyle.Assign(cxHsc.HintStyle);
aDest.HintShortPause := cxHsc.HintShortPause;
aDest.HintPause := cxHsc.HintPause;
aDest.HintHidePause := cxHsc.HintHidePause;
end;
procedure TcxHintStyleEditor.LoadHintCtrls;
function StyleToEditValue(aFontStyle : TFontStyles) : Integer;
begin
Result := 0;
if fsBold in aFontStyle then
Result := 1;
if fsItalic in aFontStyle then
Inc(Result,2);
if fsUnderline in aFontStyle then
Inc(Result,4);
if fsStrikeOut in aFontStyle then
Inc(Result,8);
end;
begin
cxCbStandard.Checked := cxHsc.HintStyle.Standard;
cxFnHint.FontName := cxHsc.HintStyle.Font.Name;
while not cxFnHint.Properties.LoadFontComplete do
Application.ProcessMessages;
cxCcbHintFontColour.ColorValue := cxHsc.HintStyle.Font.Color;
cxClbHintFontStyles.EditValue := StyleToEditValue(cxHsc.HintStyle.Font.Style);
cxFnHinCap.FontName := cxHsc.HintStyle.CaptionFont.Name;
while not cxFnHinCap.Properties.LoadFontComplete do
Application.ProcessMessages;
cxCcbHintCapColor.ColorValue := cxHsc.HintStyle.CaptionFont.Color;
cxClbHintCapFontStyles.EditValue := StyleToEditValue(cxHsc.HintStyle.CaptionFont.Style);
cxCcbHintColour.ColorValue := cxHsc.HintStyle.Color;
cxCbHintRounded.Checked := cxHsc.HintStyle.Rounded;
cxCbHintCalloutPos.ItemIndex := Ord(cxHsc.HintStyle.CallOutPosition);
cxSeHintRadius.Value := cxHsc.HintStyle.RoundRadius;
cxCbHintAniStyle.ItemIndex := Ord(cxHsc.HintStyle.Animate);
cxSeHintDelay.Value := Variant(cxHsc.HintStyle.AnimationDelay);
cxCbHintIconType.ItemIndex := Ord(cxHsc.HintStyle.IconType);
cxSeHintHidePause.Value := cxHsc.HintHidePause;
cxSeHintPause.Value := cxHsc.HintPause;
cxSeShortHintPause.Value := cxHsc.HintShortPause;
case Ord(cxHsc.HintStyle.IconSize) of
0: cxRbHiDef.Checked := True;
1: cxRbHiLarge.Checked := True;
2: cxRbHiSmall.Checked := True;
end;
cxLbhfSize.ItemIndex := cxLbhFSize.Items.IndexOf(IntToStr(cxHsc.HintStyle.Font.Size));
cxLbhcfSize.ItemIndex := cxLbhcFSize.Items.IndexOf(IntToStr(cxHsc.HintStyle.CaptionFont.Size));
End;
procedure TcxHintStyleEditor.cxSeHintHidePausePropertiesChange(
Sender: TObject);
begin
cxHsc.HintHidePause := cxSeHintHidePause.Value;
RefreshHint;
end;
procedure TcxHintStyleEditor.cxSeHintPausePropertiesChange(
Sender: TObject);
begin
cxHsc.HintPause := cxSeHintPause.Value;
RefreshHint;
end;
procedure TcxHintStyleEditor.cxSeShortHintPausePropertiesEditValueChanged(
Sender: TObject);
begin
cxHsc.HintShortPause := cxSeShortHintPause.Value;
RefreshHint;
end;
procedure TcxHintStyleEditor.cxCcbHintFontColourClick(Sender: TObject);
begin
cxHsc.HintStyle.Font.Color := cxCcbHintFontColour.ColorValue;
RefreshHint;
end;
procedure TcxHintStyleEditor.cxCcbHintCapColorClick(Sender: TObject);
begin
cxHsc.HintStyle.CaptionFont.Color := cxCcbHintCapColor.ColorValue;
RefreshHint;
end;
procedure TcxHintStyleEditor.cxLbHfSizeClick(Sender: TObject);
begin
with cxLbHfSize do
cxHsc.HintStyle.Font.Size := StrToInt(Items[ItemIndex]);
RefreshHint;
end;
procedure TcxHintStyleEditor.cxLbHcfSizeClick(Sender: TObject);
begin
with cxLbHcfSize do
cxHsc.HintStyle.CaptionFont.Size := StrToInt(Items[ItemIndex]);
RefreshHint;
end;
procedure TcxHintStyleEditor.cxFnHinCapPropertiesChange(
Sender: TObject);
begin
GetFontSizes(cxFnHinCap.FontName,cxLbHcfSize.Items);
end;
procedure TcxHintStyleEditor.cxFnHintPropertiesChange(Sender: TObject);
begin
GetFontSizes(cxFnHint.FontName,cxLbHfSize.Items);
end;
procedure TcxHintStyleEditor.RefreshHint;
begin
if HandleAllocated and IsWindowVisible(Handle) then
begin
cxHsc.HideHint;
cxHsc.ShowHint(fHintHorz, fHintVert, SHintCaption, SHintText);
end;
end;
procedure TcxHintStyleEditor.WMActivate(var Message: TWMActivate);
begin
if Message.Active = WA_INACTIVE then
cxHsc.HideHint
else
RefreshHint;
end;
procedure TcxHintStyleEditor.WMMove(var Message: TWMMove);
begin
inherited;
if fFormLoaded then
begin
fHintHorz := pnlPreview.ClientOrigin.X + (pnlPreview.Width div 2 - cxHsc.GetHintWidth(SHintText) div 2);
fHintVert := pnlPreview.ClientOrigin.Y + (pnlPreview.Height div 2 - cxHsc.GetHintHeight(SHintText) div 2);
RefreshHint;
end;
end;
procedure TcxHintStyleEditor.FormShow(Sender: TObject);
begin
fHintHorz := pnlPreview.ClientOrigin.X + (pnlPreview.Width div 2 - cxHsc.GetHintWidth(SHintText) div 2);
fHintVert := pnlPreview.ClientOrigin.Y + (pnlPreview.Height div 2 - cxHsc.GetHintHeight(SHintText) div 2);
fFormLoaded := True;
LoadHintCtrls;
end;
procedure TcxHintStyleEditor.FormActivate(Sender: TObject);
begin
RefreshHint;
end;
procedure TcxHintStyleEditor.cxClbHintFontStylesClickCheck(Sender: TObject;
AIndex: Integer; APrevState, ANewState: TcxCheckBoxState);
function ChangeFontStyles(AFontStyles: TFontStyles): TFontStyles;
const
AFontStylesByIndex: array [0..3] of TFontStyle =
(fsBold, fsItalic, fsUnderline, fsStrikeOut);
begin
Result := AFontStyles;
case ANewState of
cbsUnchecked:
Exclude(Result, AFontStylesByIndex[AIndex]);
cbsChecked:
Include(Result, AFontStylesByIndex[AIndex]);
end;
end;
begin
if TcxCheckListBox(Sender).Tag = 0 then
cxHsc.HintStyle.Font.Style := ChangeFontStyles(cxHsc.HintStyle.Font.Style)
else
cxHsc.HintStyle.CaptionFont.Style :=
ChangeFontStyles(cxHsc.HintStyle.CaptionFont.Style);
RefreshHint;
end;
procedure TcxHintStyleEditor.cxCcbHintColourPropertiesEditValueChanged(
Sender: TObject);
begin
cxHsc.HintStyle.Color := cxCcbHintColour.ColorValue;
RefreshHint;
end;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?