DataGridAutoFormatDialog.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WinForms / System / WinForms / Design / DataGridAutoFormatDialog.cs / 1 / DataGridAutoFormatDialog.cs

                            //------------------------------------------------------------------------------ 
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// 
//----------------------------------------------------------------------------- 

namespace System.Windows.Forms.Design { 
 
    using System;
    using System.Design; 
    using System.Diagnostics;
    using System.Diagnostics.CodeAnalysis;
    using System.ComponentModel;
    using System.ComponentModel.Design; 
    using System.Data;
    using System.Windows.Forms; 
    using System.Drawing; 
    using System.Xml;
    using System.IO; 
    using System.Globalization;

    /// 
    ///  
    /// 
    ///  
    internal class DataGridAutoFormatDialog : Form { 

        private DataGrid dgrid; 

        private DataTable schemeTable;
        // private PictureBox schemePicture;
        DataSet dataSet = new DataSet(); 
        private AutoFormatDataGrid dataGrid;
        private DataGridTableStyle tableStyle; 
        private Button button2; 
        private Button button1;
        private ListBox schemeName; 
        private Label formats;
        private Label preview;
        private bool IMBusy;
        private TableLayoutPanel okCancelTableLayoutPanel; 
        private TableLayoutPanel overarchingTableLayoutPanel;
 
        private int selectedIndex = -1; 

        internal DataGridAutoFormatDialog(DataGrid dgrid) { 
            this.dgrid = dgrid;

            this.ShowInTaskbar = false;
            dataSet.Locale = CultureInfo.InvariantCulture; 
            dataSet.ReadXmlSchema(new XmlTextReader(new StringReader(scheme)));
            dataSet.ReadXml(new StringReader(data), XmlReadMode.IgnoreSchema); 
            schemeTable = dataSet.Tables["Scheme"]; 

            IMBusy = true; 

            InitializeComponent();

            schemeName.DataSource = schemeTable; 

            AddDataToDataGrid(); 
            AddStyleSheetInformationToDataGrid(); 

            if (dgrid.Site != null) { 
                IUIService uiService = (IUIService)dgrid.Site.GetService(typeof(IUIService));
                if (uiService != null) {
                    Font f = (Font)uiService.Styles["DialogFont"];
                    if (f != null) { 
                        this.Font = f;
                    } 
                } 
            }
 
            //this.Focus(); causes an assertion failure - and is not required.
            IMBusy = false;
        }
 
        private void AddStyleSheetInformationToDataGrid() {
            DataGridTableStyle dGTStyle = new DataGridTableStyle(); 
            dGTStyle.MappingName = "Table1"; 
            DataGridColumnStyle col1 = new DataGridTextBoxColumn();
            col1.MappingName = "First Name"; 
            col1.HeaderText = SR.GetString(SR.DataGridAutoFormatTableFirstColumn);

            DataGridColumnStyle col2 = new DataGridTextBoxColumn();
            col2.MappingName = "Last Name"; 
            col2.HeaderText = SR.GetString(SR.DataGridAutoFormatTableSecondColumn);
 
            dGTStyle.GridColumnStyles.Add(col1); 
            dGTStyle.GridColumnStyles.Add(col2);
 
            DataRowCollection drc = dataSet.Tables["Scheme"].Rows;
            DataRow dr;
            dr = drc[0];
            dr["SchemeName"] = SR.GetString(SR.DataGridAutoFormatSchemeNameDefault); 
            dr = drc[1];
            dr["SchemeName"] = SR.GetString(SR.DataGridAutoFormatSchemeNameProfessional1); 
            dr = drc[2]; 
            dr["SchemeName"] = SR.GetString(SR.DataGridAutoFormatSchemeNameProfessional2);
            dr = drc[3]; 
            dr["SchemeName"] = SR.GetString(SR.DataGridAutoFormatSchemeNameProfessional3);
            dr = drc[4];
            dr["SchemeName"] = SR.GetString(SR.DataGridAutoFormatSchemeNameProfessional4);
            dr = drc[5]; 
            dr["SchemeName"] = SR.GetString(SR.DataGridAutoFormatSchemeNameClassic);
            dr = drc[6]; 
            dr["SchemeName"] = SR.GetString(SR.DataGridAutoFormatSchemeNameSimple); 
            dr = drc[7];
            dr["SchemeName"] = SR.GetString(SR.DataGridAutoFormatSchemeNameColorful1); 
            dr = drc[8];
            dr["SchemeName"] = SR.GetString(SR.DataGridAutoFormatSchemeNameColorful2);
            dr = drc[9];
            dr["SchemeName"] = SR.GetString(SR.DataGridAutoFormatSchemeNameColorful3); 
            dr = drc[10];
            dr["SchemeName"] = SR.GetString(SR.DataGridAutoFormatSchemeNameColorful4); 
            dr = drc[11]; 
            dr["SchemeName"] = SR.GetString(SR.DataGridAutoFormatSchemeName256Color1);
            dr = drc[12]; 
            dr["SchemeName"] = SR.GetString(SR.DataGridAutoFormatSchemeName256Color2);

            this.dataGrid.TableStyles.Add(dGTStyle);
            this.tableStyle = dGTStyle; 
        }
 
        private void AddDataToDataGrid() { 
            DataTable dTable = new DataTable("Table1");
            dTable.Locale = CultureInfo.InvariantCulture; 
            dTable.Columns.Add(new DataColumn("First Name"));
            dTable.Columns.Add(new DataColumn("Last Name"));

            DataRow dRow = dTable.NewRow(); 
            dRow["First Name"] = "Robert";
            dRow["Last Name"] = "Brown"; 
            dTable.Rows.Add(dRow); 

            dRow = dTable.NewRow(); 
            dRow["First Name"] = "Nate";
            dRow["Last Name"] = "Sun";
            dTable.Rows.Add(dRow);
 
            dRow = dTable.NewRow();
            dRow["First Name"] = "Carole"; 
            dRow["Last Name"] = "Poland"; 
            dTable.Rows.Add(dRow);
 
            this.dataGrid.SetDataBinding(dTable, "");
        }

        private void AutoFormat_HelpRequested(object sender, HelpEventArgs e) { 
            if (dgrid == null || dgrid.Site == null)
                return; 
            IDesignerHost host = dgrid.Site.GetService(typeof(IDesignerHost)) as IDesignerHost; 
            if (host == null) {
                Debug.Fail("Unable to get IDesignerHost."); 
                return;
            }

            IHelpService helpService = host.GetService(typeof(IHelpService)) as IHelpService; 
            if (helpService != null) {
                helpService.ShowHelpFromKeyword("vs.DataGridAutoFormatDialog"); 
            } else { 
                Debug.Fail("Unable to get IHelpService.");
            } 
        }

        private void Button1_Clicked(object sender, EventArgs e) {
            selectedIndex = schemeName.SelectedIndex; 
        }
 
        private void InitializeComponent() { 
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DataGridAutoFormatDialog));
            this.formats = new System.Windows.Forms.Label(); 
            this.schemeName = new System.Windows.Forms.ListBox();
            dataGrid = new AutoFormatDataGrid();
            this.preview = new System.Windows.Forms.Label();
            this.button1 = new System.Windows.Forms.Button(); 
            this.button2 = new System.Windows.Forms.Button();
            this.okCancelTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel(); 
            this.overarchingTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel(); 
            ((System.ComponentModel.ISupportInitialize)(this.dataGrid)).BeginInit();
            this.okCancelTableLayoutPanel.SuspendLayout(); 
            this.overarchingTableLayoutPanel.SuspendLayout();
            this.SuspendLayout();
            //
            // formats 
            //
            resources.ApplyResources(this.formats, "formats"); 
            this.formats.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0); 
            this.formats.Name = "formats";
            // 
            // schemeName
            //
            resources.ApplyResources(this.schemeName, "schemeName");
            this.schemeName.DisplayMember = "SchemeName"; 
            this.schemeName.FormattingEnabled = true;
            this.schemeName.Margin = new System.Windows.Forms.Padding(0, 2, 3, 3); 
            this.schemeName.Name = "schemeName"; 
            this.schemeName.SelectedIndexChanged += new System.EventHandler(this.SchemeName_SelectionChanged);
            // 
            // dataGrid
            //
            resources.ApplyResources(this.dataGrid, "dataGrid");
            this.dataGrid.DataMember = ""; 
            this.dataGrid.HeaderForeColor = System.Drawing.SystemColors.ControlText;
            this.dataGrid.Margin = new System.Windows.Forms.Padding(3, 2, 0, 3); 
            this.dataGrid.Name = "dataGrid"; 
            //
            // preview 
            //
            resources.ApplyResources(this.preview, "preview");
            this.preview.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
            this.preview.Name = "preview"; 
            //
            // button1 
            // 
            resources.ApplyResources(this.button1, "button1");
            this.button1.DialogResult = System.Windows.Forms.DialogResult.OK; 
            this.button1.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
            this.button1.MinimumSize = new System.Drawing.Size(75, 23);
            this.button1.Name = "button1";
            this.button1.Padding = new System.Windows.Forms.Padding(10, 0, 10, 0); 
            this.button1.Click += new System.EventHandler(this.Button1_Clicked);
            // 
            // button2 
            //
            resources.ApplyResources(this.button2, "button2"); 
            this.button2.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.button2.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
            this.button2.MinimumSize = new System.Drawing.Size(75, 23);
            this.button2.Name = "button2"; 
            this.button2.Padding = new System.Windows.Forms.Padding(10, 0, 10, 0);
            // 
            // okCancelTableLayoutPanel 
            //
            resources.ApplyResources(this.okCancelTableLayoutPanel, "okCancelTableLayoutPanel"); 
            this.overarchingTableLayoutPanel.SetColumnSpan(this.okCancelTableLayoutPanel, 2);
            this.okCancelTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
            this.okCancelTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
            this.okCancelTableLayoutPanel.Controls.Add(this.button1, 0, 0); 
            this.okCancelTableLayoutPanel.Controls.Add(this.button2, 1, 0);
            this.okCancelTableLayoutPanel.Margin = new System.Windows.Forms.Padding(0, 6, 0, 0); 
            this.okCancelTableLayoutPanel.Name = "okCancelTableLayoutPanel"; 
            this.okCancelTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
            // 
            // overarchingTableLayoutPanel
            //
            resources.ApplyResources(this.overarchingTableLayoutPanel, "overarchingTableLayoutPanel");
            this.overarchingTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 146F)); 
            this.overarchingTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 182F));
            this.overarchingTableLayoutPanel.Controls.Add(this.okCancelTableLayoutPanel, 0, 2); 
            this.overarchingTableLayoutPanel.Controls.Add(this.preview, 1, 0); 
            this.overarchingTableLayoutPanel.Controls.Add(this.dataGrid, 1, 1);
            this.overarchingTableLayoutPanel.Controls.Add(this.formats, 0, 0); 
            this.overarchingTableLayoutPanel.Controls.Add(this.schemeName, 0, 1);
            this.overarchingTableLayoutPanel.Name = "overarchingTableLayoutPanel";
            this.overarchingTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
            this.overarchingTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); 
            this.overarchingTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
            // 
            // DataGridAutoFormatDialog 
            //
            this.AcceptButton = this.button1; 
            resources.ApplyResources(this, "$this");
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.CancelButton = this.button2;
            this.Controls.Add(this.overarchingTableLayoutPanel); 
            this.MaximizeBox = false;
            this.MinimizeBox = false; 
            this.Name = "DataGridAutoFormatDialog"; 
            this.ShowIcon = false;
            this.HelpRequested += new System.Windows.Forms.HelpEventHandler(this.AutoFormat_HelpRequested); 
            ((System.ComponentModel.ISupportInitialize)(this.dataGrid)).EndInit();
            this.okCancelTableLayoutPanel.ResumeLayout(false);
            this.okCancelTableLayoutPanel.PerformLayout();
            this.overarchingTableLayoutPanel.ResumeLayout(false); 
            this.overarchingTableLayoutPanel.PerformLayout();
            this.ResumeLayout(false); 
        } 

        private static bool IsTableProperty(string propName) { 
            if (propName.Equals("HeaderColor"))
                return true;
            if (propName.Equals("AlternatingBackColor"))
                return true; 
            if (propName.Equals("BackColor"))
                return true; 
            if (propName.Equals("ForeColor")) 
                return true;
            if (propName.Equals("GridLineColor")) 
                return true;
            if (propName.Equals("GridLineStyle"))
                return true;
            if (propName.Equals("HeaderBackColor")) 
                return true;
            if (propName.Equals("HeaderForeColor")) 
                return true; 
            if (propName.Equals("LinkColor"))
                return true; 
            if (propName.Equals("LinkHoverColor"))
                return true;
            if (propName.Equals("SelectionForeColor"))
                return true; 
            if (propName.Equals("SelectionBackColor"))
                return true; 
            if (propName.Equals("HeaderFont")) 
                return true;
            return false; 
        }

        [
            SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")   // See comment inside the method about ignoring errors. 
        ]
        private void SchemeName_SelectionChanged(object sender, EventArgs e) { 
            if (IMBusy) 
                return;
 
            DataRow row = ((DataRowView)schemeName.SelectedItem).Row;
            if (row != null) {
                PropertyDescriptorCollection gridProperties = TypeDescriptor.GetProperties(typeof(DataGrid));
                PropertyDescriptorCollection gridTableStyleProperties = TypeDescriptor.GetProperties(typeof(DataGridTableStyle)); 

                foreach (DataColumn c in row.Table.Columns) { 
                    object value = row[c]; 
                    PropertyDescriptor prop;
                    object component; 

                    if (IsTableProperty(c.ColumnName)) {
                        prop = gridTableStyleProperties[c.ColumnName];
                        component = this.tableStyle; 
                    } else {
                        prop = gridProperties[c.ColumnName]; 
                        component = this.dataGrid; 
                    }
 
                    if (prop != null) {
                        if (Convert.IsDBNull(value) || value.ToString().Length == 0) {
                            prop.ResetValue(component);
                        } else { 
                            try {
                                // Ignore errors setting up the preview... 
                                // The only one that really needs to be handled is the font property, 
                                // where the font in the scheme may not exist on the machine. (#56516)
 
                                TypeConverter converter = prop.Converter;
                                object convertedValue = converter.ConvertFromString(value.ToString());
                                prop.SetValue(component, convertedValue);
                            } catch { 
                            }
                        } 
                    } 
                }
            } 
            /*
            string pictureName = row["SchemePicture"].ToString();
            Bitmap picture = new Bitmap(typeof(DataGridAutoFormatDialog),pictureName);
            schemePicture.Image = picture; 
            */
        } 
 
        public DataRow SelectedData {
            get { 
                if (schemeName != null) {
                    // ListBox uses Windows.SendMessage(.., win.LB_GETCURSEL,... ) to determine the selection
                    // by the time that DataGridDesigner needs this information
                    // the call to SendMessage will fail. this is why we save 
                    // the selectedIndex
                    return ((DataRowView)schemeName.Items[this.selectedIndex]).Row; 
                } 
                return null;
            } 
        }

        internal const string scheme = "" +
  "" + 
    "" +
      "" + 
        "" + 
        "" +
        "" + 
        "" +
        "" +
        "" +
        "" + 
        "" +
        "" + 
        "" + 
        "" +
        "" + 
        "" +
        "" +
        "" +
        "" + 
        "" +
        "" + 
        "" + 
        "" +
        "" + 
        "" +
        "" +
      "" +
    "" + 
  "" +
""; 
        internal const string data = 
"" +
  "" + 
    "Default" +
    "default.bmp" +
    "" +
    "" + 
    "" +
    "" + 
    "" + 
    "" +
    "" + 
    "" +
    "" +
    "" +
    "" + 
    "" +
    "" + 
    "" + 
    "" +
    "" + 
    "" +
    "" +
    "" +
    "" + 
  "" +
  "" + 
    "Professional 1" + 
    "professional1.bmp" +
    "Verdana, 10pt" + 
    "LightGray" +
    "Navy" +
    "White" +
    "Black" + 
    "DarkGray" +
    "Black" + 
    "None" + 
    "Silver" +
    "Black" + 
    "Navy" +
    "Blue" +
    "White" +
    "Black" + 
    "White" +
    "Navy" + 
  "" + 
  "" +
    "Professional 2" + 
    "professional2.bmp" +
    "FixedSingle" +
    "True" +
    "Tahoma, 8pt" + 
    "Gainsboro" +
    "Silver" + 
    "White" + 
    "DarkSlateBlue" +
    "Black" + 
    "White" +
    "DarkGray" +
    "Black" +
    "DarkSlateBlue" + 
    "RoyalBlue" +
    "Black" + 
    "White" + 
    "White" +
    "DarkSlateBlue" + 
  "" +
  "" +
    "Professional 3" +
    "professional3.bmp" + 
    "None" +
    "True" + 
    "Tahoma, 8pt, style=1" + 
    "Tahoma, 8pt, style=1" +
    "Tahoma, 8pt" + 
    "LightGray" +
    "Gainsboro" +
    "Silver" +
    "MidnightBlue" + 
    "LightSteelBlue" +
    "Black" + 
    "DimGray" + 
    "None" +
    "MidnightBlue" + 
    "White" +
    "MidnightBlue" +
    "RoyalBlue" +
    "DarkGray" + 
    "Black" +
    "White" + 
    "CadetBlue" + 
  "" +
  "" + 
    "Professional 4" +
    "professional4.bmp" +
    "None" +
    "True" + 
    "Tahoma, 8pt, style=1" +
    "Tahoma, 8pt, style=1" + 
    "Tahoma, 8pt" + 
    "Lavender" +
    "WhiteSmoke" + 
    "LightGray" +
    "MidnightBlue" +
    "LightSteelBlue" +
    "MidnightBlue" + 
    "Gainsboro" +
    "None" + 
    "MidnightBlue" + 
    "WhiteSmoke" +
    "Teal" + 
    "DarkMagenta" +
    "Gainsboro" +
    "MidnightBlue" +
    "WhiteSmoke" + 
    "CadetBlue" +
  "" + 
  "" + 
    "Classic" +
    "classic.bmp" + 
    "FixedSingle" +
    "True" +
    "Times New Roman, 9pt" +
    "Tahoma, 8pt, style=1" + 
    "Tahoma, 8pt, style=1" +
    "WhiteSmoke" + 
    "Gainsboro" + 
    "DarkGray" +
    "Black" + 
    "DarkKhaki" +
    "Black" +
    "Silver" +
    "Black" + 
    "White" +
    "DarkSlateBlue" + 
    "Firebrick" + 
    "Black" +
    "LightGray" + 
    "White" +
    "Firebrick" +
  "" +
  "" + 
    "Simple" +
    "Simple.bmp" + 
    "FixedSingle" + 
    "True" +
    "Courier New, 9pt" + 
    "Courier New, 10pt, style=1" +
    "Courier New, 10pt, style=1" +
    "White" +
    "White" + 
    "Gainsboro" +
    "Black" + 
    "Silver" + 
    "DarkSlateGray" +
    "DarkGray" + 
    "DarkGreen" +
    "White" +
    "DarkGreen" +
    "Blue" + 
    "Black" +
    "Gainsboro" + 
    "Black" + 
    "DarkSeaGreen" +
  "" + 
  "" +
    "Colorful 1" +
    "colorful1.bmp" +
    "FixedSingle" + 
    "True" +
    "Tahoma, 8pt" + 
    "Tahoma, 9pt, style=1" + 
    "Tahoma, 9pt, style=1" +
    "LightGoldenrodYellow" + 
    "White" +
    "LightGoldenrodYellow" +
    "DarkSlateBlue" +
    "LightGoldenrodYellow" + 
    "DarkSlateBlue" +
    "Peru" + 
    "None" + 
    "Maroon" +
    "LightGoldenrodYellow" + 
    "Maroon" +
    "SlateBlue" +
    "BurlyWood" +
    "DarkSlateBlue" + 
    "GhostWhite" +
    "DarkSlateBlue" + 
  "" + 
  "" +
    "Colorful 2" + 
    "colorful2.bmp" +
    "None" +
    "True" +
    "Tahoma, 8pt" + 
    "Tahoma, 8pt, style=1" +
    "Tahoma, 8pt, style=1" + 
    "GhostWhite" + 
    "GhostWhite" +
    "Lavender" + 
    "White" +
    "RoyalBlue" +
    "MidnightBlue" +
    "RoyalBlue" + 
    "MidnightBlue" +
    "Lavender" + 
    "Teal" + 
    "DodgerBlue" +
    "Lavender" + 
    "MidnightBlue" +
    "PaleGreen" +
    "Teal" +
  "" + 
  "" +
    "Colorful 3" + 
    "colorful3.bmp" + 
    "None" +
    "True" + 
    "Tahoma, 8pt" +
    "Tahoma, 8pt, style=1" +
    "Tahoma, 8pt, style=1" +
    "OldLace" + 
    "OldLace" +
    "Tan" + 
    "OldLace" + 
    "SaddleBrown" +
    "DarkSlateGray" + 
    "Tan" +
    "Solid" +
    "Wheat" +
    "SaddleBrown" + 
    "DarkSlateBlue" +
    "Teal" + 
    "OldLace" + 
    "DarkSlateGray" +
    "White" + 
    "SlateGray" +
  "" +
  "" +
    "Colorful 4" + 
    "colorful4.bmp" +
    "FixedSingle" + 
    "True" + 
    "Tahoma, 8pt" +
    "Tahoma, 8pt, style=1" + 
    "Tahoma, 8pt, style=1" +
    "White" +
    "White" +
    "Ivory" + 
    "Lavender" +
    "DarkSlateBlue" + 
    "Black" + 
    "Wheat" +
    "CadetBlue" + 
    "Black" +
    "DarkSlateBlue" +
    "LightSeaGreen" +
    "Ivory" + 
    "Black" +
    "DarkSlateBlue" + 
    "Wheat" + 
  "" +
  "" + 
    "256 Color 1" +
    "256_1.bmp" +
    "Tahoma, 8pt" +
    "Tahoma, 8 pt" + 
    "Tahoma, 8pt" +
    "Silver" + 
    "White" + 
    "White" +
    "Maroon" + 
    "Black" +
    "Silver" +
    "Silver" +
    "Black" + 
    "Maroon" +
    "Red" + 
    "Silver" + 
    "Black" +
    "White" + 
    "Maroon" +
  "" +
  "" +
    "256 Color 2" + 
    "256_2.bmp" +
    "FixedSingle" + 
    "True" + 
    "Microsoft Sans Serif, 10 pt, style=1" +
    "Tahoma, 8pt" + 
    "Tahoma, 8pt" +
    "White" +
    "White" +
    "White" + 
    "Teal" +
    "Black" + 
    "Silver" + 
    "Black" +
    "White" + 
    "Purple" +
    "Fuchsia" +
    "Gray" +
    "White" + 
    "White" +
    "Maroon" + 
  "" + 
"";
 
        private class AutoFormatDataGrid : DataGrid {
            protected override void OnKeyDown(KeyEventArgs e) {
            }
            protected override bool ProcessDialogKey(Keys keyData) { 
                return false;
            } 
            protected override bool ProcessKeyPreview(ref Message m) { 
                return false;
            } 
            protected override void OnMouseDown(MouseEventArgs e) { }
            protected override void OnMouseUp(MouseEventArgs e) { }
            protected override void OnMouseMove(MouseEventArgs e) { }
        } 
    }
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK