| Quintiq file version 2.0 | 
| #parent: CustomDrawComponent/CustomDrawDataLayerGridBackground | 
| Response OnDrawObject ( | 
|   MacroPlan object | 
| ) id:Response_CustomDrawComponent_CustomDrawDataLayerGridBackground_OnDrawObject | 
| { | 
|   #keys: '[11660.0.348772634]' | 
|   Body: | 
|   [* | 
|     // Draw background image | 
|     if( not isnull( DataHolderView.Data() ) ) | 
|     { | 
|       // Draw the background image defined in global parameter unless it's in a drilled down unit | 
|       view := select( MacroPlan, ViewBase.astype( SupplyChainView ), v, v.User() = ApplicationScope.Session().CurrentUser().ShortName() ); | 
|       bgimage := guard( view.SupplyChainBackground(), '' ); | 
|       focusedunitnode := select( DataHolderView.Data(), Node.astype( UnitNode ), n, n.Unit() = DataHolderFocusedUnit.Data() ); | 
|      | 
|       if ( not isnull( focusedunitnode ) ) | 
|       { | 
|         bgimage := focusedunitnode.BackgroundImageName(); | 
|       } | 
|      | 
|       if ( bgimage <> '' ) | 
|       { | 
|         surface.Image( region.Left() , region.Top(), bgimage ); | 
|       } | 
|      | 
|       if( DataHolderView.Data().IsGridVisible() ) | 
|       { | 
|         surface.Pen().Color( ColorScheme.Grid() );  | 
|         surface.Pen().Style( PenSpecification::StyleSolid() ); | 
|         surface.Pen().Width( 1 ); | 
|          | 
|         width := DataHolderView.Data().GridWidth(); | 
|         height := DataHolderView.Data().GridHeight(); | 
|         grid := DataHolderView.Data().GridPointDistance(); | 
|        | 
|         for ( x := 0; x < width; x := x + grid ) | 
|         { | 
|           surface.Line( x, 0, x, height ); | 
|         } | 
|      | 
|         for ( y := 0; y < height; y := y + grid ) | 
|         { | 
|           surface.Line( 0, y, width, y ); | 
|         } | 
|       } | 
|     } | 
|   *] | 
|   DefinitionID: 'Responsedef_CustomDrawDataLayer_OnDrawObject' | 
| } |