Selection.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Runtime.InteropServices;
  5. using Biff8Excel.Interfaces;
  6. namespace Biff8Excel.Records
  7. {
  8. [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Auto, Pack = 1)]
  9. struct RecordSelection
  10. {
  11. public ushort opcode;
  12. public ushort length;
  13. public ushort paneid;
  14. public ushort activeRow;
  15. public ushort activeCol;
  16. public ushort index;
  17. }
  18. internal class Selection : IRecords
  19. {
  20. RecordSelection selection;
  21. public Selection()
  22. {
  23. selection.opcode = 0x1D;
  24. selection.length = 0xF;
  25. selection.paneid = 0x3;
  26. selection.index = 0x0;
  27. }
  28. public ushort Row
  29. {
  30. set { selection.activeRow = value; }
  31. }
  32. public ushort Column
  33. {
  34. set { selection.activeCol = value; }
  35. }
  36. #region IRecords ³ÉÔ±
  37. public byte[] GetByte()
  38. {
  39. byte[] b = new byte[18];
  40. Globals.GetStructToBytes(selection).CopyTo(b, 0);
  41. BitConverter.GetBytes(selection.activeRow).CopyTo(b, 12);
  42. BitConverter.GetBytes(selection.activeRow).CopyTo(b, 14);
  43. b[16] = BitConverter.GetBytes(selection.activeCol)[0];
  44. b[17] = BitConverter.GetBytes(selection.activeCol)[0];
  45. b[18] = 0;
  46. return b;
  47. }
  48. #endregion
  49. }
  50. }