當前位置: 首頁>>代碼示例>>C#>>正文


C# ComponentModel.Container類代碼示例

本文整理匯總了C#中System.ComponentModel.Container的典型用法代碼示例。如果您正苦於以下問題:C# Container類的具體用法?C# Container怎麽用?C# Container使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Container類屬於System.ComponentModel命名空間,在下文中一共展示了Container類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Connect_Click

        // public decimal Port { get; set; }
        private void Connect_Click(object sender, EventArgs e)
        {
            System.ComponentModel.IContainer components = new System.ComponentModel.Container();
                serialPort1 = new System.IO.Ports.SerialPort(components); // Creating the new object.
                serialPort1.PortName = "COM" + COM.Value.ToString(); // Setting what port number.
                serialPort1.BaudRate = 9600; // Setting baudrate.
                serialPort1.DtrEnable = true; // Enable the Data Terminal Ready

                try
                {
                    serialPort1.Open(); // Open the port for use.
                    isConnected = true;
                    Port = COM.Value;
                }
                catch
                {
                    MessageBox.Show("Device not found");
                }
                finally
                {
                    if (serialPort1.IsOpen)
                    {
                        ConnectButton.Text = "Close";
                        //   ConnectButton.Enabled = false;
                        COM.Enabled = false;
                        SuccessLabel.Text = "Connection succesful";
                    }
                }
        }
開發者ID:terodelarosa,項目名稱:RgbLedController,代碼行數:30,代碼來源:Form2.cs

示例2: Form1

        public Form1()
        {
            InitializeComponent();

            m_backgroundBm = new Bitmap(Image.FromFile("me.jpg"));
            m_frameBuf = new Bitmap(m_backgroundBm.Width, m_backgroundBm.Height);

            m_rippleBufs = new short[2][,] { new short[m_backgroundBm.Height, m_backgroundBm.Width], null };
            for (int y = 0; y < m_rippleBufs[0].GetLength(0); ++y)
            {
                for (int x = 0; x < m_rippleBufs[0].GetLength(1); ++x)
                {
                    m_rippleBufs[0][y, x] = 0;
                }
            }
            m_rippleBufs[1] = (short[,])m_rippleBufs[0].Clone();
            m_activeRippleBuf = 0;

            ClientSize = new Size(m_backgroundBm.Width, m_backgroundBm.Height);
            FormBorderStyle = FormBorderStyle.FixedDialog;
            MinimizeBox = MaximizeBox = false;

            if (components == null) components = new Container();
            Timer timer = new Timer(components);
            timer.Tick += (sender, e) => this.UpdateFrame();
            timer.Interval = 10;
            timer.Start();

            m_paintFps = 0;
            timer = new Timer(components);
            // timer.Tick += (sender, e) => { Debug.Print("paintFps: " + m_paintFps + " updateFps: " + m_updateFps);  m_paintFps = m_updateFps = 0; };
            timer.Interval = 1000;
            timer.Start();
        }
開發者ID:GHScan,項目名稱:DailyProjects,代碼行數:34,代碼來源:Form1.cs

示例3: ShowNotification

        static void ShowNotification(string text, string title)
        {
            var container = new Container();
            var wait = new ManualResetEvent(false);
            var trayicon = new NotifyIcon(container);
            EventHandler done = null;
            done = delegate {
                wait.Set();
                trayicon.BalloonTipClosed  -= done;
                trayicon.BalloonTipClicked -= done;
            };
            trayicon.BalloonTipClicked += done;
            trayicon.BalloonTipClosed  += done;
            trayicon.BalloonTipTitle = title;
            trayicon.BalloonTipText = text;
            var exe = Environment.GetFolderPath(
                            Environment.SpecialFolder.ProgramFilesX86) +
                            @"\iTunes\iTunes.exe";
            var icon = Icon.ExtractAssociatedIcon(exe);
            trayicon.Icon = new Icon(icon, 16, 16);

            trayicon.Visible = true;
            trayicon.ShowBalloonTip(5000);
            wait.WaitOne(10000);
            trayicon.Visible = false;
            trayicon.Dispose();
            icon.Dispose();
            container.Dispose();
        }
開發者ID:pfn,項目名稱:itunes-controller,代碼行數:29,代碼來源:iTunesC.cs

示例4: InitializeComponent

		/// <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();
			this.snoop_     = new NuGenSnoopControl (); 
			this.timer1 = new System.Windows.Forms.Timer(this.components);
			this.SuspendLayout();
			// 
			// snoop_
			// 
			this.snoop_.Dock = System.Windows.Forms.DockStyle.Fill;			
			// 
			// timer1
			// 
			this.timer1.Interval = 10;
			this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
			// 
			// WindowPropertiesView
			// 
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this.snoop_});
			this.Name = "SnoopCarrier";
			this.Size = new System.Drawing.Size(280, 384);
			this.ResumeLayout(false);

		}
開發者ID:xuchuansheng,項目名稱:GenXSource,代碼行數:29,代碼來源:SnoopCarrier.cs

示例5: ConfigurePort

 private void ConfigurePort(string comPort)
 {
     IContainer components = new Container();
     _arduinoPort = new SerialPort(components);
     _arduinoPort.PortName = comPort;
     _arduinoPort.BaudRate = 9600;
 }
開發者ID:karaaie,項目名稱:SLInfo,代碼行數:7,代碼來源:Writer.cs

示例6: Form1

		public Form1()
		{
			this.components = new System.ComponentModel.Container();
			this.Size = new System.Drawing.Size(300,300);
			this.Text = "Scribble.net";
			this.BackColor = Color.White;
			this.MouseDown += 
				new System.Windows.Forms.MouseEventHandler(this.Form_MouseDown);
			this.MouseMove += new MouseEventHandler(MouseMoveHandler);
			this.MouseUp += new MouseEventHandler(MouseUpHandler);
			
			label1 = new System.Windows.Forms.Label();
			label1.Size = new System.Drawing.Size(200, 20);
			label1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			label1.Text = "First Name:";
			this.Controls.Add(label1);
			
			this.SuspendLayout();
			this.Load += new System.EventHandler(this.Form1_Load);

			myBrush = new System.Drawing.SolidBrush(Color.Black);
			
			recognizer = new AlphaRecognizer();
			recognizer.Initialize();
			label1.Text = recognizer.Verify();
		}
開發者ID:jcouv,項目名稱:jcouv.github.io,代碼行數:26,代碼來源:MainForm.cs

示例7: InitializeComponent

    public void InitializeComponent()
    {
        this.components=new System.ComponentModel.Container();
            this.button3=new System.Windows.Forms.Button();
            this.button2=new System.Windows.Forms.Button();
            this.button1=new System.Windows.Forms.Button();

            button2.Location=new System.Drawing.Point(16,40);
            button2.FlatStyle=System.Windows.Forms.FlatStyle.Flat;
            button2.Size=new System.Drawing.Size(408,296);
            button2.TabIndex=1;

            button3.Location=new System.Drawing.Point(200,8);
            button3.Size=new System.Drawing.Size(72,24);
            button3.TabIndex=3;
            button3.Text="&Close";
            button3.Click+=new System.EventHandler(this.button3_Click);

            button1.Location=new System.Drawing.Point(336,8);
            button1.Size=new System.Drawing.Size(80,24);
            button1.TabIndex=2;
            button1.Text="Browse";
            button1.Click+=new System.EventHandler(this.button1_Click);

            this.Text="iText Image Viewer";
            this.AutoScaleBaseSize=new System.Drawing.Size(5,13);
            this.ClientSize=new System.Drawing.Size(448,357);

            this.Controls.Add(this.button3);
            this.Controls.Add(this.button2);
            this.Controls.Add(this.button1);
    }
開發者ID:mymindleaks,項目名稱:iText,代碼行數:32,代碼來源:CPad.cs

示例8: Console

        public Console()
        {
            System.ComponentModel.IContainer components = new System.ComponentModel.Container();
            serialPort1 = new System.IO.Ports.SerialPort(components);
            serialPort1.PortName = "COM1";
            serialPort1.BaudRate = 9600;

            try
            {
                serialPort1.Open();
            }
            catch (Exception)
            {
                //throw;
            }

            if (!serialPort1.IsOpen)
            {
                MessageBox.Show("Error opening serial port " + serialPort1.PortName + ". Application exiting");
                //return;
            }

            serialPort1.DtrEnable = true;
            // start up
            System.Threading.Thread.Sleep(2000);
            serialPort1.DataReceived += OnReceived;
            InitializeComponent();
        }
開發者ID:edgardurao,項目名稱:ArduinoSerialCSharp,代碼行數:28,代碼來源:Console.cs

示例9: GaGa

        /// <summary>
        /// GaGa implementation.
        /// </summary>
        /// <param name="streamsFilePath">
        /// Path for the streams file to use.
        /// </param>
        public GaGa(String streamsFilePath)
        {
            // streams file and loader:
            streamsFile = new StreamsFile(streamsFilePath, "GaGa.Resources.streams.ini");
            menuLoader = new StreamsMenuLoader(streamsFile);

            // gui components:
            container = new Container();

            notifyIcon = new NotifyIcon(container);
            notifyIcon.Visible = true;

            MenuRecreate();

            // error items:
            errorOpenItem = new MenuItem("Error opening streams file (click for details)", OnErrorOpenItemClick);
            errorReadItem = new MenuItem("Error reading streams file (click for details)", OnErrorReadItemClick);

            // constant items:
            editItem = new MenuItem("Edit streams file", OnEditItemClick);
            exitItem = new MenuItem("Exit", OnExitItemClick);

            // playing:
            player = new Player(notifyIcon);
        }
開發者ID:JamieSharpe,項目名稱:GaGa,代碼行數:31,代碼來源:GaGa.cs

示例10: VS2005DockPaneCaption

        public VS2005DockPaneCaption(DockPane pane) : base(pane)
        {
            SuspendLayout();

            Font = PluginCore.PluginBase.Settings.DefaultFont;
            m_components = new Container();
            m_toolTip = new ToolTip(Components);

            // Adjust size based on scale
            double scale = ScaleHelper.GetScale();
            if (scale >= 2) // 200%
            {
                _TextGapTop = 3;
                _TextGapBottom = 6;
                _ButtonGapBottom = 4;
            }
            else if (scale >= 1.5) // 150%
            {
                _TextGapTop = 2;
                _TextGapBottom = 4;
                _ButtonGapBottom = 4;
            }
            else if (scale >= 1.2) // 120%
            {
                _TextGapTop = 2;
                _TextGapBottom = 2;
            }
            // Else 100%

            ResumeLayout();
        }
開發者ID:ImaginationSydney,項目名稱:flashdevelop,代碼行數:31,代碼來源:VS2005DockPaneCaption.cs

示例11: LeanKitNotifierApplicationContext

		public LeanKitNotifierApplicationContext()
		{
			var container = new Container();
			var contextMenu = new ContextMenu();

			//var displaySettings = new MenuItem("Settings");
			//displaySettings.Click += DisplaySettingsOnClick;
			//contextMenu.MenuItems.Add(displaySettings);

			var exitMenu = new MenuItem("Exit");
			exitMenu.Click += ExitMenuOnClick;
			contextMenu.MenuItems.Add(exitMenu);

			// Create the NotifyIcon.
			var iconPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\app.ico";

			_notifyIcon = new NotifyIcon(container)
			{
				Icon = new Icon(iconPath),
				ContextMenu = contextMenu,
				Visible = true,
				Text = @"LeanKit Notifier"
			};

			InitializeLeanKitMonitoring();
		}
開發者ID:manotejmeka,項目名稱:LeanKit.API.Client,代碼行數:26,代碼來源:LeanKitNotifierApplicationContext.cs

示例12: FindDuplicates

        public FindDuplicates()
        {
            InitializeComponent();

            if (components == null)
                components = new Container();

            duplicates = new Queue<KeyValuePair<Duplicate,Duplicate>>(DataStore.Database.FindDuplicateListItems());

            if (duplicates.Count == 0) {
                MessageBox.Show(Properties.Resources.NoDuplicateEntriesFound, base.Text, MessageBoxButtons.OK,
                                MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                Close();
                return;
            }

            GoToNext();

            leftTermEditor.ItemDeleted += TermEditorItemDeleted;
            rightTermEditor.ItemDeleted += TermEditorItemDeleted;

            var boldFont = new Font(base.Font, FontStyle.Bold);
            components.Add(new DisposableComponent(boldFont));
            leftListName.Font = rightListName.Font = boldFont;
        }
開發者ID:lehoaian,項目名稱:szotar,代碼行數:25,代碼來源:FindDuplicates.cs

示例13: ObedienceContext

        internal ObedienceContext()
        {
            //Instantiate the component Module to hold everything
            _components = new System.ComponentModel.Container();
            Trace.Listeners.Add(new TextWriterTraceListener("C:\\temp\\Obedience.log"));
            
            //Instantiate the NotifyIcon attaching it to the components container and 
            //provide it an icon, note, you can imbed this resource 
            _notifyIcon = new NotifyIcon(_components);
            _notifyIcon.Icon = Resources.AppIcon;
            _notifyIcon.Text = "Obedience";
            _notifyIcon.Visible = true;

            //Instantiate the context menu and items
            var contextMenu = new ContextMenuStrip();
            var displayForm = new ToolStripMenuItem();
            var exitApplication = new ToolStripMenuItem();

            //Attach the menu to the notify icon
            _notifyIcon.ContextMenuStrip = contextMenu;

            //Setup the items and add them to the menu strip, adding handlers to be created later
            displayForm.Text = "Do something";
            displayForm.Click += mDisplayForm_Click;
            contextMenu.Items.Add(displayForm);

            exitApplication.Text = "Exit";
            exitApplication.Click += mExitApplication_Click;
            contextMenu.Items.Add(exitApplication);
            Trace.WriteLine("Obedience started");
            scanner = new AcdController(new IPEndPoint(new IPAddress(new byte[] {10, 0, 3, 220}), 5003));
            //scanner.Reboot();
            Trace.AutoFlush = true;
            scanner.ConnectedChanged += new ConnectedChangedEventHandler(scanner_ConnectedChanged);
        }
開發者ID:Cool2Feel,項目名稱:cuda-fingerprinting,代碼行數:35,代碼來源:ObedienceContext.cs

示例14: InitializeComponent

 /// <summary>
 ///    Required method for Designer support - do not modify
 ///    the contents of this method with the code editor.
 /// </summary>
 void InitializeComponent () {
     this.components = new System.ComponentModel.Container ();
     this.ForeColor = System.Drawing.Color.White;
     this.BackColor = System.Drawing.Color.Black;
     this.Size = new System.Drawing.Size(100, 23);
     this.Text = "FlashTrackBar";
 }
開發者ID:yaronthurm,項目名稱:TagFolders,代碼行數:11,代碼來源:FlashTrackBar.cs

示例15: MultiTextControl

        public MultiTextControl(WritingSystemCollection allWritingSystems)
        {
            SuspendLayout();
            _allWritingSystems = allWritingSystems;
            components = new Container();
            InitializeComponent();
            _textBoxes = new List<WeSayTextBox>();
            //this.BackColor = System.Drawing.Color.Crimson;
            _writingSystemLabelFont = new Font(FontFamily.GenericSansSerif, 9);

            if (-1 == WidthForWritingSystemLabels)
            {
                //happens when this is from a hand-placed designer piece,
                //in which case we don't really care about aligning anyhow
                ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize)); //ws label
            }
            else
            {
                ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, WidthForWritingSystemLabels));
            }
            ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100)); //text
            ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize)); //annotation widget

            ResumeLayout(false);
        }
開發者ID:bbriggs,項目名稱:wesay,代碼行數:25,代碼來源:MultiTextControl.cs


注:本文中的System.ComponentModel.Container類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。