Создание Windows-приложений на основе Visual C#


           

Форма списка сообщений MessageList.cs


Значения свойства Name элементов управления этой формы приведены на рис. 3.31.


увеличить изображение
Рис. 3.31.  Форма MessageList

Полный листинг формы:

using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms;

namespace MailApplication { /// <summary> /// Summary description for MessageList. /// </summary> public class MessageList : System.Windows.Forms.Form { private Mail.Providers.Pop3 mail; private UserIdentity identity; private System.Windows.Forms.ListView lstViewMessages; private System.Windows.Forms.ColumnHeader colFrom; private System.Windows.Forms.ColumnHeader colSubject; private System.Windows.Forms.ColumnHeader colDate; private System.Windows.Forms.ImageList imageListIcons; private System.Windows.Forms.ColumnHeader colIcon; private System.Windows.Forms.Label lblMessagesCount; private System.Windows.Forms.Panel pnlPages; private System.ComponentModel.IContainer components;

public MessageList() { InitializeComponent();

identity = (UserIdentity)System.Threading.Thread.CurrentPrincipal.Identity; // Создание объекта POP3. if(identity.Pop3Port == -1) mail = new Mail.Providers.Pop3(identity.Pop3); else mail = new Mail.Providers.Pop3(identity.Pop3, identity.Pop3Port); }

/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if(components != null) { components.Dispose(); } } base.Dispose( disposing ); }

#region Windows Form Designer generated code /// <summary> /// Required method for Designer support — do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(MessageList)); this.lstViewMessages = new System.Windows.Forms.ListView(); this.colFrom = new System.Windows.Forms.ColumnHeader(); this.colSubject = new System.Windows.Forms.ColumnHeader(); this.colDate = new System.Windows.Forms.ColumnHeader(); this.imageListIcons = new System.Windows.Forms.ImageList(this.components); this.colIcon = new System.Windows.Forms.ColumnHeader(); this.lblMessagesCount = new System.Windows.Forms.Label(); this.pnlPages = new System.Windows.Forms.Panel(); this.SuspendLayout(); // // lstViewMessages // this.lstViewMessages.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.lstViewMessages.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.colIcon, this.colFrom, this.colSubject, this.colDate}); this.lstViewMessages.Cursor = System.Windows.Forms.Cursors.Hand; this.lstViewMessages.FullRowSelect = true; this.lstViewMessages.GridLines = true; this.lstViewMessages.Location = new System.Drawing.Point(16, 40); this.lstViewMessages.MultiSelect = false; this.lstViewMessages.Name = "lstViewMessages"; this.lstViewMessages.Size = new System.Drawing.Size(632, 352); this.lstViewMessages.SmallImageList = this.imageListIcons; this.lstViewMessages.TabIndex = 0; this.lstViewMessages.View = System.Windows.Forms.View.Details; this.lstViewMessages.Click += new System.EventHandler(this.lstViewMessages_Click); // // colFrom // this.colFrom.Text = "От"; this.colFrom.Width = 177; // // colSubject // this.colSubject.Text = "Тема"; this.colSubject.Width = 306; // // colDate // this.colDate.Text = "Дата"; this.colDate.Width = 106; // // imageListIcons // this.imageListIcons.ImageSize = new System.Drawing.Size(16, 16); this.imageListIcons.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageListIcons.ImageStream"))); this.imageListIcons.TransparentColor = System.Drawing.Color.Transparent; // // colIcon // this.colIcon.Text = "#"; this.colIcon.Width = 39; // // lblMessagesCount // this.lblMessagesCount.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.lblMessagesCount.Location = new System.Drawing.Point(16, 8); this.lblMessagesCount.Name = "lblMessagesCount"; this.lblMessagesCount.Size = new System.Drawing.Size(456, 23); this.lblMessagesCount.TabIndex = 1; this.lblMessagesCount.Text = "Писем в почтовом ящике: "; this.lblMessagesCount.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // pnlPages // this.pnlPages.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.pnlPages.Location = new System.Drawing.Point(16, 400); this.pnlPages.Name = "pnlPages"; this.pnlPages.Size = new System.Drawing.Size(632, 32); this.pnlPages.TabIndex = 2; // // MessageList // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(664, 438); this.Controls.Add(this.pnlPages); this.Controls.Add(this.lblMessagesCount); this.Controls.Add(this.lstViewMessages); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "MessageList"; this.Text = "Список сообщений"; this.WindowState = System.Windows.Forms.FormWindowState.Maximized; this.Load += new System.EventHandler(this.MessageList_Load); this.ResumeLayout(false);



Содержание  Назад  Вперед