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

📄 selsameitem.pas

📁 超级播放器 -- 软件特点 -- 功能齐全 操作简便 绿色环保
💻 PAS
字号:
unit selSameItem;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Grids,strutils;

type
  TFrmSelSameItem = class(TForm)
    SameList: TStringGrid;
    procedure FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure SameListDrawCell(Sender: TObject; ACol, ARow: Integer;
      Rect: TRect; State: TGridDrawState);
    procedure SameListDblClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FrmSelSameItem: TFrmSelSameItem;
 function ShowSameItem:integer;

implementation
 uses main,IMCode;
{$R *.dfm}
function ShowSameItem:integer;
var i,addnum:integer;
begin
   with TFrmSelSameItem.Create(application) do
     try
       addnum:=0;
       result:=-1;
       samelist.Cols[0][0]:='No.';
       samelist.Cols[1][0]:='名称';
       samelist.cols[2][0]:='路径';
       samelist.ColWidths[0]:=30;
       samelist.ColWidths[1]:=150;
       samelist.ColWidths[2]:=250;
       //显示匹配曲目
       for i:=mainfrm.sglist.Row to mainfrm.sglist.RowCount -1 do
       begin
          if pos(uppercase(mainfrm.PYEdit.Text),uppercase(MakeSpellCode(mainfrm.GetGridCell('名称',i),4,255) ))<>0 then
          begin
            //添加匹配曲目
            if addnum <>0 then
              samelist.RowCount :=samelist.RowCount +1;
            inc(addNum);
            samelist.Rows[addNum][0]:=Mainfrm.GetGridCell('No.',i);
            samelist.Rows[addNum][1]:=Mainfrm.GetGridCell('名称',i);
            samelist.Rows[addNum][2]:=Mainfrm.GetGridCell('全名',i);
          end
       end;
       samelist.Row:=1;
       samelist.Col :=1;
       if showmodal=mrok then
         result :=strtoint(SameList.Rows[SameList.Row][0]);
     finally
       free;
     end;
end;
procedure TFrmSelSameItem.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if key=vk_escape then
    modalresult :=mrcancel
  else if key=vk_return then
    modalResult :=mrok;

end;

procedure TFrmSelSameItem.SameListDrawCell(Sender: TObject; ACol,
  ARow: Integer; Rect: TRect; State: TGridDrawState);
begin
  with Sender as TStringGrid do
  begin
    FillRect(Canvas.Handle,Rect ,self.Brush.Handle );

      if (Arow=0) then   //or (ACol=0)
        Canvas.Brush.Color := fixedColor
      else
      begin
        if ARow mod 2 =0 then
          Canvas.Brush.Color := $00E0CDBA
        else
          Canvas.Brush.Color :=$00C9E0C9;
      end;

    canvas.Brush.Style:=bsSolid;

    canvas.Font.Name :='宋体';
    canvas.Font.Size :=9;
    if ARow=0 then
      canvas.Font.Color :=clnavy
    else
    begin
      if (acol<=Selection.right) and (acol>=Selection.left) and
        (arow>=Selection.top) and (arow <=Selection.bottom) then
        begin
           canvas.Brush.Color :=clNavy;
           canvas.Font.Color :=clyellow;
        end
      else
      begin
           canvas.Font.Color :=clblack;
      end;
    end;
    Canvas.FillRect(Rect);

    canvas.Pen.Color :=clbtnface;
    canvas.Pen.Width :=2;
    canvas.Pen.style :=psDashdotdot;
    if (ARow=0) or (Acol=0) then
    begin  //画右竖线
      canvas.MoveTo(rect.Right,rect.top);
      canvas.LineTo(rect.Right,rect.Bottom);
      canvas.MoveTo(rect.Left,rect.Bottom);
      canvas.LineTo(rect.right,rect.Bottom);
    end;


     if (ACol=0) or (aRow=0) then
        DrawText(Canvas.Handle, PChar(cells[acol,arow]), Length(cells[acol,arow]), Rect,  DT_CENTER or DT_SINGLELINE or DT_VCENTER)
    else
        DrawText(Canvas.Handle, PChar(cells[acol,arow]), Length(cells[acol,arow]), Rect,   DT_SINGLELINE or DT_VCENTER);
    if gdFocused in State then
      Canvas.DrawFocusRect(Rect);
  end;

end;

procedure TFrmSelSameItem.SameListDblClick(Sender: TObject);
begin
   if samelist.row>0 then
     modalresult :=mrok;
end;

end.

⌨️ 快捷键说明

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