doc.xml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <CodeDoc>
  3. <Topics>
  4. <EnvironmentSettings>
  5. <CustomOpenDialog>
  6. <summary>
  7. Occurs when the report designer is about to show the "Open" dialog.
  8. </summary>
  9. <remarks>
  10. Use this event to attach own "Open" dialog to the designer. In the event handler, you must
  11. display a dialog window to allow user to choose a report file.
  12. If dialog was executed successfully, you must return <b>e.Cancel</b> = <b>false</b> and set the
  13. <b>e.FileName</b> to the selected file name.
  14. <para/>You also need to use <see cref="CustomOpenReport"/> event to provide code that
  15. will open the report.
  16. </remarks>
  17. </CustomOpenDialog>
  18. <CustomSaveDialog>
  19. <summary>
  20. Occurs when the report designer is about to show the "Save" dialog.
  21. </summary>
  22. <remarks>
  23. Use this event to attach own "Save" dialog to the designer. In the event handler, you must
  24. display a dialog window to allow user to choose a report file.
  25. If dialog was executed successfully, you must return <b>e.Cancel</b> = <b>false</b> and set the
  26. <b>e.FileName</b> to the selected file name.
  27. <para/>You also need to use <see cref="CustomSaveReport"/> event to provide code that
  28. will save the report.
  29. </remarks>
  30. </CustomSaveDialog>
  31. <CustomOpenReport>
  32. <summary>
  33. Occurs when the report designer is about to load the report.
  34. </summary>
  35. <remarks>
  36. <para/>This event is used together with the <see cref="CustomOpenDialog"/> event.
  37. <para/>Use this event to attach own "Open" dialog to the designer. In the event handler, you must
  38. load the <b>e.Report</b> from the location specified in the <b>e.FileName</b> property.
  39. For example, if you work with files: <c>e.Report.Load(e.FileName);</c>
  40. </remarks>
  41. </CustomOpenReport>
  42. <CustomSaveReport>
  43. <summary>
  44. Occurs when the report designer is about to save the report.
  45. </summary>
  46. <remarks>
  47. <para/>This event is used together with the <see cref="CustomSaveDialog"/> event.
  48. <para/>Use this event to attach own "Save" dialog to the designer. In the event handler, you must
  49. save the <b>e.Report</b> to the location specified in the <b>e.FileName</b> property.
  50. For example, if you work with files: <c>e.Report.Save(e.FileName);</c>
  51. </remarks>
  52. </CustomSaveReport>
  53. <DatabaseLogin>
  54. <summary>
  55. Occurs when database connection is about to open.
  56. </summary>
  57. <remarks>
  58. Use this event to provide own connection string or user name/password to the connection
  59. object that is about to open.
  60. <para/>To provide own connection string, set the <b>e.ConnectionString</b> property.
  61. In this case the new connection string will be used.
  62. <para/>To provide own user name/password, set the <b>e.UserName</b> and <b>e.Password</b> properties.
  63. You may ask these values in own login dialog.
  64. </remarks>
  65. <example>This example shows how to provide username/password using own login dialog.
  66. <code>
  67. private void report1_DatabaseLogin(object sender, DatabaseLoginEventArgs e)
  68. {
  69. using (MyLoginDialog dialog = new MyLoginDialog())
  70. {
  71. if (dialog.ShowDialog() == DialogResult.OK)
  72. {
  73. e.UserName = dialog.UserName;
  74. e.Password = dialog.Password;
  75. }
  76. }
  77. }
  78. </code>
  79. </example>
  80. <example>This example shows how to provide own connection string.
  81. <code>
  82. private void report1_DatabaseLogin(object sender, DatabaseLoginEventArgs e)
  83. {
  84. e.ConnectionString = my_connection_string;
  85. }
  86. </code>
  87. </example>
  88. </DatabaseLogin>
  89. </EnvironmentSettings>
  90. </Topics>
  91. <Examples>
  92. <EnvironmentSettings>
  93. <example>
  94. This example shows how to attach own "Open" and "Save" dialogs to the designer.
  95. It uses the following events: <see cref="CustomOpenDialog"/>, <see cref="CustomSaveDialog"/>,
  96. <see cref="CustomOpenReport"/>, <see cref="CustomSaveReport"/>.
  97. <code>
  98. private void CustomOpenDialog_Handler(object sender, OpenSaveDialogEventArgs e)
  99. {
  100. using (OpenFileDialog dialog = new OpenFileDialog())
  101. {
  102. dialog.Filter = "Report files (*.frx)|*.frx";
  103. // set e.Cancel to false if dialog was succesfully executed
  104. e.Cancel = dialog.ShowDialog() != DialogResult.OK;
  105. // set e.FileName to the selected file name
  106. e.FileName = dialog.FileName;
  107. }
  108. }
  109. private void CustomSaveDialog_Handler(object sender, OpenSaveDialogEventArgs e)
  110. {
  111. using (SaveFileDialog dialog = new SaveFileDialog())
  112. {
  113. dialog.Filter = "Report files (*.frx)|*.frx";
  114. // get default file name from e.FileName
  115. dialog.FileName = e.FileName;
  116. // set e.Cancel to false if dialog was succesfully executed
  117. e.Cancel = dialog.ShowDialog() != DialogResult.OK;
  118. // set e.FileName to the selected file name
  119. e.FileName = dialog.FileName;
  120. }
  121. }
  122. private void CustomOpenReport_Handler(object sender, OpenSaveReportEventArgs e)
  123. {
  124. // load the report from the given e.FileName
  125. e.Report.Load(e.FileName);
  126. }
  127. private void CustomSaveReport_Handler(object sender, OpenSaveReportEventArgs e)
  128. {
  129. // save the report to the given e.FileName
  130. e.Report.Save(e.FileName);
  131. }
  132. </code>
  133. </example>
  134. </EnvironmentSettings>
  135. </Examples>
  136. </CodeDoc>