Example #1
0
 /// <summary>
 ///    Clean up any resources being used.
 /// </summary>
 protected override void Dispose(bool disposing)
 {
     try
     {
         if (disposing)
         {
             // Release the added managed resources
             btnBrowse.Dispose();
             lblResults.Dispose();
             txtResults.Dispose();
             lblSearchText.Dispose();
             txtSearchText.Dispose();
             lblFiles.Dispose();
             txtFiles.Dispose();
             btnSearch.Dispose();
             ckRecursive.Dispose();
             lblDir.Dispose();
             txtDir.Dispose();
             lblCurFile.Dispose();
             txtCurFile.Dispose();
         }
     }
     finally
     {
         // Call Dispose on your base class.
         base.Dispose(disposing);
     }
 }
Example #2
0
        private void _btnAddChildForm_Click(object sender, System.EventArgs e)
        {
            // disable sizer light before changes
            _sizerLight.Enabled = false;

            if (_newChild == null)
            {
                // add button
                Rectangle rc = _btnMoveButton.Bounds;
                rc.Offset(0, _btnMoveButton.Height + 3);
                _newChild           = new System.Windows.Forms.Button();
                _newChild.Font      = _btnAddChildForm.Font;
                _newChild.Bounds    = rc;
                _newChild.BackColor = Color.Red;
                _newChild.Text      = "Button added to the form";
                Controls.Add(_newChild);
                _btnAddChildForm.Tag  = _btnAddChildForm.Text;
                _btnAddChildForm.Text = "Remove red button";
            }
            else
            {
                // remove button
                Controls.Remove(_newChild);
                _newChild.Dispose();
                _newChild             = null;
                _btnAddChildForm.Text = (string)_btnAddChildForm.Tag;
            }

            // re-enable sizer light after the changes
            _sizerLight.Enabled = checkBox1.Checked;
        }
Example #3
0
        private void _btnAddChildGroupBox_Click(object sender, System.EventArgs e)
        {
            // disable sizer light before changes
            _sizerLight.Enabled = false;

            if (_newGrandChild == null)
            {
                // add new button
                _newGrandChild      = new System.Windows.Forms.Button();
                _newGrandChild.Font = _btnAddChildGroupBox.Font;
                Rectangle rc = _btnAddChildGroupBox.Bounds;
                rc.Offset(0, rc.Height + 4);
                _newGrandChild.Bounds = rc;
                _newGrandChild.Name   = "_btnAddChildGroupBox";
                _newGrandChild.Text   = "New Grand-child (in a container)";
                groupBox1.Controls.Add(_newGrandChild);
                _btnAddChildGroupBox.Text = "Remove Grand-child";
            }
            else
            {
                // remove button
                groupBox1.Controls.Remove(_newGrandChild);
                _newGrandChild.Dispose();
                _newGrandChild            = null;
                _btnAddChildGroupBox.Text = "Add New Grand-child";
            }

            // re-enable sizer light after the changes
            _sizerLight.Enabled = checkBox1.Checked;
        }
Example #4
0
 public override void Dispose()
 {
     btn1v1.Dispose();
     btnAI.Dispose();
     btnConnect.Dispose();
     btnHost.Dispose();
     btnQuit.Dispose();
 }
Example #5
0
 public static void RemoveFocus(Control ctrl)
 {
     Button btn = new Button();
     btn.Parent = ctrl;
     btn.Left = -9999;
     btn.Top = -9999;
     btn.Focus();
     btn.Dispose();
 }
Example #6
0
        public static void RemoveFocus(Control ctrl)
        {
            Button btn = new Button();

            btn.Parent = ctrl;
            btn.Left   = -9999;
            btn.Top    = -9999;
            btn.Focus();
            btn.Dispose();
        }
Example #7
0
        public void RemoveFocus()
        {
            Button btn = new Button();

            btn.Parent = this;
            btn.Left   = -9999;
            btn.Top    = -9999;
            btn.Focus();
            btn.Dispose();
        }
Example #8
0
        // Node

        protected override void Activate()
        {
            SetButton(new DAE.Client.Controls.ExtendedButton());
            try
            {
                Button.BackColor  = ((Windows.Session)HostNode.Session).Theme.ControlColor;
                Button.Parent     = ((IWindowsContainerElement)Parent).Control;
                Button.ImageAlign = ContentAlignment.MiddleLeft;
                InternalUpdateText();
                InternalUpdateImage();
                InternalUpdateEnabled();
                base.Activate();
            }
            catch
            {
                _button.Dispose();
                SetButton(null);
                throw;
            }
        }
Example #9
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         _btnBack?.Dispose();
         _btnBack = null;
         _btnForward?.Dispose();
         _btnForward = null;
         _content?.Dispose();
         _content = null;
     }
     base.Dispose(disposing);
 }
Example #10
0
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (components != null)
                {
                    components.Dispose();
                }
                containerValidator.Dispose();
                buttonOK.Dispose();
                buttonCancel.Dispose();
                tabControl.Dispose();
            }

            base.Dispose(disposing);
        }
Example #11
0
        /// <summary>
        /// Show editor for config management
        /// </summary>
        public void Show()
        {
            configForm = new Form();
            buttonClose = new Button();
            buttonCancel = new Button();
            dgView = new DataGridView();

            dgView.Parent = configForm;
            dgView.BringToFront();
            dgView.RowHeadersVisible = false;
            buttonCancel.Parent = configForm;
            buttonClose.Parent = configForm;

            configForm.Text = "Config Editor";
            configForm.FormBorderStyle = FormBorderStyle.FixedDialog;
            configForm.MaximizeBox = false;
            configForm.MinimizeBox = false;
            configForm.StartPosition = FormStartPosition.CenterParent;

            Parameterlist.Clear();
            SetSize();

            dgView.Rows.Clear();
            try
            {
                Parameterlist = Read();
            }
            catch
            {
                MessageBox.Show("File Not Found, creating SQL default");
                InitSQLDefaults();
                Parameterlist = Read();
            }

            dgView.Columns.Add("dgName", "Name");
            dgView.Columns.Add("dgValue", "Value");
            dgView.Columns["dgName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            dgView.Columns["dgName"].FillWeight = 40;
            dgView.Columns["dgValue"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            dgView.Columns["dgValue"].FillWeight = 60;

            foreach (CParameter x in Parameterlist)
            {
                dgView.Rows.Add();
                dgView.Rows[dgView.Rows.Count - 2].Cells[0].Value = x.Name;
                dgView.Rows[dgView.Rows.Count - 2].Cells[1].Value = x.Value;
            }

            buttonClose.Click += new EventHandler(buttonClose_Click);
            buttonCancel.Click += new EventHandler(buttonCancel_Click);
            dgView.KeyDown += new KeyEventHandler(dgView_KeyDown);

            configForm.ShowDialog();

            configForm.Dispose();
            buttonClose.Dispose();
            buttonCancel.Dispose();
            dgView.Dispose();
            GC.Collect();
        }
Example #12
0
		public void FocusTest ()
		{
			Form f = null;
			Button c = null, d = null;

			try {
				f = new Form ();
				f.ShowInTaskbar = false;
				f.Visible = true;
				c = new Button ();
				c.Visible = true;
				f.Controls.Add (c);

				d = new Button ();
				d.Visible = false;
				f.Controls.Add (d);

				Assert.IsTrue (c.CanFocus, "Focus1");
				Assert.IsFalse (c.Focused, "Focus2");
				c.Focus ();
				Assert.IsTrue (c.Focused, "Focus3");
				d.Focus ();
				Assert.IsFalse (d.Focused, "Focus4");

				d.Visible = true;
				d.Focus ();
				Assert.IsTrue (d.Focused, "Focus5");
				Assert.IsFalse (c.Focused, "Focus6");

				c.Enabled = false;
				Assert.IsFalse (c.Focused, "Focus7");
			} finally {
				if (f != null)
					f.Dispose ();
				if (c != null)
					c.Dispose ();
				if (d != null)
					d.Dispose ();
			}
		}
		protected void RemoveZoom(ref Button btn)
		{
			if (btn != null)
			{
				btn.Hide();
				btn.Dispose();
				btn = null;    // reset zoom window
			}
		}
Example #14
0
        public static void RemoveForm(Control source, Form form)
        {
            ContainerControl container = source.FindForm() as ContainerControl;

            if (container == null)
                container = source as ContainerControl;

            Button tempButton = new Button();
            tempButton.Visible = false;

            // Add this temporary button to the parent form
            container.Controls.Add(tempButton);

            // Must ensure that temp button is the active one
            container.ActiveControl = tempButton;

            // Remove Form parent
            form.Parent = null;

            // Remove the temporary button
            tempButton.Dispose();
            container.Controls.Remove(tempButton);
        }
Example #15
0
        private static void ShowForm(IWin32Window owner, Uri webpage, string productText, string applicationText, string copyrightText, string applicationPath)
        {
            Font productFont = null;

            PaintItem fullName = null;
            PaintItem dotNetFramework = null;
            PaintItem osVersion = null;
            PaintItem copyright = null;

            Button buttonReadme = null;
            Button buttonClose = null;
            Button buttonWebPage = null;

            using (var form = new Form()) {
                try {
                    form.FormBorderStyle = FormBorderStyle.FixedDialog;
                    form.ShowIcon = false;
                    form.ShowInTaskbar = false;
                    form.MinimizeBox = false;
                    form.MaximizeBox = false;
                    form.AutoSize = false;
                    form.AutoScaleMode = AutoScaleMode.None;
                    form.Text = Resources.Caption;

                    int imageHeight = 32;
                    int maxRight = 320;
                    int maxBottom = 80;
                    using (Graphics graphics = form.CreateGraphics()) {
                        //icon
                        Bitmap bitmap = NativeMethods.GetIconBitmap(applicationPath);
                        if (bitmap != null) {
                            _paintImage = new PaintItem(bitmap, new Point(7, 7));
                        }

                        //title
                        int imageRight = 7;
                        if (_paintImage != null) {
                            imageRight = _paintImage.Rectangle.Right + 7;
                        }
                        if (_paintImage != null) {
                            imageHeight = _paintImage.Rectangle.Height;
                        }
                        productFont = new Font(SystemFonts.MessageBoxFont.Name, imageHeight, SystemFonts.MessageBoxFont.Style, GraphicsUnit.Pixel, SystemFonts.MessageBoxFont.GdiCharSet);
                        _paintProduct = new PaintItem(productText, productFont, imageRight, 7, imageHeight, VerticalAlignment.Center, graphics);

                        _titleHeight = 7 + imageHeight + 7;
                        maxRight = System.Math.Max(maxRight, _paintProduct.Rectangle.Right);
                        maxBottom = System.Math.Max(maxBottom, _titleHeight);

                        //other stuff
                        _infoLines = new List<PaintItem>();

                        fullName = new PaintItem(applicationText, SystemFonts.MessageBoxFont, 7, _titleHeight + 2 + 7, 0, VerticalAlignment.Top, graphics);
                        maxRight = System.Math.Max(maxRight, fullName.Rectangle.Right);
                        maxBottom = System.Math.Max(maxBottom, fullName.Rectangle.Bottom);
                        _infoLines.Add(fullName);

                        dotNetFramework = new PaintItem(".NET framework " + Environment.Version.ToString(), SystemFonts.MessageBoxFont, 7, fullName.Rectangle.Bottom, 0, VerticalAlignment.Top, graphics);
                        maxRight = System.Math.Max(maxRight, dotNetFramework.Rectangle.Right);
                        maxBottom = System.Math.Max(maxBottom, dotNetFramework.Rectangle.Bottom);
                        _infoLines.Add(dotNetFramework);

                        osVersion = new PaintItem(Environment.OSVersion.VersionString, SystemFonts.MessageBoxFont, 7, dotNetFramework.Rectangle.Bottom, 0, VerticalAlignment.Top, graphics);
                        maxRight = System.Math.Max(maxRight, osVersion.Rectangle.Right);
                        maxBottom = System.Math.Max(maxBottom, osVersion.Rectangle.Bottom);
                        _infoLines.Add(osVersion);

                        if (copyrightText != null) {
                            copyright = new PaintItem(copyrightText, SystemFonts.MessageBoxFont, 7, osVersion.Rectangle.Bottom + 7, 0, VerticalAlignment.Top, graphics);
                            maxRight = System.Math.Max(maxRight, copyright.Rectangle.Right);
                            maxBottom = System.Math.Max(maxBottom, copyright.Rectangle.Bottom);
                            _infoLines.Add(copyright);
                        }
                    }

                    int buttonMinRight = 7;

                    //Close button
                    buttonClose = new Button() { Padding = new Padding(3, 1, 3, 1) };
                    buttonClose.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
                    buttonClose.AutoSize = true;
                    buttonClose.DialogResult = DialogResult.OK;
                    buttonClose.Text = Resources.Close;
                    form.Controls.Add(buttonClose);
                    buttonMinRight += buttonClose.Width + 11;

                    //Readme button
                    var readMePath = GetReadMePath();
                    if (readMePath != null) {
                        buttonReadme = new Button() { Padding = new Padding(3, 1, 3, 1) };
                        buttonReadme.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
                        buttonReadme.AutoSize = true;
                        buttonReadme.Text = Resources.ReadMe;
                        buttonReadme.Tag = readMePath;
                        buttonReadme.Click += new EventHandler(buttonReadme_Click);
                        form.Controls.Add(buttonReadme);
                        buttonMinRight += buttonReadme.Width + 7;
                    }

                    //WebPage button
                    if (webpage != null) {
                        buttonWebPage = new Button() { Padding = new Padding(3, 1, 3, 1) };
                        buttonWebPage.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
                        buttonWebPage.AutoSize = true;
                        buttonWebPage.Text = Resources.WebPage;
                        buttonWebPage.Tag = webpage.ToString();
                        buttonWebPage.Click += new EventHandler(buttonWebPage_Click);
                        form.Controls.Add(buttonWebPage);
                        buttonMinRight += buttonWebPage.Width + 7;
                    }

                    maxRight = System.Math.Max(maxRight, buttonMinRight);

                    int borderX = (form.Width - form.ClientRectangle.Width);
                    int borderY = (form.Height - form.ClientRectangle.Height);
                    form.Width = borderX + maxRight + 7;
                    form.Height = borderY + maxBottom + 11 + 11 + buttonClose.Size.Height + 7;
                    if (owner == null) {
                        form.StartPosition = FormStartPosition.CenterScreen;
                    } else {
                        form.StartPosition = FormStartPosition.CenterParent;
                    }

                    int buttonLeft = form.ClientRectangle.Left + 7;

                    if (buttonReadme != null) {
                        buttonReadme.Location = new Point(buttonLeft, form.ClientRectangle.Bottom - buttonClose.Height - 7);
                        buttonLeft += buttonReadme.Width + 7;
                    }

                    if (buttonWebPage != null) {
                        buttonWebPage.Location = new Point(buttonLeft, form.ClientRectangle.Bottom - buttonClose.Height - 7);
                        buttonLeft += buttonWebPage.Width + 7;
                    }

                    buttonClose.Location = new Point(form.ClientRectangle.Right - buttonClose.Width - 7, form.ClientRectangle.Bottom - buttonClose.Height - 7);

                    form.AcceptButton = buttonClose;
                    form.CancelButton = buttonClose;

                    form.Paint += Form_Paint;

                    if (owner != null) {
                        Form formOwner = owner as Form;
                        if ((formOwner != null) && (formOwner.TopMost == true)) {
                            form.TopMost = false;
                            form.TopMost = true;
                        }
                        form.ShowDialog(owner);
                    } else {
                        form.ShowDialog();
                    }
                } finally {
                    if (buttonClose != null) { buttonClose.Dispose(); }
                    if (buttonReadme != null) { buttonReadme.Dispose(); }
                    if (buttonWebPage != null) { buttonWebPage.Dispose(); }

                    if (fullName != null) { fullName.Dispose(); }
                    if (dotNetFramework != null) { dotNetFramework.Dispose(); }
                    if (osVersion != null) { osVersion.Dispose(); }
                    if (copyright != null) { copyright.Dispose(); }

                    if (_paintImage != null) { _paintImage.Dispose(); }
                    if (_paintProduct != null) { _paintProduct.Dispose(); }

                    if (productFont != null) { productFont.Dispose(); }
                }
            }
        }
Example #16
0
        private void btnAbout_Click(object sender, EventArgs e)
        {
            Form aboutForm = new Form() { FormBorderStyle = FormBorderStyle.FixedSingle, MinimizeBox = false, MaximizeBox = false };
            aboutForm.StartPosition = FormStartPosition.CenterParent;
            aboutForm.Width = 400;
            aboutForm.Height = 200;
            aboutForm.Text = "About Clicktastic";
            aboutForm.Icon = Properties.Resources.clicktastic;
            aboutForm.BackColor = Color.Black;

            //Get the version number
            Assembly assembly = Assembly.GetExecutingAssembly();
            FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(assembly.Location);

            Label aboutText = new Label()
            {
                Width = 400,
                Height = 130,
                Location = new Point(0, 0),
                ImageAlign = ContentAlignment.MiddleCenter,
                TextAlign = ContentAlignment.MiddleCenter,
                Text = "Clicktastic v" + fileVersionInfo.ProductMajorPart + "." + fileVersionInfo.ProductMinorPart + "." + fileVersionInfo.ProductBuildPart + "\n\n" +
                    "Mass Click Mouse Buttons or\n" + "Mass Press Keyboard Keys\n\n" +
                    "Programmed and Designed by Coolcord"
            };
            Font aboutFont = new Font("Microsoft Sans Serif", 8, FontStyle.Bold);
            aboutText.Font = aboutFont;
            aboutText.ForeColor = Color.White;
            Button btnOk = new Button() { Width = 100, Height = 30, Text = "OK", Location = new Point(150, 130), ImageAlign = ContentAlignment.MiddleCenter, TextAlign = ContentAlignment.MiddleCenter };
            btnOk.Click += (btnSender, btnE) => aboutForm.Close(); //click ok to close
            btnOk.BackColor = SystemColors.ButtonFace;
            btnOk.UseVisualStyleBackColor = true;
            aboutForm.AcceptButton = btnOk;
            aboutForm.Controls.Add(aboutText);
            aboutForm.Controls.Add(btnOk);

            //Easter Egg =D
            aboutForm.KeyPreview = true;
            CheatCode cheatCode = new CheatCode();
            aboutForm.KeyDown += new KeyEventHandler(cheatCode.GetCheatCode);

            //All done with the about form
            aboutForm.ShowDialog();
            aboutForm.Dispose();
            btnOk.Dispose();
            aboutText.Dispose();
            aboutFont.Dispose();
        }
        private void lblStatus_Click(object sender, EventArgs e)
        {
            Form aboutForm = new Form() { FormBorderStyle = FormBorderStyle.FixedSingle, MinimizeBox = false, MaximizeBox = false };
            aboutForm.StartPosition = FormStartPosition.CenterParent;
            aboutForm.Width = 400;
            aboutForm.Height = 200;
            aboutForm.Text = "About Internet Tester";
            aboutForm.Icon = Internet_Tester.Properties.Resources.Internet_Tester;

            //Get the version number
            Assembly assembly = Assembly.GetExecutingAssembly();
            FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(assembly.Location);

            Label aboutText = new Label()
            {
                Width = 400,
                Height = 130,
                Location = new Point(0, 0),
                ImageAlign = ContentAlignment.MiddleCenter,
                TextAlign = ContentAlignment.MiddleCenter,
                Text = "Internet Tester v" + fileVersionInfo.ProductMajorPart + "." + fileVersionInfo.ProductMinorPart + "." + fileVersionInfo.ProductBuildPart + "\n\n" +
                    "A Simple Program to Quickly\n" + "Check the Internet Connection\n\n" +
                    "Programmed and Designed by Coolcord"
            };
            Font aboutFont = new Font("Microsoft Sans Serif", 8, FontStyle.Bold);
            aboutText.Font = aboutFont;
            Button btnOk = new Button() { Width = 100, Height = 30, Text = "OK", Location = new Point(150, 130), ImageAlign = ContentAlignment.MiddleCenter, TextAlign = ContentAlignment.MiddleCenter };
            btnOk.Click += (btnSender, btnE) => aboutForm.Close(); //click ok to close
            aboutForm.AcceptButton = btnOk;
            aboutForm.Controls.Add(aboutText);
            aboutForm.Controls.Add(btnOk);
            aboutForm.ShowDialog();
            aboutForm.Dispose();
            btnOk.Dispose();
            aboutText.Dispose();
            aboutFont.Dispose();
        }
Example #18
0
        //===========================================================================
        //
        // Functions
        //
        //===========================================================================
        //
        // GetName(string text, string oldName)
        // Opens the get name form, allowing the user to input a name
        //
        private string GetName(string text, string oldName)
        {
            //Construct the form
            string name = null;
            Form nameForm = new Form() { FormBorderStyle = FormBorderStyle.FixedSingle, MinimizeBox = false, MaximizeBox = false };
            nameForm.StartPosition = FormStartPosition.CenterParent;
            nameForm.Width = 200;
            nameForm.Height = 110;
            nameForm.Text = "NSS Keylogger";
            nameForm.Icon = Properties.Resources.nsskeylogger;
            nameForm.BackColor = Color.Black;

            Label lblName = new Label()
            {
                Width = 190,
                Height = 20,
                Location = new Point(5, 2),
                Text = text,
                ForeColor = Color.White
            };

            TextBox tbName = new TextBox()
            {
                Width = 185,
                Height = 20,
                Location = new Point(5, 23),
                Text = oldName
            };

            Button btnOK = new Button()
            {
                Width = 92,
                Height = 25,
                Location = new Point(5, 48),
                ImageAlign = ContentAlignment.MiddleCenter,
                TextAlign = ContentAlignment.MiddleCenter,
                Text = "OK",
                BackColor = SystemColors.ButtonFace,
                UseVisualStyleBackColor = true
            };
            btnOK.Click += (btnOKSender, btnOKe) =>
            {
                name = tbName.Text; //save the name
                nameForm.Close(); //close the form
            };

            Button btnCancel = new Button()
            {
                Width = 92,
                Height = 25,
                Location = new Point(98, 48),
                ImageAlign = ContentAlignment.MiddleCenter,
                TextAlign = ContentAlignment.MiddleCenter,
                Text = "Cancel",
                BackColor = SystemColors.ButtonFace,
                UseVisualStyleBackColor = true
            };
            btnCancel.Click += (btnCancelSender, btnCancele) =>
            {
                nameForm.Close(); //close the form without saving
            };

            //Build the form and show it
            nameForm.AcceptButton = btnOK;
            nameForm.CancelButton = btnCancel;
            nameForm.Controls.Add(lblName);
            nameForm.Controls.Add(tbName);
            nameForm.Controls.Add(btnOK);
            nameForm.Controls.Add(btnCancel);
            nameForm.ShowDialog();

            //Dispose the form's elements
            btnCancel.Dispose();
            btnOK.Dispose();
            tbName.Dispose();
            lblName.Dispose();
            nameForm.Dispose();

            return name;
        }
Example #19
0
 public void RemoveFocus()
 {
     Button btn = new Button();
     btn.Parent = this;
     btn.Left = -9999;
     btn.Top = -9999;
     btn.Focus();
     btn.Dispose();
 }