zoukankan      html  css  js  c++  java
  • TStringGrid多选的复制与拷贝

    uses Clipbrd;
    function StringGridSelectText(mStringGrid: TStringGrid): string; var   I, J: Integer;   S: string; begin   Result := '';   if not Assigned(mStringGrid) then Exit;   for J := mStringGrid.Selection.Top to mStringGrid.Selection.Bottom do   begin     S := '';     for I := mStringGrid.Selection.Left to mStringGrid.Selection.Right do       S := S + #9 + mStringGrid.Cells[I, J];     Delete(S, 1, 1);     Result := Result + S + #13#10;   end; end; { StringGridSelectText }
    procedure StringGridPasteFromClipboard(mStringGrid: TStringGrid); var   vTextList: TStringList;   vLineList: TStringList;   I, J: Integer; begin   vTextList := TStringList.Create;   vLineList := TStringList.Create;   vLineList.Delimiter := #9;   try     vTextList.Text := Clipboard.AsText;     for J := 0 to vTextList.Count - 1 do     begin       if J + mStringGrid.Row >= mStringGrid.RowCount then Break;       vLineList.DelimitedText := vTextList[J];       for I := 0 to vLineList.Count - 1 do       begin         if I + mStringGrid.Col >= mStringGrid.ColCount then Break;         mStringGrid.Cells[I + mStringGrid.Col, J + mStringGrid.Row] := vLineList[I];       end;     end;   finally     vTextList.Free;     vLineList.Free;   end; end; { StringGridPasteFromClipboard }
    procedure StringGridCopyToClipboard(mStringGrid: TStringGrid); begin   Clipboard.AsText := StringGridSelectText(mStringGrid); end; { StringGridCopyToClipboard }
    procedure TForm1.MenuItemCopyClick(Sender: TObject); begin   StringGridCopyToClipboard(StringGrid1); end;
    procedure TForm1.MenuItemPasteClick(Sender: TObject); begin   StringGridPasteFromClipboard(StringGrid1); end;
    procedure TForm1.StringGrid1KeyDown(Sender: TObject; var Key: Word;   Shift: TShiftState); begin   if ssCtrl in Shift then     case Key of       Ord('C'): StringGridCopyToClipboard(TStringGrid(Sender));       Ord('V'): StringGridPasteFromClipboard(TStringGrid(Sender));     end; end;

    http://blog.csdn.net/zswang/article/details/111607

  • 相关阅读:
    opencv图像直方图均衡化及其原理
    转 让FPGA替代GPU的6大顾虑,你确定不看看吗?
    算法工程师到底在干嘛
    转 经典分类网络Googlenet
    darknet是如何对数据集做预处理的
    目标检测评价指标mAP 精准率和召回率
    opencv代码片段合集
    GAN简介
    【登录测试】登录模块的测试点
    【Jmeter自学】Jmeter里的指标
  • 原文地址:https://www.cnblogs.com/findumars/p/6348015.html
Copyright © 2011-2022 走看看