Not all settings persistent on the display control

The display control seems to serialize some of its settings (like FileName) but when I change the RedPage, GreenPage or BluePage setting it’s lost when I start my program.

Hi @taserface!

from looking at the code of the display control I can assure you that the following properties are serialized/deserialized to/from the control’s property bag:

  • BevelInner
  • BevelOuter
  • CoordStyle
  • DisplayGain
  • DisplayOffset
  • DirectDrawEnabled
  • DrawErase
  • LeftButtonMode
  • RightButtonMode
  • RulerEnabled
  • ScrollBars
  • ShowCoords
  • StatusCurrentPos
  • StatusEmpty
  • StatusGrayValue
  • StatusImageSize
  • StatusScale
  • StatusUserText

Since control version 2, the following properties are also serialized:

[details=Warning]:warning: the control version is not identical with the CVDisplay.ocx file version; the control version can e.g. be read from the dialog that adds the controls to the tool bar in Visual Studio:


  • DisplayRectPercentage
  • ManualDisplayRefresh
  • MouseWheelMode
  • OverlayDragAndDelete
  • SynRefreshToMonitor

Control version 2.1 added two more serialized properties:

  • HighBitScaleMode
  • RestrictZoomPositions

The three properties you quote (RedPage, GreenPage and BluePage) are not among them because for these properties the range of acceptable values depends on the currently set image. However, at the time when the property bag is deserialized there is no image available yet, and therefore it wouldn’t be possible to do a range check on them, which is why they are not serializable in the first place (technically speaking they are in fact stored in the property bag, but reading and applying them fails).

Please note that the DirectDrawEnabled property can also behave as if it had not been serialized because it can be overridden with an option in the TeachBench:

If that checkbox is unchecked, DirectDrawEnabled will not be used regardless of the propertie’s actual setting.