No cache version.


Caching disabled. Default setting for this page:enabled (code LNG204)
If the display is too slow, you can disable the user mode to view the cached version.

DGVLayoutOptionsControl.cs

Description du code

DGVLayoutOptionsControl.cs est un fichier du projet BrolDev.
Ce fichier est situé dans /var/www/bin/sniplets/bibliobrol/broldev/src/.

Projet BrolDev : Librairie de composants réutilisables pour les applications BrolDev en CSharp.

Code source ou contenu du fichier

  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Windows.Forms;
  5. using be.gaudry.model.enums;
  6.  
  7. namespace be.gaudry.view.controls
  8. {
  9. public partial class DGVLayoutOptionsControl : UserControl
  10. {
  11. #region declarations and constructors
  12. private Dictionary<string, DataGridViewColumn> dgvColumns;
  13. private string tabulationStr;
  14. public DGVLayoutOptionsControl()
  15. {
  16. dgvColumns = new Dictionary<string, DataGridViewColumn>();
  17. tabulationStr = "TABULATION (par défaut)";
  18. InitializeComponent();
  19. printAllRowsRB.Checked = true;
  20. fitToPageChkB.Checked = true;
  21. initCB();
  22. }
  23. #endregion
  24.  
  25. #region public getters and setters
  26. public void setAvailableColumns(DataGridView dgv)
  27. {
  28. dgvColumns.Clear();
  29. dgvColumnsChkLB.Items.Clear();
  30. foreach (DataGridViewColumn col in dgv.Columns)
  31. {
  32. if (!col.Visible || col.Name.Equals("fillerCol")) continue;
  33. if (col.HeaderText.Equals(string.Empty))
  34. {
  35. string colName = "Colonne "+col.Index;
  36. dgvColumnsChkLB.Items.Add(colName, false);
  37. dgvColumns.Add(colName, col);
  38. }
  39. else
  40. {
  41. dgvColumnsChkLB.Items.Add(col.HeaderText, true);
  42. dgvColumns.Add(col.HeaderText, col);
  43. }
  44. }
  45. }
  46. public List<DataGridViewColumn> getSelectedColumns()
  47. {
  48. List<DataGridViewColumn> columnsNames = new List<DataGridViewColumn>();
  49. foreach (object item in dgvColumnsChkLB.CheckedItems)
  50. {
  51. columnsNames.Add(dgvColumns[item.ToString()]);
  52. }
  53. return columnsNames;
  54. }
  55.  
  56. public string getTitle()
  57. {
  58. return titleTB.Text;
  59. }
  60. public void setTitle(string value)
  61. {
  62. titleTB.Text = value;
  63. }
  64.  
  65. public bool getPrintAllRows()
  66. {
  67. return printAllRowsRB.Checked;
  68. }
  69.  
  70. public bool getDisplayDate()
  71. {
  72. return displayDateChkB.Checked;
  73. }
  74.  
  75. public bool getFitToPageWidth()
  76. {
  77. return fitToPageChkB.Checked;
  78. }
  79.  
  80. public PAGE_COUNTERFORMAT getPageCounterFormat()
  81. {
  82. return (PAGE_COUNTERFORMAT)EnumHelper.getEnum(footerCounterStyleCB.SelectedItem);
  83. }
  84.  
  85. public PAGE_ORIENTATION getPageOrientation()
  86. {
  87. return (PAGE_ORIENTATION)EnumHelper.getEnum(pageOrientationCB.SelectedItem);
  88. }
  89.  
  90. public DGV_EXPORT_FORMAT getOutputFormat()
  91. {
  92. return (DGV_EXPORT_FORMAT)EnumHelper.getEnum(outputSelectionCB.SelectedItem);
  93. }
  94.  
  95. public void setOutputFormat(DGV_EXPORT_FORMAT format)
  96. {
  97. outputSelectionCB.SelectedValue = format;
  98. }
  99.  
  100. public string getSeparator()
  101. {
  102. if( csvSeparatorTB.Text==tabulationStr)
  103. return "\t";
  104. return csvSeparatorTB.Text;
  105. }
  106.  
  107. #endregion
  108.  
  109. #region private methods
  110.  
  111. private void initCB()
  112. {
  113. footerCounterStyleCB.DataSource = EnumHelper.ToList(typeof(PAGE_COUNTERFORMAT));
  114. footerCounterStyleCB.DisplayMember = "Value";
  115. footerCounterStyleCB.ValueMember = "Key";
  116.  
  117. footerCounterStyleCB.SelectedValue = PAGE_COUNTERFORMAT.pageXdeX;
  118.  
  119.  
  120. pageOrientationCB.DataSource = EnumHelper.ToList(typeof(PAGE_ORIENTATION));
  121. pageOrientationCB.DisplayMember = "Value";
  122. pageOrientationCB.ValueMember = "Key";
  123.  
  124. pageOrientationCB.SelectedValue = PAGE_ORIENTATION.portrait;
  125.  
  126.  
  127. outputSelectionCB.DataSource = EnumHelper.ToList(typeof(DGV_EXPORT_FORMAT));
  128. outputSelectionCB.DisplayMember = "Value";
  129. outputSelectionCB.ValueMember = "Key";
  130.  
  131. outputSelectionCB.SelectedValue = DGV_EXPORT_FORMAT.Text;
  132.  
  133.  
  134. datePLacementCB.DataSource = EnumHelper.ToList(typeof(TEXT_POSITION));
  135. datePLacementCB.DisplayMember = "Value";
  136. datePLacementCB.ValueMember = "Key";
  137.  
  138. datePLacementCB.SelectedValue = TEXT_POSITION.Header;
  139. }
  140.  
  141. private void outputSelectionCB_SelectionChangeCommitted(object sender, EventArgs e)
  142. {
  143. DGV_EXPORT_FORMAT format = (DGV_EXPORT_FORMAT)EnumHelper.getEnum(outputSelectionCB.SelectedItem);
  144. switch (format)
  145. {
  146. case DGV_EXPORT_FORMAT.Text:
  147. setCSVAndTextOptions();
  148. csvSeparatorTB.Text = "|";
  149. break;
  150. case DGV_EXPORT_FORMAT.CSV:
  151. setCSVAndTextOptions();
  152. csvSeparatorTB.Text = tabulationStr;
  153. break;
  154. default:
  155. setDefaultOptions();
  156. break;
  157. }
  158. }
  159.  
  160. private void setDefaultOptions()
  161. {
  162. fitToPageChkB.Visible = true;
  163. pageOrientationLbl.Visible = true;
  164. pageOrientationCB.Visible = true;
  165. csvSeparatorTB.Visible = false;
  166. csvSeparatorLbl.Visible = false;
  167.  
  168. dgvColumnsChkLB.Items.Clear();
  169. foreach (KeyValuePair<string, DataGridViewColumn> kvp in dgvColumns)
  170. {
  171. dgvColumnsChkLB.Items.Add(
  172. kvp.Key,
  173. !kvp.Value.HeaderText.Equals(string.Empty)
  174. );
  175. }
  176. }
  177.  
  178. private void setCSVAndTextOptions()
  179. {
  180. fitToPageChkB.Visible = false;
  181. pageOrientationLbl.Visible = false;
  182. pageOrientationCB.Visible = false;
  183. csvSeparatorTB.Visible = true;
  184. csvSeparatorLbl.Visible = true;
  185. dgvColumnsChkLB.Items.Clear();
  186. //remove non text columns
  187. foreach (KeyValuePair<string, DataGridViewColumn> kvp in dgvColumns)
  188. {
  189. if (
  190. kvp.Value is DataGridViewTextBoxColumn ||
  191. kvp.Value is DataGridViewLinkColumn
  192. )
  193. {
  194. dgvColumnsChkLB.Items.Add(
  195. kvp.Key,
  196. !kvp.Value.HeaderText.Equals(string.Empty)
  197. );
  198. }
  199. }
  200. }
  201.  
  202. private void csvSeparatorTB_Validating(object sender, CancelEventArgs e)
  203. {
  204. DGV_EXPORT_FORMAT format = (DGV_EXPORT_FORMAT)EnumHelper.getEnum(outputSelectionCB.SelectedItem);
  205. if (format == DGV_EXPORT_FORMAT.CSV && csvSeparatorTB.Text.Length > 1 && csvSeparatorTB.Text != tabulationStr)
  206. {
  207. csvSeparatorTB.Text = csvSeparatorTB.Text.Remove(1);
  208. MessageBox.Show(
  209. this.ParentForm,
  210. "Le séparateur de données ne doit comporter qu'un seul caractère.",
  211. "Erreur de séparateur",
  212. MessageBoxButtons.OK,
  213. MessageBoxIcon.Error,
  214. MessageBoxDefaultButton.Button1
  215. );
  216. }
  217. }
  218.  
  219. private void displayDateChkB_Click(object sender, EventArgs e)
  220. {
  221. datePLacementCB.Visible = displayDateChkB.Checked;
  222. }
  223. #endregion
  224. }
  225. }

Structure et Fichiers du projet

Afficher/masquer...


Répertoires contenus dans /var/www/bin/sniplets/bibliobrol/broldev/src/view/controls/ 
IcôneNomTailleModification
Pas de sous-répertoires.
IcôneNomTailleModification
| _ Répertoire parent0 octets1727436751 27/09/2024 13:32:31
Fichiers contenus dans /var/www/bin/sniplets/bibliobrol/broldev/src/view/controls/ 
IcôneNomTailleModificationAction
IcôneNomTailleModificationAction
Afficher le fichier .cs|.csToolBarHomeControl.Designer.cs7.41 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .cs|.csWizardUserControl.Designer.cs6.79 Ko31/10/2018 18:33:13-refusé-
Afficher le fichier .cs|.csHeaderPanel.Designer.cs1.19 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .cs|.csDGVLayoutOptionsControl.cs7.55 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .cs|.csXPGroupBox.cs15.83 Ko31/10/2018 18:33:13-refusé-
Afficher le fichier .cs|.csWizardXpUserControl.Designer.cs7.85 Ko31/10/2018 18:33:13-refusé-
Afficher le fichier .cs|.csToolBarHomeControl.cs2.32 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .cs|.csVersionControl.Designer.cs4.09 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .cs|.csWizardUserControl.cs2.01 Ko31/10/2018 18:33:13-refusé-
Afficher le fichier .resx|.resxWizardXpUserControl.resx5.68 Ko31/10/2018 18:33:13-refusé-
Afficher le fichier .cs|.csBrolBoxUserControl.Designer.cs5.92 Ko31/10/2018 18:33:10-refusé-
Afficher le fichier .resx|.resxChartControl.resx6.58 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .cs|.csHeaderPanel.cs35.93 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .cs|.csIWizardUC.cs2.35 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .resx|.resxAboutUserControl.resx5.68 Ko31/10/2018 18:33:10-refusé-
Afficher le fichier .cs|.csTextBoxDragDrop.cs8.59 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .cs|.csSystemInfoControl.cs5.46 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .resx|.resxXPGroupBox.resx17.7 Ko31/10/2018 18:33:13-refusé-
Afficher le fichier .cs|.csHeaderPanelNativeMethods.cs21.09 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .cs|.csToolBarManagerControl.cs6.99 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .cs|.csTextBoxDragDrop.Designer.cs1.11 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .resx|.resxSystemInfoControl.resx6.22 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .cs|.csSystemInfoControl.Designer.cs4.79 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .resx|.resxHeaderPanel.resx5.85 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .cs|.csScrollablePictureBoxUserControl.cs5.55 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .cs|.csBrolBoxUserControl.cs4.7 Ko31/10/2018 18:33:10-refusé-
Afficher le fichier .resx|.resxDGVLayoutOptionsControl.resx5.68 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .resx|.resxWizardUserControl.resx5.68 Ko31/10/2018 18:33:13-refusé-
Afficher le fichier .cs|.csUpdateControl.cs7.55 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .cs|.csIconList.cs2.68 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .cs|.csVersionControl.cs463 octets31/10/2018 18:33:12-refusé-
Afficher le fichier .resx|.resxBrolBoxUserControl.resx5.68 Ko31/10/2018 18:33:10-refusé-
Afficher le fichier .cs|.csAboutUserControl.cs6.75 Ko31/10/2018 18:33:10-refusé-
Afficher le fichier .resx|.resxToolBarManagerControl.resx5.88 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .cs|.csToolBarManagerControl.Designer.cs10.66 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .cs|.csIToolBarControl.cs1.07 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .cs|.csWizardXpUserControl.cs8.11 Ko31/10/2018 18:33:13-refusé-
Afficher le fichier .cs|.csImageCombo.cs15.49 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .cs|.csAboutUserControl.Designer.cs12.31 Ko31/10/2018 18:33:10-refusé-
Afficher le fichier .resx|.resxScrollablePictureBoxUserControl.resx5.68 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .cs|.csScrollablePictureBoxUserControl.Designer.cs5.64 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .resx|.resxVersionControl.resx5.68 Ko31/10/2018 18:33:13-refusé-
Afficher le fichier .cs|.csChartControl.Designer.cs18.45 Ko31/10/2018 18:33:10-refusé-
Afficher le fichier .cs|.csUpdateControl.Designer.cs3.92 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .resx|.resxUpdateControl.resx5.68 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .cs|.csChartControl.cs15.11 Ko31/10/2018 18:33:10-refusé-
Afficher le fichier .cs|.csDGVLayoutOptionsControl.Designer.cs17.39 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .cs|.csToolStrip.cs1.06 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .cs|.csIconList.Designer.cs1.1 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .resx|.resxToolBarHomeControl.resx48.51 Ko31/10/2018 18:33:12-refusé-

Utilisation de l'explorateur de code

  • Navigation :
    • Un clic sur une icône de répertoire ouvre ce répertoire pour en afficher les fichiers.
    • Lorsque le répertoire en cours ne contient pas de sous-répertoires il est possible de remonter vers le répertoire parent.
    • La structure de répertoires en treetable (tableau en forme d'arborescence) n'est plus possibledans cette version.
    • Un clic sur une icône de fichier ouvre ce fichier pour en afficher le code avec la coloration syntaxique adaptée en fonction du langage principal utilisé dans le fichier.
  • Affichage :
    • Il est possible de trier les répertoires ou les fichiers selon certains critères (nom, taille, date).
  • Actions :
    • Les actions possible sur les fichiers dépendent de vos droits d'utilisateur sur le site. Veuillez activer le mode utilisateur pour activer les actions.

English translation

You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.

If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.

Thank you in advance.

Document created the 16/10/2009, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/cs-broldev-source-rf-view/controls//DGVLayoutOptionsControl.cs.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.