public static void ShowForm(Form form, bool show)
 {
     if (form.InvokeRequired)
     {
         form.BeginInvoke(new Action(() =>
         {
             if (show)
             {
                 form.Show();
                 form.BringToFront();
                 form.WindowState = FormWindowState.Normal;
             }
             else
             {
                 form.Hide();
                 form.WindowState = FormWindowState.Minimized;
             }
         }));
     }
     else
     {
         if (show)
         {
             form.Show();
             form.BringToFront();
             form.WindowState = FormWindowState.Normal;
         }
         else
         {
             form.Hide();
             form.WindowState = FormWindowState.Minimized;
         }
     }
 }
示例#2
0
 virtual protected void toBattle()
 {
     currentForm.Hide();
     currentState = battleState;
     currentForm  = currentState.StateView();
     currentForm.Show();
 }
示例#3
0
 public static void toBattle(Event e)
 {
     currentForm.Hide();
     currentState = battleState;
     currentForm  = currentState.StateView();
     //((BattleViewForm)currentForm).newBattle((BattleEvent)e);
     currentForm.Show();
     ((BattleViewForm)currentForm).newBattle((BattleEvent)e);
 }
示例#4
0
 public Reserva(Form parent, int opType)
 {
     this.parentForm = parent;
     this.operationType = opType;
     InitializeComponent();
     parent.Hide();
 }
 /// <summary>
 /// Shows a blank game screen.
 /// </summary>
 /// <param name="form">This form will be hidden.</param>
 public static void EnterNewPuzzle(Form form)
 {
     form.Hide();
     GameForm gform = new GameForm(new Grid(), false);
     gform.ShowDialog();
     form.Close();
 }
示例#6
0
        public XnaGame( IMainForm mainForm )
        {
            _mainForm = mainForm ;

            _drawSurface = _mainForm.GetHandle( ) ;

            Logger.Instance.log("Game1 creation started.");

            _graphics = new GraphicsDeviceManager( this )
                {
                    PreferredBackBufferWidth = 800,
                    PreferredBackBufferHeight = 600
                } ;

            Content.RootDirectory = "Content";

            _graphics.PreparingDeviceSettings += graphics_PreparingDeviceSettings;

            _winform = (Form)Form.FromHandle(Window.Handle);

            _winform.VisibleChanged += game1VisibleChanged;
            _winform.Size = new Size(10, 10);

            Mouse.WindowHandle = _drawSurface;

            Size pictureBoxSize = _mainForm.CanvasSize ;

            ResizeBackBuffer( pictureBoxSize.Width, pictureBoxSize.Height ) ;

            _winform.Hide();
        }
示例#7
0
		public void Activated ()
		{
			if (TestHelper.RunningOnUnix)
				Assert.Ignore ("#3 fails");

			_form = new Form ();
			EventLogger logger = new EventLogger (_form);
			_form.ShowInTaskbar = false;
			Assert.AreEqual (0, logger.CountEvents ("Activated"), "#1");
			_form.Activate ();
			Application.DoEvents ();
			Assert.AreEqual (0, logger.CountEvents ("Activated"), "#2");
			_form.Show ();
			Application.DoEvents ();
			Assert.AreEqual (1, logger.CountEvents ("Activated"), "#3");
			_form.Show ();
			Application.DoEvents ();
			Assert.AreEqual (1, logger.CountEvents ("Activated"), "#4");
			_form.Activate ();
			Application.DoEvents ();
			Assert.AreEqual (1, logger.CountEvents ("Activated"), "#5");
			_form.Hide ();
			Application.DoEvents ();
			Assert.AreEqual (1, logger.CountEvents ("Activated"), "#6");
			_form.Show ();
			Application.DoEvents ();
			Assert.AreEqual (2, logger.CountEvents ("Activated"), "#7");
		}
示例#8
0
 private void bunifuButton1_Click(object sender, EventArgs e) // Check Passcode if right cd to Sign Up Form, else message box for user
 {
     if (textBox1.Text != passcode || string.IsNullOrWhiteSpace(textBox1.Text) || string.IsNullOrEmpty(textBox1.Text))
     {
         if (string.IsNullOrEmpty(textBox1.Text))
         {
             MessageBox.Show("Please fill code in blank space", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else if (string.IsNullOrWhiteSpace(textBox1.Text))
         {
             MessageBox.Show("Please fill code in blank space", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else if (textBox1.Text != passcode)
         {
             MessageBox.Show("Please re-check your code", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     else if (textBox1.Text == passcode)
     {
         SignUp signUp = new SignUp();
         Out.Hide();
         signUp.Show();
         this.Hide();
     }
 }
示例#9
0
 public SystemForm(Form previous,StreamReader reader, StreamWriter writer)
 {
     InitializeComponent();
     this.reader = reader;
     this.writer = writer;
     previous.Hide();
 }
示例#10
0
        public void Entrar(Form f, TextBox user, TextBox pass)
        {
            try{

            sql = new SqlConnection(CadCon.Servidor());
            sql.Open();

            cmd = new SqlCommand("Entrar", sql);
            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.AddWithValue("@usuario", user.Text);
            cmd.Parameters.AddWithValue("@pass", pass.Text);
             int operacion = cmd.ExecuteNonQuery();
             DataTable d = new DataTable();
             SqlDataAdapter data = new SqlDataAdapter(cmd);
                data.Fill(d);

               if (d.Rows.Count >0)
                {
                    LoadThread lt = new LoadThread();
                   lt.Show();
                   f.Hide();
                }
                else {
                    MessageBox.Show("Nombre de usuario o contraseña incorrectos\n", "",
                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    user.Focus();
                    pass.Clear();
                  }
                cmd.Dispose();
                sql.Close();
              }
              catch (SqlException s) { MessageBox.Show(s.Message); }
        }
示例#11
0
        public Game1(IntPtr drawSurface)
        {
            Logger.Instance.log("Game1 creation started.");

            Instance = this;

            graphics = new GraphicsDeviceManager(this);
            graphics.PreferredBackBufferWidth  = 800;
            graphics.PreferredBackBufferHeight = 600;

            Content.RootDirectory = "Content";

            Logger.Instance.log("Creating Winform.");
            this.drawSurface = drawSurface;
            graphics.PreparingDeviceSettings += new EventHandler <PreparingDeviceSettingsEventArgs>(graphics_PreparingDeviceSettings);
            winform = (Forms.Form)Forms.Form.FromHandle(Window.Handle);
            winform.VisibleChanged += new EventHandler(Game1_VisibleChanged);
            winform.Size            = new System.Drawing.Size(10, 10);
            Mouse.WindowHandle      = drawSurface;
            resizebackbuffer(MainForm.Instance.pictureBox1.Width, MainForm.Instance.pictureBox1.Height);
            winform.Hide();
            Logger.Instance.log("Winform created.");

            Logger.Instance.log("Game1 creation ended.");
        }
示例#12
0
        /// <summary>Displays Any String</summary>
        /// <param name="StringToDisplay">Object with Properties to edit</param>
        /// <param name="pDaddy">Parent Form Or Nothing (null)</param>
        /// <param name="strTitle">Window Title</param>
        public static void DisplayABigString(string StringToDisplay, System.Windows.Forms.Control pDaddy, string strTitle = "")
        {
            System.Windows.Forms.Form frmEO = new System.Windows.Forms.Form();
            TextBox T = new TextBox()
            {
                Multiline = true, ScrollBars = ScrollBars.Both, Dock = DockStyle.Fill, WordWrap = false
            };

            frmEO.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
            frmEO.Text            = strTitle;
            frmEO.Controls.Add(T);
            T.Text            = StringToDisplay;
            T.Font            = CourierNew();
            T.SelectionStart  = 0;
            T.SelectionLength = 0;
            T.KeyDown        += TextBox_KeyDown;
            frmEO.Hide();
            frmEO.Height = 640;
            frmEO.Width  = 640;
            System.Windows.Forms.Application.DoEvents();
            if (pDaddy == null)
            {
                frmEO.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
                frmEO.ShowDialog();
            }
            else
            {
                frmEO.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
                frmEO.ShowDialog(pDaddy);
            }
            frmEO.Dispose();
        }
示例#13
0
 public static void mostrarNuevaVentana(Form ventanaNueva, Form ventanaPadre)
 {
     ventanaNueva.Visible = true;
     ventanaNueva.Activate();
     ventanaNueva.Select();
     ventanaPadre.Hide();
 }
示例#14
0
 public void Logout(Form currentForm)
 {
     currentForm.Hide();
     _appGlobal.Logout();
     Program.LoginForm.Show();
     currentForm.Dispose();
 }
示例#15
0
        public Game1(IntPtr drawSurface)
        {
            Logger.Instance.log("Game1 creation started.");

            Instance = this;

            graphics = new GraphicsDeviceManager(this);
            graphics.PreferredBackBufferWidth = 800;
            graphics.PreferredBackBufferHeight = 600;

            Content.RootDirectory = "Content";

            Logger.Instance.log("Creating Winform.");
            this.drawSurface = drawSurface;
            graphics.PreparingDeviceSettings += new EventHandler<PreparingDeviceSettingsEventArgs>(graphics_PreparingDeviceSettings);
            winform = (Forms.Form)Forms.Form.FromHandle(Window.Handle);
            winform.VisibleChanged += new EventHandler(Game1_VisibleChanged);
            winform.Size = new System.Drawing.Size(10, 10);
            Mouse.WindowHandle = drawSurface;
            resizebackbuffer(MainForm.Instance.pictureBox1.Width, MainForm.Instance.pictureBox1.Height);
            winform.Hide();
            Logger.Instance.log("Winform created.");

            Logger.Instance.log("Game1 creation ended.");
        }
示例#16
0
  public static void openFile( Form plcType,
                               Form main,
                               ComboBox height,
                               ToolStripProgressBar mLoad,
                               ToolStripStatusLabel mStatus )
  {
   bool noFile = true, cancel = false;
   OpenFileDialog openDiag;
   DialogResult res;
   String filename;

   mnuHeight = height;
   mnuLoad = mLoad;
   mnuStatus = mStatus;
   init = true;

   plcType.Hide();

   while( noFile ^ cancel )
   {
    openDiag              = new OpenFileDialog();
    openDiag.Multiselect  = false;
    openDiag.AddExtension = true;
    openDiag.DefaultExt   = "dat";
    openDiag.Filter       = "Minecraft Levels (*.dat)|*.dat|" + 
                            "All Files (*.*)|*.*";

    res = openDiag.ShowDialog();

    plcType.Show();

    if( res == DialogResult.Cancel )
     cancel = true;

    else
    {
     filename  = openDiag.FileName;
     
     noFile   = false;
     openDiag.Dispose();

     lvl = AnvilWorld.Open( filename );

     if( lvl == null )
      MessageBox.Show( "That file was not a compatible Minecraft level.",
                       "Open File Error",
                       MessageBoxButtons.OK,
                       MessageBoxIcon.Error );
     
     else
     {
      regDiag = new SelectRegion( lvl.GetRegionManager(), main );
      loadLimits();
      selectRegion( true );

     }     
    }
   }
  }
示例#17
0
        public PersonDetailForm(Form parent, Type type)
        {
            this.parent = parent;
            this.type = type;
            InitializeComponent();
            InitInputs();

            parent.Hide();
        }
示例#18
0
 public Dialog_Form(String Title, String Prompt, Form formPadre)
 {
     InitializeComponent();
     this.label_Prompt.Text = Prompt;
     this.Text = Title;
     parent_Form = formPadre;
     parent_Form.Hide();
     this.Show();
 }
示例#19
0
        public PersonIndexForm(Form parent, Type type)
        {
            this.parent = parent;
            this.type = type;
            InitializeComponent();
            InitPersonsList();

            parent.Hide();
        }
示例#20
0
 /// <summary>
 /// 首页内容区域替换窗体接口
 /// </summary>
 /// <param name="needRplaceform">被替换的窗体</param>
 /// <param name="replaceForm">替换的窗体</param>
 public static void changeFormToIndex(Form needRplaceform, Form replaceForm)
 {
     replaceForm.TopLevel = false;
     //添加目标窗体
     needRplaceform.Parent.Controls.Add(replaceForm);
     //移除被替换窗体
     needRplaceform.Parent.Controls.Remove(needRplaceform);
     replaceForm.Show();
     needRplaceform.Hide();
 }
示例#21
0
 private void Dtg_Frm_Shw(System.Windows.Forms.Form myctl, bool myshw)
 {
     if (myshw)
     {
         myctl.Show();
     }
     else
     {
         myctl.Hide();
     }
 }
示例#22
0
 public static void StartSplashScreen(Form mainForm, SplashScreenOptions options)
 {
     callingForm = mainForm;
     formTitle = callingForm.Text;
     callingForm.Hide();
     Thread splashthread = new Thread(new ParameterizedThreadStart(SplashScreen.ShowSplashScreen));
     splashthread.IsBackground = true;
     splashthread.Start(options);
     Thread.Sleep(100);
     callingForm.Activate();
 }
        internal static void ShowAndHide(Form sourceForm, Form destinationForm)
        {
            destinationForm.Show();
            rebaseContext(sourceForm, destinationForm);
            sourceForm.Hide();

            lock (hiddenForms)
            {
                hiddenForms.Add(destinationForm, sourceForm);
                destinationForm.FormClosed += new FormClosedEventHandler(formClosed);
            }
        }
        /// <summary>
        /// Runs platform-specific graphics initialization
        /// </summary>
        public void Init( )
        {
            //	Create a 1x1 display to initialize OpenGL
            //	TODO: AP: There must be an easier way to do this...

            Form displayHost = new Form( );
            displayHost.Size = new Size( 1, 1 );
            displayHost.Controls.Add( new Display( ) );
            displayHost.Show( );
            displayHost.Hide( );

            s_DisplayHost = displayHost;
        }
示例#25
0
 /// <summary>
 /// Shows the dialog for creating a puzzle. May also show the new game screen.
 /// </summary>
 /// <param name="form">This form will be hidden.</param>
 public static void GeneratePuzzle(Form form)
 {
     Cursor.Current = Cursors.WaitCursor;
     DifficultyForm dform = new DifficultyForm();
     Cursor.Current = Cursors.Default;
     dform.ShowDialog();
     if (dform.HasResult)
     {
         form.Hide();
         GameForm gform = new GameForm(dform.Result, true);
         gform.ShowDialog();
         form.Close();
     }
 }
示例#26
0
文件: Editor.cs 项目: rtshadow/miscs
 //forms controling
 public void AddNewForm(Form newForm,String name, String parent)
 {
     TreeNode temp = new TreeNode(name);
     temp.Tag = newForm;
     if (nodes.ContainsKey(parent)) //if there is a appropriate node it will be the parent
         nodes[parent].Nodes.Add(temp);
     else
         form.treeView1.Nodes.Add(temp); //elsewhere treeView is a parent
     nodes.Add(name, temp);
     InOut.mainIO.CaptureForm(newForm);
     newForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; //cannot change its size
     newForm.TopMost = true;
     newForm.Show();
     newForm.Hide();
 }
示例#27
0
 private void button12_Click(object sender, EventArgs e)
 {
     //MessageBox.Show(this, Properties.Settings.Default.passkey);
     if (txtPassword.Text == Properties.Settings.Default.passkey)
     {
         frmConfig frm = new frmConfig(frmUtama);
         frm.Show();
         frmUtama.Hide();
         this.Close();
     }
     else
     {
         MessageBox.Show(this, "PIN Salah!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
         txtPassword.Text = "";
     }
 }
示例#28
0
        public static void GetFormPosition(System.Windows.Forms.Form form)
        {
            string skey;

            // Create registry key for form
            skey = "Software\\OricExplorer\\" + form.Name;
            RegistryKey key = Registry.CurrentUser.OpenSubKey(skey, true);

            // The key doesn't exist, exit
            if (key == null)
            {
                form.Show();
                return;
            }

            // Get window state
            if (key.GetValue("State") == null)
            {
                form.Show();
            }
            else
            {
                if ((string)key.GetValue("State") == "True")
                {
                    form.Show();
                }
                else
                {
                    form.Hide();
                }
            }

            if (key.GetValue("X") != null && key.GetValue("Y") != null)
            {
                form.Location = new Point((int)key.GetValue("X"), (int)key.GetValue("Y"));
            }

            if (key.GetValue("Width") != null)
            {
                form.Width = (int)key.GetValue("Width");
            }

            if (key.GetValue("Height") != null)
            {
                form.Height = (int)key.GetValue("Height");
            }
        }
示例#29
0
        public LeaderForm(Form previous, NetworkStream stream, StreamReader reader, StreamWriter writer)
        {
            InitializeComponent();
            this.reader = reader;
            this.writer = writer;
            this.stream = stream;
            previous.Hide();
            lstHeader.Text = "Number/tIssue Date/tStatus/tDue Date";

            string ticketInfo = reader.ReadLine();

            while(!ticketInfo.Equals("."))
            {
                lstTickets.Items.Add((String)ticketInfo.Replace("##","\t"));
                ticketInfo = reader.ReadLine();
            }
        }
 public void SetFill(Form ob_form)
 {
     if (ob_form != null)
     {
         ob_form.Show();
         ob_form.Dock = DockStyle.Fill;
         int currwidth = ob_form.Width;
         int currheight = ob_form.Height;
         int currtop = ob_form.Top;
         int currleft = ob_form.Left;
         ob_form.Hide();
         ob_form.Dock = DockStyle.None;
         ob_form.Width = currwidth;
         ob_form.Height = currheight;
         ob_form.Left = currleft;
         ob_form.Top = currtop;
     }
 }
示例#31
0
        public GravityEditor(IntPtr drawSurface)
        {
            Instance = this;

            graphics = new GraphicsDeviceManager(this);
            graphics.PreferredBackBufferWidth = 800;
            graphics.PreferredBackBufferHeight = 600;

            Content.RootDirectory = "Content";

            this.drawSurface = drawSurface;
            graphics.PreparingDeviceSettings += new EventHandler<PreparingDeviceSettingsEventArgs>(graphics_PreparingDeviceSettings);
            winform = (Forms.Form)Forms.Form.FromHandle(Window.Handle);
            winform.VisibleChanged += new EventHandler(GravityEditor_VisibleChanged);
            winform.Size = new System.Drawing.Size(10, 10);
            Mouse.WindowHandle = drawSurface;
            resizeBackBuffer(MainWindow.Instance.drawingBox.Width, MainWindow.Instance.drawingBox.Height);
            winform.Hide();
        }
		public void Size2 ()
		{
			Form f = new Form ();
			f.ShowInTaskbar = false;
			f.Show ();

			ToolStrip ts = new ToolStrip ();
			f.Controls.Add (ts);
			ToolStripOverflowButton tsi = ts.OverflowButton;

			Assert.AreEqual (new Size (16, 25), tsi.Size, "B1");
			Assert.AreEqual (false, tsi.Visible, "B3");
			ToolStripItem test = ts.Items.Add ("test");
			test.Overflow = ToolStripItemOverflow.Always;
			ts.PerformLayout ();

			Assert.AreEqual (Size.Empty, tsi.Size, "B2");
			f.Hide ();
		}
示例#33
0
 //thay đổi layout
 private void ChangeLayout(System.Windows.Forms.Form f)
 {
     f.MdiParent       = this;
     f.StartPosition   = FormStartPosition.Manual;
     f.Dock            = DockStyle.Fill;
     f.FormBorderStyle = FormBorderStyle.None;
     if (this.ActiveMdiChild != null)
     {
         System.Windows.Forms.Form formCurent = this.ActiveMdiChild;
         if (formCurent.Name != f.Name)
         {
             formCurent.Hide();
             f.Show();
         }
     }
     else
     {
         f.Show();
     }
 }
示例#34
0
    /// <summary>
    /// Recieves a form and an integer value representing the operation to perform when the closing
    /// event is fired.
    /// </summary>
    /// <param name="form">The form that fire the event.</param>
    /// <param name="operation">The operation to do while the form is closing.</param>
    public static void CloseOperation(System.Windows.Forms.Form form, int operation)
    {
        switch (operation)
        {
        case 0:
            break;

        case 1:
            form.Hide();
            break;

        case 2:
            form.Dispose();
            break;

        case 3:
            form.Dispose();
            System.Windows.Forms.Application.Exit();
            break;
        }
    }
示例#35
0
        /// <summary>
        /// Loads a game from disk (showing load dialog) and then shows the game form.
        /// </summary>
        /// <param name="form">This form will be hidden.</param>
        public static bool LoadGame(Form form)
        {
            bool result = false;
            File fileOpener = new File();
            OpenFileDialog dialog = new OpenFileDialog();
            dialog.Filter = "Sudoku Game|*.sud";
            dialog.Title = "Load Game";
            dialog.ShowDialog();

            if (dialog.FileName != "")
            {
                form.Hide();
                Grid newGrid = new Grid();
                fileOpener.ReadFile(newGrid, dialog.FileName);
                GameForm gform = new GameForm(newGrid, true);
                gform.ShowDialog();
                form.Close();
                result = true;
            }
            return result;
        }
示例#36
0
        private static void CreateProgressBar()
        {
            // Create a form and keep it running in a seperate thread.
            progressBarThread = new Thread(
                new ThreadStart(
                    (Action) delegate
            {
                Form form            = new System.Windows.Forms.Form();
                form.BackColor       = System.Drawing.Color.FromArgb(((int)(((byte)(74)))), ((int)(((byte)(150)))), ((int)(((byte)(134)))));
                form.Text            = "Please wait.";
                form.FormBorderStyle = FormBorderStyle.FixedToolWindow;
                form.StartPosition   = FormStartPosition.CenterParent;
                form.MinimizeBox     = false;
                form.MaximizeBox     = false;
                form.ControlBox      = false;

                form.ClientSize = new Size(117, 40);

                ProgressBar progressBar = new ProgressBar();
                progressBar.Minimum     = 0;
                progressBar.Maximum     = 100;
                progressBar.Text        = "Loading...";
                progressBar.Anchor      = AnchorStyles.Top | AnchorStyles.Left;
                progressBar.Location    = new Point(8, 8);
                progressBar.AutoSize    = true;
                progressBar.Style       = ProgressBarStyle.Marquee;

                form.Controls.AddRange(new Control[] { progressBar });

                form.Show();
                form.Hide();

                progressBarForm = form;

                System.Windows.Forms.Application.Run();
            }
                    )
                );
            progressBarThread.Start();
        }
示例#37
0
        public Animator(IntPtr drawSurface)
        {
            Instance = this;

            _graphics = new GraphicsDeviceManager(this);
            _graphics.PreferredBackBufferWidth  = 600;
            _graphics.PreferredBackBufferHeight = 450;

            Content.RootDirectory = "Content";

            _drawSurface = drawSurface;
            _graphics.PreparingDeviceSettings += new EventHandler <PreparingDeviceSettingsEventArgs>(graphics_PreparingDeviceSettings);

            Winform = (Forms.Form)Forms.Form.FromHandle(Window.Handle);
            Winform.VisibleChanged += new EventHandler(Animator_VisibleChanged);
            Winform.Size            = new System.Drawing.Size(10, 10);

            Mouse.WindowHandle = drawSurface;
            resizebackbuffer(MainForm.Instance.showcase.Width, MainForm.Instance.showcase.Height);

            Winform.Hide();
        }
示例#38
0
        public ScreenRectangle()
        {
            //initialize the form
            this._form = new Form();

            _form.FormBorderStyle = FormBorderStyle.None;
            _form.ShowInTaskbar = false;
            _form.TopMost = true;
            _form.Visible = false;
            _form.Left = 0;
            _form.Top = 0;
            _form.Width = 1;
            _form.Height = 1;
            _form.Show();
            _form.Hide();
            _form.Opacity = 0.2;
            
            //set popup style
            int num1 = UnsafeNativeMethods.GetWindowLong(_form.Handle, -20);
            UnsafeNativeMethods.SetWindowLong(_form.Handle, -20, num1 | 0x80);

            this._color = Color.Black;
        }
示例#39
0
        public bool BuscarUsuario(Form t, string user)
        {
            string query = "Select *From Usuarios where Usuario='"+user+"'";

            try {
                sql = new SqlConnection(CadCon.Servidor());
                sql.Open();
                cmd = new SqlCommand(query, sql);
                cmd.ExecuteNonQuery();
                dt = new DataTable();
                sda = new SqlDataAdapter(cmd);
                sda.Fill(dt);
                int row = dt.Rows.Count;
                if (row == 0)
                {
                    MessageBox.Show(t, "La búsqueda no arrojó resultados:\n"
                                   +"El nombre de usuario proporcionado no concuerda \n"
                                   +"con la información almacenada en la base de datos","Lo sentimos...",
                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return false;

                }
                else
                {

                    t.Hide();

                    return true;
                }

            }
            catch (SqlException s) { MessageBox.Show(s.Message); }
            cmd.Dispose();
            sql.Close();
            return false;
        }
示例#40
0
		public void BehaviorMdiWindowMenuItem ()
		{
			Form f = new Form ();
			f.ShowInTaskbar = false;
			f.IsMdiContainer = true;
			Form c1 = new Form ();
			c1.MdiParent = f;
			Form c2 = new Form ();
			c2.MdiParent = f;
		
			MenuStrip ms = new MenuStrip ();
			ToolStripMenuItem tsmi = (ToolStripMenuItem)ms.Items.Add ("Window");
			f.Controls.Add (ms);
			ms.MdiWindowListItem = tsmi;
			
			Assert.AreSame (tsmi, ms.MdiWindowListItem, "Q1");
			Assert.AreEqual (0, tsmi.DropDownItems.Count, "Q2");
			
			f.MainMenuStrip = ms;
			Assert.AreEqual (0, tsmi.DropDownItems.Count, "Q3");

			c1.Show ();
			Assert.AreEqual (0, tsmi.DropDownItems.Count, "Q4");

			f.Show ();
			Assert.AreEqual (1, tsmi.DropDownItems.Count, "Q5");
			Assert.AreEqual (true, (tsmi.DropDownItems[0] as ToolStripMenuItem).Checked, "Q6");
			
			c2.Show ();
			Assert.AreEqual (2, tsmi.DropDownItems.Count, "Q7");
			Assert.AreEqual (true, (tsmi.DropDownItems[1] as ToolStripMenuItem).Checked, "Q8");

			Form c3 = new Form ();
			c3.MdiParent = f;
			Assert.AreEqual (2, tsmi.DropDownItems.Count, "Q9");

			c3.Show ();
			Assert.AreEqual (3, tsmi.DropDownItems.Count, "Q10");
			Assert.AreEqual (true, (tsmi.DropDownItems[2] as ToolStripMenuItem).Checked, "Q11");

			c3.Hide ();
			Assert.AreEqual (2, tsmi.DropDownItems.Count, "Q12");
//			Assert.AreEqual (true, (tsmi.DropDownItems[1] as ToolStripMenuItem).Checked, "Q13");

			// Technically, adding the Cascade item adds it to the end of the list until
			// anything regarding Mdi is clicked, which then moves it to the top of
			// the list and adds the separator.  
			// Calling c3.Show() forces the Cascade menu to the top.
			tsmi.DropDownItems.Add ("Cascade");
			c3.Show ();
			Assert.AreEqual (5, tsmi.DropDownItems.Count, "Q14");
			Assert.AreEqual (true, (tsmi.DropDownItems[4] as ToolStripMenuItem).Checked, "Q15");
			
			f.Close ();
		}
示例#41
0
        public void ingresarAlSistema(string user, Login.LogIn log, MenuPrincipal mp, Form fm, string rol)
        {
            Conexion con = new Conexion();

            MessageBox.Show("Bienvenido/a  " + user );

            if (rol == "Administrador")
            {
                mp.Show();
                mp.cargarUsuario(user, rol, log);
                fm.Hide();
            }
            else
            {
                if (rol != "Administrador")
                {
                    if (verificoSiDebe(user))
                    {
                        DialogResult dialogResult = MessageBox.Show("Alguna de sus cuentas se encuentra inhabilitada. Puede habilitarla cambiandole el tipo de cuenta o extendiendo la suscripcion actual ¿Desea habilitarla ahora? ", "Cuentas", MessageBoxButtons.YesNo);
                        if (dialogResult == DialogResult.Yes)
                        {
                            MessageBox.Show("Le recordamos que solo podra habilitar cuentas que hayan sido inhabilitadas por vencimiento de la duracion de la cuenta.");
                            ABM_Cuenta.Buscar bc = new ABM_Cuenta.Buscar(0, user);
                            mp.Show();
                            mp.cargarUsuario(user, rol, log);
                            bc.Show();
                            con.cnn.Close();
                            fm.Hide();
                        }
                        if (dialogResult == DialogResult.No)
                        {
                            mp.cargarUsuario(user, rol, log);
                            mp.Show();
                            con.cnn.Close();
                            fm.Hide();
                        }
                    }
                }
                else
                {
                    mp.cargarUsuario(user, rol, log);
                    mp.Show();
                    con.cnn.Close();
                }
            }
        }
示例#42
0
 public static void cerrar()
 {
     padre.Hide();
 }
示例#43
0
        /// <summary>
        /// 一个构造方法。
        /// </summary>
        public ComboTree()
        {
            InitializeComponent();

            //this.LoadingText = "正在加载节点…";
            //this.Height = this.comboBox1.Height;
            this.DropDownHeight = -1;
            this.DropDownWidth  = -1;

            this.treeForm.SuspendLayout();

            System.Windows.Forms.PictureBox sizeGrip = new PictureBox();
            //sizeGrip.SizeMode = PictureBoxSizeMode.AutoSize;
            //sizeGrip.Size = new Size(10, 10);
            //sizeGrip.Image = global::PublicControls.Properties.Resources.SizeGrip;
            //sizeGrip.Location = new Point(280, 254);
            sizeGrip.Anchor     = AnchorStyles.Right | AnchorStyles.Bottom;
            sizeGrip.Cursor     = System.Windows.Forms.Cursors.SizeNWSE;
            sizeGrip.MouseDown += new MouseEventHandler(sizeGrip_MouseDown);
            sizeGrip.MouseMove += new MouseEventHandler(sizeGrip_MouseMove);
            sizeGrip.MouseUp   += new MouseEventHandler(sizeGrip_MouseUp);
            //sizeGrip.BackColor = Color.Transparent;
            //sizeGrip.BackColor = Color.FromArgb(50, sizeGrip.BackColor);
            //sizeGrip.BackgroundImage = global::PublicControls.Properties.Resources.SizeGrip;
            AnomalisticControl.CreateControlRegion(sizeGrip, global::Thinksea.Windows.Forms.Properties.Resources.SizeGrip, true);
            sizeGrip.Location = new Point(treeForm.ClientSize.Width - sizeGrip.Width - 1, treeForm.ClientSize.Height - sizeGrip.Height - 1);
            treeForm.Controls.Add(sizeGrip);

            treeView1.Dock    = DockStyle.Fill;
            treeView1.TabStop = false;
            //treeView1.AfterExpand += this.treeView1_AfterExpand;
            //treeView1.BeforeSelect += this.treeView1_BeforeSelect;
            treeView1.AfterSelect += this.treeView1_AfterSelect;
            treeView1.KeyDown     += this.treeView1_KeyDown;
            treeView1.LostFocus   += delegate(object sender, System.EventArgs e)
            {
                this.treeForm.Hide();
            };
            //treeView1.Visible = false;
            treeForm.Controls.Add(treeView1);

            treeForm.ShowInTaskbar = false;
            //treeForm.TopMost = true;
            treeForm.FormBorderStyle = FormBorderStyle.None;
            //treeForm.SizeGripStyle = SizeGripStyle.Show;
            treeForm.KeyPreview  = true;
            treeForm.MinimumSize = new Size(sizeGrip.Right, sizeGrip.Bottom);
            treeForm.Visible     = false;


            treeForm.Load += delegate(object sender, EventArgs e)
            {
                #region 初始化列表框尺寸。
                if (this.DropDownHeight == -1)
                {
                    this.treeForm.Height = 100;
                }
                else
                {
                    this.treeForm.Height = this.DropDownHeight;
                }

                if (this.DropDownWidth == -1)
                {
                    this.treeForm.Width = this.Width;
                }
                else
                {
                    this.treeForm.Width = this.DropDownWidth;
                }
                #endregion

                //treeView1.LoadRootNodes(); //加载根节点。
            };

            treeForm.VisibleChanged += delegate(object sender, System.EventArgs e)
            {
                if (treeForm.Visible)
                {
                    Point p = this.comboBox1.PointToScreen(new Point(this.comboBox1.Left, this.comboBox1.Bottom));
                    treeForm.Location = p;

                    #region 修正下拉列表项目显示区域的坐标。
                    if (this.treeForm.Right > Screen.PrimaryScreen.WorkingArea.Right)
                    {
                        this.treeForm.Left = Screen.PrimaryScreen.WorkingArea.Right - this.treeForm.Width;
                    }
                    if (this.treeForm.Bottom > Screen.PrimaryScreen.WorkingArea.Bottom)
                    {
                        this.treeForm.Top = Screen.PrimaryScreen.WorkingArea.Bottom - this.treeForm.Height;
                    }
                    if (this.treeForm.Left < 0)
                    {
                        this.treeForm.Left = 0;
                    }
                    if (this.treeForm.Top < 0)
                    {
                        this.treeForm.Top = 0;
                    }
                    #endregion
                }
                //else
                //{
                //    if (this.ParentForm.Visible)
                //    {
                //        //this.ParentForm.Activate();
                //        this.ParentForm.Select();
                //        //this.comboBox1.Focus();
                //    }
                //}
            };

            //treeForm.Activated += delegate(object sender, System.EventArgs e)
            //{
            //    this.ParentForm.Activate();
            //};

            //treeForm.Deactivate += delegate(object sender, System.EventArgs e)
            //{
            //    this.treeForm.Hide();
            //    //this.ParentForm.Activate();
            //};

            treeForm.FormClosing += delegate(object sender, System.Windows.Forms.FormClosingEventArgs e)
            {
                if (e.CloseReason == CloseReason.UserClosing)
                {
                    this.treeForm.Hide();
                    e.Cancel = true;
                }
            };
            treeForm.KeyDown += delegate(object sender, System.Windows.Forms.KeyEventArgs e)
            {
                if (e.KeyData == Keys.Escape)
                {
                    treeForm.Hide();
                    e.Handled          = true;
                    e.SuppressKeyPress = false;
                }
                if (e.KeyData == Keys.Tab)
                {
                    treeForm.Hide();
                    //this.SelectNextControl(this, false, true, true, true);
                    e.Handled          = true;
                    e.SuppressKeyPress = false;
                }
            };

            this.treeForm.ResumeLayout(false);
            this.treeForm.PerformLayout();
        }
示例#44
0
        public void RenderSymbol()
        {
            VectorLayer layer = new VectorLayer();
            layer.DataSource = new DataTableFeatureProvider("LINESTRING(20 20,40 40)");

            VectorLayer symbolLayer = new VectorLayer("GPS");
            symbolLayer.DataSource = new DataTableFeatureProvider("POINT(30 30)");
            symbolLayer.Style.Symbol = Properties.Resources.NorthArrow;
            symbolLayer.Style.SymbolRotation = 0;
            symbolLayer.Style.SymbolOffset = new PointF(0, 0);
            symbolLayer.Style.SymbolScale = 0.5f;

            //Show layer on form with mapcontrol
            Form form = new Form();
            MapControl mapControl = new MapControl();
            mapControl.Dock = DockStyle.Fill;
            form.Controls.Add(mapControl);
            mapControl.Map = new Map(new Size(600, 600));

            mapControl.Map.Layers.Add(symbolLayer);
            mapControl.Map.Layers.Add(layer);

            form.Show();
            mapControl.Map.ZoomToExtents();
            mapControl.Refresh();
            form.Hide();

            WindowsFormsTestHelper.ShowModal(form);
        }
示例#45
0
 private void Game1_VisibleChanged(object sender, EventArgs e)
 {
     winform.Hide();
     winform.Size    = new System.Drawing.Size(10, 10);
     winform.Visible = false;
 }
示例#46
0
 private void Animator_VisibleChanged(object sender, EventArgs e)
 {
     Winform.Hide();
     Winform.Size    = new System.Drawing.Size(10, 10);
     Winform.Visible = false;
 }
示例#47
0
        /// <summary>
        /// Change the form to another form in the safe way
        /// </summary>
        /// <param name="form1">From form1</param>
        /// <param name="form2">To form2</param>

        public static void Form(System.Windows.Forms.Form form1, System.Windows.Forms.Form form2)
        {
            form1.Hide();
            form2.ShowDialog();
            form1.Dispose();
        }