landscape print gridcontrol devexpress

C#
 private void gridView1_PrintInitialize(object sender, DevExpress.XtraGrid.Views.Base.PrintInitializeEventArgs e)
 {
   PrintingSystemBase pb = e.PrintingSystem as PrintingSystemBase;
   pb.PageSettings.PaperKind = System.Drawing.Printing.PaperKind.Legal;
   pb.PageSettings.Landscape = true;
 }

 private void preview(GridControl grid)
 {   
   if (!grid.IsPrintingAvailable)
   {
     MessageBox.Show("The 'XtraPrinting' library is not found", "Error");
     return;
   }
  grid.ShowRibbonPrintPreview();
 }

private void btnPrint_Click(object sender, EventArgs e)
{
	preview(dtMembers);
}
Source

Also in C#: