- m_owner->PrepareDC( dc );
- dc.DrawText( "Row 1", 5, 5 );
- dc.DrawText( "Row 2", 5, 30 );
- dc.DrawText( "Row 3", 5, 55 );
- dc.DrawText( "Row 4", 5, 80 );
- dc.DrawText( "Row 5", 5, 105 );
- dc.DrawText( "Row 6", 5, 130 );
+
+ // This is wrong.. it will translate both x and y if the
+ // window is scrolled, the label windows are active in one
+ // direction only. Do the action below instead -- RL.
+ //m_owner->PrepareDC( dc );
+
+ int yScrollUnits, yOrigin;
+
+ m_owner->GetViewStart( 0, &yOrigin );
+ m_owner->GetScrollPixelsPerUnit( 0, &yScrollUnits );
+ dc.SetDeviceOrigin( 0, -yOrigin * yScrollUnits );
+
+ dc.DrawText( _T("Row 1"), 5, 5 );
+ dc.DrawText( _T("Row 2"), 5, 30 );
+ dc.DrawText( _T("Row 3"), 5, 55 );
+ dc.DrawText( _T("Row 4"), 5, 80 );
+ dc.DrawText( _T("Row 5"), 5, 105 );
+ dc.DrawText( _T("Row 6"), 5, 130 );