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

📄 shintmanager.pas

📁 AlphaControls是一个Delphi标准控件的集合
💻 PAS
📖 第 1 页 / 共 5 页
字号:
           and (FsStyle.Background.Image.Image.Width <> 0)
           and (FsStyle.Background.Image.Image.Height <> 0) then begin
      TileBitmap(BGBmp.Canvas, aRect, FsStyle.Background.Image.Image.Graphic);
      iDrawed := True;
    end;
    // BGGradient painting
    if (FsStyle.Background.Gradient.Percent > 0) then begin
      if iDrawed then begin
        if Length(FsStyle.Background.Gradient.FGradArray) > 0 then begin
          PaintGrad(Bmp, aRect, FsStyle.Background.Gradient.FGradArray);
        end
        else begin
          FillCanvas(Bmp);
        end;

        TransColor.A := 0;
        TransColor.R := FsStyle.Background.Image.Percent * 255 div 100;
        TransColor.G := TransColor.R;
        TransColor.B := TransColor.R;
        SumBitmaps(BGBmp, Bmp, TransColor);
//        SumBitmapsEx(FCacheBmp, Bmp, TransColor.R);
      end
      else begin
        if Length(FsStyle.Background.Gradient.FGradArray) > 0 then begin
          PaintGrad(BGBmp, aRect, FsStyle.Background.Gradient.FGradArray);
        end
        else begin
          FillCanvas(BGBmp);
        end;
      end;
    end;
    if FsStyle.Background.Gradient.Percent + FsStyle.Background.Image.Percent in [1..99] then begin
      BlendColorRect(BGBmp, Rect(0, 0, BGBmp.Width - 1, BGBmp.Height - 1),
                         (FsStyle.Background.Gradient.Percent + FsStyle.Background.Image.Percent),
                         ColorToRGB(FsStyle.Painting.Color));
{
      FadeRect(BGBmp.Canvas, Rect(0,
                                      0,
                                      BGBmp.Width,
                                      BGBmp.Height),
                         BGBmp.Canvas.Handle, Point(0, 0),
                         (FsStyle.Background.Gradient.Percent + FsStyle.Background.Image.Percent),
                         ColorToRGB(FsStyle.Painting.Color), 0, ssRectangle);
}                         
    end
    else if FsStyle.Background.Gradient.Percent + FsStyle.Background.Image.Percent <> 100 then begin
      BGBmp.Canvas.Pen.Style := psClear;
      BGBmp.Canvas.Brush.Style := bsSolid;
      BGBmp.Canvas.Brush.Color := ColorToRGB(FsStyle.Painting.Color);
      BGBmp.Canvas.Rectangle(aRect);
    end;
  end;
begin
  aRect := R;

  bmp := TBitmap.Create;
  bmp.PixelFormat := pf24bit;
  bmp.Width := BGBmp.Width;
  bmp.Height := BGBmp.Height;

  try
    cRect := aRect;
    if ci.Ready and (FsStyle.Painting.Transparency = 100) then begin
      FadeRect(ci.Bmp.Canvas, Rect(aRect.Left + ci.X,
                                           aRect.Top + ci.Y,
                                           aRect.Right + ci.X,
                                           aRect.Bottom + ci.Y),
                           BGBmp.Canvas.Handle, Point(0, 0),
                           100, clWhite, 0, ssRectangle);
    end
    else if not ci.Ready then begin
      PaintAddons;
    end
    else if FsStyle.Painting.Transparency = 0 then begin
      PaintAddons;
    end
    else if ci.Ready and (FsStyle.Painting.Transparency > 0) then begin
      PaintAddons;
      Bmp.Assign(BGBmp); // ?????? it's needed?
      FadeRect(ci.Bmp.Canvas, Rect(aRect.Left + ci.X,
                                           aRect.Top + ci.Y,
                                           aRect.Right + ci.X,
                                           aRect.Bottom + ci.Y),
                           Bmp.Canvas.Handle, Point(0, 0),
                           100, clWhite, 0, ssRectangle);
      TransColor.A := 0;
      TransColor.R := (100 - FsStyle.Painting.Transparency) * 255 div 100;
      TransColor.G := TransColor.R;
      TransColor.B := TransColor.R;
      SumBitmaps(BGBmp, Bmp, TransColor);
    end;
  finally
    FreeAndNil(Bmp);
  end;
end;

procedure TsHintManager.SaveToFile(FileName, Section: string);
var
  IniFile : TIniFile;
begin
  IniFile := TIniFile.Create(FileName);
  // Background
  with sStyle do begin
    IniFile.WriteInteger(Section, 'HintStyle', ord(Style));
    IniFile.WriteInteger(Section, 'Radius', Radius);
    IniFile.WriteInteger(Section, 'MarginV', MarginV);
    IniFile.WriteInteger(Section, 'MarginH', MarginH);
    IniFile.WriteInteger(Section, 'MaxWidth', MaxWidth);
    IniFile.WriteInteger(Section, 'ExOffset', ExOffset);
    IniFile.WriteInteger(Section, 'Blur', Blur);
    IniFile.WriteInteger(Section, 'BevelWidth', BevelWidth);

    IniFile.WriteString(Section, 'Gradient_Data', Background.Gradient.Data);
    IniFile.WriteString(Section, 'Gradient_Percent', IntToStr(Background.Gradient.Percent));
    IniFile.WriteString(Section, 'Pattern', Background.Image.ImageName);
    IniFile.WriteString(Section, 'Image_Percent', IntToStr(Background.Image.Percent));

    // Painting
//    IniFile.WriteInteger(Section, 'ColorActive', Selection.Color);
    IniFile.WriteInteger(Section, 'Color', Painting.Color);
    IniFile.WriteInteger(Section, 'ColorBorderTop', Painting.ColorBorderTop);
    IniFile.WriteInteger(Section, 'ColorBorderBottom', Painting.ColorBorderBottom);
    IniFile.WriteInteger(Section, 'PaintingBevel', ord(Painting.Bevel));
    IniFile.WriteInteger(Section, 'PaintingTransparency', Painting.Transparency);

    // Shadow
    IniFile.WriteInteger(Section, 'ShadowColor', Shadow.Color);
    IniFile.WriteInteger(Section, 'ShadowOffset', Shadow.Offset);
    IniFile.WriteInteger(Section, 'ShadowBlur', Shadow.Blur);
    IniFile.WriteInteger(Section, 'ShadowTransparency', Shadow.Transparency);
    IniFile.WriteString(Section, 'ShadowEnabled', iff(Shadow.Enabled, 'True', 'False'));
  end;
  FreeAndNil(IniFile);
end;

procedure TsHintManager.SetCustomDefinition;
begin
  FPreDefinitions := shCustom;
end;

procedure TsHintManager.SetFont(const Value: TFont);
begin
  FFont.Assign(Value);
  SetCustomDefinition;
end;

procedure TsHintManager.SetNewStyle(hs: TsHintStyle);
begin
  if not (csDesigning in ComponentState) then begin
    case hs of
      hsNone : begin
        HintWindowClass := TsSimplyHintWindow;
      end;
      hsStandard : begin
        HintWindowClass := THintWindow;
      end;
      hsSimply : begin
        Manager := Self;
        HintWindowClass := TsSimplyHintWindow;
      end;
      hsComics : begin
        Manager := Self;
        HintWindowClass := TsComicsHintWindow;
      end;
      hsEllipse : begin
        Manager := Self;
        HintWindowClass := TsEllipseHintWindow;
      end;
      hsBalloon : begin
        Manager := Self;
        HintWindowClass := TsBalloonHintWindow;
      end;
    end;
  end;
end;

procedure TsHintManager.SetPredefinitions(const Value: TsHintsPredefinitions);
begin
  case Value of
    shSimply : begin // Simply with shadow
      Style                                    := hsSimply;
      BevelWidth                               := 1   ;
      MarginH                                  := 4   ;
      MarginV                                  := 4   ;
      MaxWidth                                 := 240  ;
      Blur                                     := 0   ;

      sStyle.Painting.Color                    := clInfoBk;
      sStyle.Painting.Transparency             := 0   ;
      sStyle.Painting.ColorBorderTop           := clWhite;
      sStyle.Painting.ColorBorderBottom        := clBlack;
      sStyle.Painting.Bevel                    := cbRaisedSoft;

      sStyle.Background.Gradient.Percent       := 100   ;
      sStyle.Background.Gradient.Data          := ''    ;
      sStyle.Background.Image.Percent          := 0     ;
      sStyle.Background.Image.ImageName        := ''    ;

      sStyle.Shadow.Blur                       := 4   ;
      sStyle.Shadow.Offset                     := 8   ;
      sStyle.Shadow.Transparency               := 50    ;
      sStyle.Shadow.Enabled                    := True ;
      sStyle.Shadow.Color                      := clBlack;
      Font.Style                               := []   ;
      Font.Size                                := 8   ;
      Font.Color                               := clBlack   ;
    end;
    shGradient : begin // Gradient
      Style                                    := hsSimply;
      BevelWidth                               := 5   ;
      MarginH                                  := 8   ;
      MarginV                                  := 5   ;
      MaxWidth                                 := 240  ;
      Blur                                     := 3   ;
      sStyle.Painting.Color                    := $00B6FCFA;
      sStyle.Painting.Transparency             := 10   ;
      sStyle.Painting.ColorBorderTop           := scLightYellow;
      sStyle.Painting.ColorBorderBottom        := scDarkYellow;
      sStyle.Painting.Bevel                    := cbRaisedSoft;

      sStyle.Background.Gradient.Percent       := 100   ;
      sStyle.Background.Gradient.Data          := '167827;14680063;58;0;0;14680063;15400959;41;0;0;15400959;15400959;0;0;0'    ;
      sStyle.Background.Image.Percent          := 0     ;
      sStyle.Background.Image.ImageName        := ''    ;


      sStyle.Shadow.Blur                       := 15   ;
      sStyle.Shadow.Offset                     := 10   ;
      sStyle.Shadow.Transparency               := 0    ;
      sStyle.Shadow.Enabled                    := True ;
      sStyle.Shadow.Color                      := clBlack;
      Font.Style                               := []   ;
      Font.Color                               := clBlack   ;
    end;
    shTransparent : begin // Simply transparent 2
      Style                                    := hsSimply;
      BevelWidth                               := 0   ;
      MarginH                                  := 18   ;
      MarginV                                  := 16   ;
      MaxWidth                                 := 240  ;
      Blur                                     := 15   ;

      sStyle.Painting.Color                    := $00B6FCFA;
      sStyle.Painting.Transparency             := 15   ;
      sStyle.Painting.ColorBorderTop           := scLightYellow;
      sStyle.Painting.ColorBorderBottom        := scDarkYellow;
      sStyle.Painting.Bevel                    := cbRaisedSoft;

      sStyle.Background.Gradient.Percent       := 100   ;
      sStyle.Background.Gradient.Data          := ''    ;
      sStyle.Background.Image.Percent          := 0     ;
      sStyle.Background.Image.ImageName        := ''    ;

      sStyle.Shadow.Blur                       := 15   ;
      sStyle.Shadow.Offset                     := 15   ;
      sStyle.Shadow.Transparency               := 70    ;
      sStyle.Shadow.Enabled                    := True ;
      sStyle.Shadow.Color                      := clBlack;
      Font.Style                               := []   ;
      Font.Color                               := clBlack   ;
    end;
    shEllipse : begin // Ellipse transparent
      Style                                    := hsEllipse;
      BevelWidth                               := 1;
      ExOffset                                 := 26;
      MarginH                                  := 6;
      MarginV                                  := 12;
      MaxWidth                                 := 200;
      Blur                                     := 0;
      sStyle.Painting.Color                    := 12778748;
      sStyle.Painting.Transparency             := 5   ;
      sStyle.Painting.ColorBorderTop           := clBlack;
      sStyle.Painting.ColorBorderBottom        := clBlack;
      sStyle.Painting.Bevel                    := cbRaisedSoft;

      sStyle.Background.Gradient.Percent       := 100   ;
      sStyle.Background.Gradient.Data          := ''    ;
      sStyle.Background.Image.Percent          := 0     ;
      sStyle.Background.Image.ImageName        := ''    ;

      sStyle.Shadow.Blur                       := 4   ;
      sStyle.Shadow.Offset                     := 16   ;
      sStyle.Shadow.Transparency               := 74    ;
      sStyle.Shadow.Enabled                    := True ;
      sStyle.Shadow.Color                      := clBlack;
      Font.Style                               := []   ;
      Font.Color                               := clBlack   ;
    end;
    shBalloon : begin // Baloon
      Style                                    := hsBalloon;
      BevelWidth                               := 1;
      ExOffset                                 := 25   ;
      MarginH                                  := 11   ;
      MarginV                                  := 13   ;
      MaxWidth                                 := 240  ;
      Blur                                     := 0   ;
      sStyle.Painting.Color                    := 12778748;
      sStyle.Painting.Transparency             := 7   ;
      sStyle.Background.Gradient.Percent       := 100   ;
      sStyle.Painting.ColorBorderTop           := clBlack;
      sStyle.Painting.ColorBorderBottom        := clBlack;
      sStyle.Painting.Bevel                    := cbRaisedSoft;

      sStyle.Background.Gradient.Percent       := 100   ;
      sStyle.Background.Gradient.Data          := ''    ;
      sStyle.Background.Image.Percent          := 0     ;
      sStyle.Background.Image.ImageName        := ''    ;

      sStyle.Shadow.Blur                       := 2   ;
      sStyle.Shadow.Offset                     := 9   ;
      sStyle.Shadow.Transparency               := 50    ;
      sStyle.Shadow.Enabled                    := True ;
      sStyle.Shadow.Color                      := clBlack;
      Font.Style                               := []   ;
      Font.Color                               := clBlack   ;
    end;
    shComicsGradient : begin // Comics gradient
      Style                                    := hsComics;
      BevelWidth                               := 1   ;
      ExOffset                                 := 24   ;
      MarginH                                  := 18   ;
      MarginV                                  := 12   ;
      MaxWidth                                 := 180  ;
      Radius                                   := 25   ;
      Blur                                     := 0   ;
      sStyle.Painting.Color                    := 12778748;
      sStyle.Painting.Transparency             := 10   ;
      sStyle.Painting.ColorBorderTop           := clWhite;
      sStyle.Painting.ColorBorderBottom        := clBlack;
      sStyle.Painting.Bevel                    := cbRaisedSoft;

      sStyle.Background.Gradient.Percent       := 100   ;
      sStyle.Background.Gradient.Data          := '11468799;16777215;47;0;0;16777215;14325588;52;0;0;14325588;14325588;0;0;0'    ;
      sStyle.Background.Image.Percent          := 0     ;
      sStyle.Background.Image.ImageName        := ''    ;

      sStyle.Shadow.Blur                       := 10   ;
      sStyle.Shadow.Offset                     := 7   ;
      sStyle.Shadow.Transparency               := 28    ;
      sStyle.Shadow.Enabled                    := True ;
      sStyle.Shadow.Color                      := clBlack;
      Font.Style                               := []   ;
      Font.Color                               := clBlack   ;
    end;
    shComicsTransparent : begin // Comics transparent
      Style                                    := hsComics;
      BevelWidth                               := 1   ;
      ExOffset                                 := 24   ;
      MarginH                                  := 18   ;
      MarginV                                  := 12   ;
      MaxWidth                                 := 180  ;
      Radius                                   := 15   ;
      Blur                                     := 0   ;
      sStyle.Painting.Color                    := 12778748;
      sStyle.Painting.Transparency             := 10   ;
      sStyle.Painting.ColorBorderTop           := clBlack;
      sStyle.Painting.ColorBorderBottom        := clBlack;
      sStyle.Painting.Bevel                    := cbRaisedSoft;

      sStyle.Background.Gradient.Percent       := 100   ;
      sStyle.Background.Gradient.Data          := ''    ;
      sStyle.Background.Image.Percent          := 0     ;
      sStyle.Background.Image.ImageName        := ''    ;

      sStyle.Background.Gradient.Percent       := 100   ;
      sStyle.Shadow.Blur                       := 4   ;
      sStyle.Shadow.Offset                     := 10   ;
      sStyle.Shadow.Transparency               := 50    ;
      sStyle.Shadow.Enabled                    := True ;
      sStyle.Shadow.Color                      := clBlack;
      Font.Style                               := []   ;
      Font.Color                               := clBlack   ;
    end;
    shStandard : begin // Standart hints
      Style                                    := hsStandard;
    end;
    shNone : begin // Standart hints
      Style                                    := hsNone;
    end;
    shCustom : begin // Standart hints
    end;
  end;
  FPredefinitions := Value;
end;

⌨️ 快捷键说明

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