Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9916


Ignore:
Timestamp:
08/29/13 12:04:58 (11 years ago)
Author:
ascheibe
Message:

#2100 added loading of txt files

Location:
trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/Dialogs
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/Dialogs/InfoBox.Designer.cs

    r9915 r9916  
    6363      // infoRichTextBox
    6464      //
    65       this.infoRichTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    66             | System.Windows.Forms.AnchorStyles.Left)
     65      this.infoRichTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
     66            | System.Windows.Forms.AnchorStyles.Left) 
    6767            | System.Windows.Forms.AnchorStyles.Right)));
    6868      this.infoRichTextBox.BackColor = System.Drawing.SystemColors.Control;
     
    7171      this.infoRichTextBox.Name = "infoRichTextBox";
    7272      this.infoRichTextBox.ReadOnly = true;
     73      this.infoRichTextBox.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical;
    7374      this.infoRichTextBox.Size = new System.Drawing.Size(612, 441);
    7475      this.infoRichTextBox.TabIndex = 1;
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/Dialogs/InfoBox.cs

    r9915 r9916  
    6363    }
    6464
    65     protected virtual void LoadEmbeddedResource(string name) {
     65    protected virtual void LoadEmbeddedResource(string resourceName) {
     66      string extension = Path.GetExtension(resourceName);
    6667      Assembly assembly = Assembly.GetAssembly(ParentView.GetType());
    6768      try {
    68         using (Stream stream = assembly.GetManifestResourceStream(name))
    69           infoRichTextBox.LoadFile(stream, RichTextBoxStreamType.RichText);
     69        using (Stream stream = assembly.GetManifestResourceStream(resourceName)) {
     70          if (extension == ".rtf") {
     71            infoRichTextBox.LoadFile(stream, RichTextBoxStreamType.RichText);
     72          } else if (extension == ".txt") {
     73            infoRichTextBox.LoadFile(stream, RichTextBoxStreamType.UnicodePlainText);
     74          } else {
     75            infoRichTextBox.Text = "Error: Unsupported help format: " + extension;
     76          }
     77        }
    7078      }
    7179      catch (Exception ex) {
Note: See TracChangeset for help on using the changeset viewer.