home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 March / CMCD0305.ISO / Software / Shareware / Programare / meesageview / MVSetup.msi / _D37BEEA2FA7FCB676F731C0EE8A89AE4 / _49AC81B2F6EB4F198A00AC02D7A8F8FB < prev    next >
Text File  |  2004-12-22  |  5KB  |  130 lines

  1. using System;
  2. using System.Drawing;
  3. using System.Collections;
  4. using System.ComponentModel;
  5. using System.Windows.Forms;
  6. using System.Data;
  7.  
  8. namespace dcwsolutions.MessageView.Sample1
  9. {
  10.     public class Form1 : System.Windows.Forms.Form
  11.     {
  12.         private dcwsolutions.MessageView.MessageView messageView1;
  13.         private dcwsolutions.MessageView.MessageViewPanel messageViewPanel1;
  14.         private System.Windows.Forms.MainMenu mainMenu1;
  15.         private System.Windows.Forms.MenuItem menuItem1;
  16.         private System.Windows.Forms.MenuItem menuItem2;
  17.  
  18.         private System.ComponentModel.Container components = null;
  19.  
  20.         public Form1()
  21.         {
  22.             InitializeComponent();
  23.         }
  24.  
  25.         /// <summary>
  26.         /// Clean up any resources being used.
  27.         /// </summary>
  28.         protected override void Dispose( bool disposing )
  29.         {
  30.             if( disposing )
  31.             {
  32.                 if (components != null) 
  33.                 {
  34.                     components.Dispose();
  35.                 }
  36.             }
  37.             base.Dispose( disposing );
  38.         }
  39.  
  40.         #region Windows Form Designer generated code
  41.         /// <summary>
  42.         /// Required method for Designer support - do not modify
  43.         /// the contents of this method with the code editor.
  44.         /// </summary>
  45.         private void InitializeComponent()
  46.         {
  47.             this.messageView1 = new dcwsolutions.MessageView.MessageView();
  48.             this.messageViewPanel1 = new dcwsolutions.MessageView.MessageViewPanel();
  49.             this.mainMenu1 = new System.Windows.Forms.MainMenu();
  50.             this.menuItem1 = new System.Windows.Forms.MenuItem();
  51.             this.menuItem2 = new System.Windows.Forms.MenuItem();
  52.             this.SuspendLayout();
  53.             // 
  54.             // messageView1
  55.             // 
  56.             this.messageView1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
  57.                 | System.Windows.Forms.AnchorStyles.Right)));
  58.             this.messageView1.BackColor = System.Drawing.Color.White;
  59.             this.messageView1.BackgroundImageRepeat = dcwsolutions.MessageView.RepeatEnum.Repeat;
  60.             this.messageView1.ContextMenuMode = dcwsolutions.MessageView.ContextMenuMode.MessageView;
  61.             this.messageView1.DisplayMode = dcwsolutions.MessageView.DisplayMode.Html;
  62.             this.messageView1.Font = new System.Drawing.Font("Courier New", 10F);
  63.             this.messageView1.ForeColor = System.Drawing.Color.Black;
  64.             this.messageView1.Location = new System.Drawing.Point(0, 40);
  65.             this.messageView1.Name = "messageView1";
  66.             this.messageView1.OpenNewWindow = true;
  67.             this.messageView1.Show3DBorder = true;
  68.             this.messageView1.ShowScrollBars = true;
  69.             this.messageView1.Size = new System.Drawing.Size(736, 496);
  70.             this.messageView1.TabIndex = 0;
  71.             // 
  72.             // messageViewPanel1
  73.             // 
  74.             this.messageViewPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  75.             this.messageViewPanel1.BoundMessageView = null;
  76.             this.messageViewPanel1.Location = new System.Drawing.Point(0, 0);
  77.             this.messageViewPanel1.Name = "messageViewPanel1";
  78.             this.messageViewPanel1.Size = new System.Drawing.Size(736, 40);
  79.             this.messageViewPanel1.TabIndex = 1;
  80.             // 
  81.             // mainMenu1
  82.             // 
  83.             this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
  84.                                                                                       this.menuItem1});
  85.             // 
  86.             // menuItem1
  87.             // 
  88.             this.menuItem1.Index = 0;
  89.             this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
  90.                                                                                       this.menuItem2});
  91.             this.menuItem1.Text = "File...";
  92.             // 
  93.             // menuItem2
  94.             // 
  95.             this.menuItem2.Index = 0;
  96.             this.menuItem2.Text = "Open message file...";
  97.             this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click);
  98.             // 
  99.             // Form1
  100.             // 
  101.             this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
  102.             this.ClientSize = new System.Drawing.Size(736, 541);
  103.             this.Controls.Add(this.messageViewPanel1);
  104.             this.Controls.Add(this.messageView1);
  105.             this.Menu = this.mainMenu1;
  106.             this.Name = "Form1";
  107.             this.Text = "MessageView Sample";
  108.             this.ResumeLayout(false);
  109.  
  110.         }
  111.         #endregion
  112.  
  113.         [STAThread]
  114.         static void Main() 
  115.         {
  116.             Application.Run(new Form1());
  117.         }
  118.  
  119.         private void menuItem2_Click(object sender, System.EventArgs e)
  120.         {
  121.             System.Windows.Forms.OpenFileDialog dialog = new System.Windows.Forms.OpenFileDialog();
  122.             if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  123.             {
  124.                 //Show the message specified by the filenam, use Hybrid Cachemode, in synchronous mode.
  125.                 messageView1.ShowMessage(System.IO.File.OpenRead(dialog.FileName), CacheMode.Hybrid, false);
  126.             }
  127.         }
  128.     }
  129. }
  130.