Recent

Author Topic: How to implement multiple selected ranges in the TsWorksheetGrid by code?  (Read 145 times)

bills

  • New Member
  • *
  • Posts: 48
hi all.
I tried the following code, but it didn't work:


Code: Pascal  [Select][+][-]
  1. var
  2.   MySelection: TsCellRangeArray;
  3. begin
  4.   SetLength(MySelection, 2);
  5.  
  6.   MySelection[0].Col1 := 3;
  7.   MySelection[0].Row1 := 7;
  8.   MySelection[0].Col2 := 3;
  9.   MySelection[0].Row2 := 9;
  10.  
  11.   MySelection[1].Col1 := 5;
  12.   MySelection[1].Row1 := 8;
  13.   MySelection[1].Col2 := 5;
  14.   MySelection[1].Row2 := 10;
  15.  
  16.   wsGrid.RangeSelectMode := rsmMulti;
  17.   wsGrid.Worksheet.SetSelection(MySelection);
  18.   wsGrid.Repaint;

thanks.

 

TinyPortal © 2005-2018