We explore the relative stability of three possible orientations of cylinder-forming di-block copolymer on a sinusoidally corrugated substrate. The cylinders can be aligned either parallel to the substrate, with their long axis being oriented along or orthogonal to the corrugation trenches, or perpendicular to the substrate. Using self-consistent field theory, we investigate the influence of substrate roughness and surface preference on the phase transition between the three orientations. When the substrate preference, u, towards one of components is small, increasing the substrate roughness induces a phase transition from parallel to perpendicular cylindrical phase. However, when u is large, the parallel orientation is more stable than the perpendicular one. Within this parallel phase, increasing the substrate roughness leads to a transition of cylinder orientation changing from being orthogonal to parallel to the trench long axis. Increasing the substrate preference leads to an opposite transition from parallel to orthogonal to the trenches. Furthermore, we predict that the perpendicular cylinder phase is easier to be obtained when the unidirectional corrugation is along the longer unit vector of the hexagonal packing than when it is along the shorter unit vector. Our results qualitatively agree with previous experiments, and contribute towards applications of the cylinder-forming block copolymer in nanotechnology.