public LevelViewParent() { // This call is required by the Windows.Forms Form Designer. InitializeComponent(); // Default panelShowToolbar.Hide(); panelToolbar.Show(); // Easier than creating a resource file? System.Reflection.Assembly ass = typeof(LevelViewParent).Module.Assembly; Stream stm = ass.GetManifestResourceStream("m.toolstrip.bmp"); imageList1.Images.AddStrip(new Bitmap(stm)); TemplateDocTemplate doct = (TemplateDocTemplate)DocManager.FindDocTemplate(typeof(TemplateDoc)); doct.DocAdded += new DocTemplate.DocAddedHandler(TemplateDocTemplate_DocAdded); doct.DocRemoved += new DocTemplate.DocRemovedHandler(TemplateDocTemplate_DocRemoved); // Combo index 0 FillCombo(); comboDocs.SelectedIndex = 0; UpdateZoomSelection(); view.ScaleChanged += new EventHandler(View_ScaleChanged); }
/// <summary> /// Begins "Ready, Set..., GO!" message. then moves to world_startGame. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void level_countdown(object sender, EventArgs e) { gameMode = Convert.ToInt32(((Control)sender).Parent.Tag); subMode = Convert.ToInt32(sender.GetType().GetProperty("Tag").GetValue(sender)); //Also need to grab sub-mode from button sender as well //May need to throw this into another method panel_world1.Hide(); panel_world2.Hide(); panel_world3.Hide(); panel_world4.Hide(); gameMain.ActiveForm.BackgroundImage = null; label_countDown = new Label(); label_countDown.AutoSize = true; label_countDown.Font = new System.Drawing.Font("Comic Sans MS", 36F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); label_countDown.Anchor = ((AnchorStyles)(AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right)); label_countDown.ForeColor = Color.Red; label_countDown.Text = "Ready"; //Sets location to center of form in realtion to the size of the label //Need to adjust the location everytime its updated or fix the label size to largest string and center text within label label_countDown.Location = new Point(gameMain.ActiveForm.Width / 2 - (label_countDown.Width), gameMain.ActiveForm.Height / 2 - (label_countDown.Height)); //Add label to form this.Controls.Add(label_countDown); //Timer setup for countdown label count = 1; timer_countDownLabel = new System.Windows.Forms.Timer(); timer_countDownLabel.Tick += new EventHandler(labelTimer_tick); timer_countDownLabel.Disposed += new EventHandler(world_startGame); timer_countDownLabel.Interval = 1000; timer_countDownLabel.Enabled = true; }
/// <summary> /// Closes the How to Play window and returns to the main page. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void pictureBox_close_Click(object sender, EventArgs e) { panel_howTo.Hide(); button_start.Show(); button_leaderboard.Show(); button_howTo.Show(); }
public void VisibilityIsSetToUIElementWhenControlContainingWrapperHides() { Wf.Control wrapper = catalog.Wrap(uiElement); Wf.Panel panel = new Wf.Panel(); panel.Controls.Add(wrapper); panel.Hide(); Assert.AreEqual(Visibility.Hidden, uiElement.Visibility); }
private void EnableDisableMenu() { if (lstObjInStack != null && lstObjInStack.Count > 0 && (lstObjInStack[lstObjInStack.Count - 1] == "LicenseManagement" || lstObjInStack[lstObjInStack.Count - 1] == "PurchaseManagement" || lstObjInStack[lstObjInStack.Count - 1] == "ContactUs" || lstObjInStack[lstObjInStack.Count - 1] == "FAQ")) { _objPanelMenu.Hide(); _objPictureBox1.Show(); } else if (_objPanelDetail.Controls.Count > 1) { if (lstObjInStack != null && lstObjInStack.Count > 0 && (lstObjInStack[lstObjInStack.Count - 1] == "QuestionBank")) { //_questionBankToolStripMenuItem.Checked = true; _addToolStripMenuItem.Visible = true; _editToolStripMenuItem.Visible = true; _deleteToolStripMenuItem.Visible = true; AuthorizationOperations obj = new AuthorizationOperations(); _addToolStripMenuItem.Enabled = obj.isUserAccessible(OperationNames.TypeOfOperations.Question_Manage); _editToolStripMenuItem.Enabled = obj.isUserAccessible(OperationNames.TypeOfOperations.Question_Manage); _deleteToolStripMenuItem.Enabled = obj.isUserAccessible(OperationNames.TypeOfOperations.Question_Manage); } else { //_questionBankToolStripMenuItem.Enabled = true; _addToolStripMenuItem.Visible = false; _editToolStripMenuItem.Visible = false; _deleteToolStripMenuItem.Visible = false; } _objPanelMenu.Show(); _objPictureBox1.Hide(); } else { _objPanelMenu.Hide(); _objPictureBox1.Show(); } }
private void expandPanel(Panel panelName, Label l, PictureBox pb) { if (panelName.Visible == true) { panelName.Hide(); l.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(207)))), ((int)(((byte)(207)))), ((int)(((byte)(207))))); rotateImage(pb, RotateFlipType.Rotate90FlipX); } else { panelName.Show(); l.ForeColor = System.Drawing.Color.Coral; rotateImage(pb, RotateFlipType.Rotate90FlipX); } }
private void button5_Click(object sender, System.EventArgs e) { //get username if (textBox1.Text != "") { string query = ""; query = "SELECT * FROM USERACCESS WHERE(UserName='******')"; OleDbDataAdapter cmdAdapter = new OleDbDataAdapter(); OleDbCommand cmd = new OleDbCommand(query, this.oleDbConnection1); cmdAdapter.SelectCommand = cmd; cmdAdapter.SelectCommand.CommandType = CommandType.Text; this.oleDbConnection1.Open(); profileSet1.Clear(); cmdAdapter.Fill(profileSet1, "UserAccess"); this.oleDbConnection1.Close(); } int found = BindingContext[profileSet1, "UserAccess"].Count; int valid = 0; //check password if (found != 0) { if (textBox2.Text == label3.Text) { valid = 1; } } if (valid == 1) { //check profile panel2.Hide(); this.menuItem1.Visible = true; this.menuItem6.Visible = true; this.menuItem18.Visible = true; panel1.Show(); textBox1.Text = ""; textBox2.Text = ""; } else { MessageBox.Show("You have entered an invalid user name and/or password. Please try again.", "Invalid User Name or Password", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox2.Text = ""; } }
/// <summary> /// When the start button is hit, it creates the next page that /// allows the player to choose which game mode they want to play. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void button_start_Click(object sender, EventArgs e) { //On Start click - Hide everything currently active on the form if ((Button)sender == button_start) { button_start.Hide(); button_leaderboard.Hide(); button_howTo.Hide(); } if ((Button)sender == button_return) { panel_results.Hide(); button_return.Hide(); button_continue.Hide(); } gameMain.ActiveForm.BackgroundImage = Mustache_ic___V2.Properties.Resources.moustache_bg; gameMain.ActiveForm.BackgroundImageLayout = ImageLayout.Stretch; //Creates world mode button button_worldsMode = new Button(); button_worldsMode.Text = "Worlds"; button_worldsMode.Size = new Size(250, 390); button_worldsMode.Font = new System.Drawing.Font("Comic Sans MS", 36F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); button_worldsMode.AutoSize = true; button_worldsMode.Location = new Point(75, 144); button_worldsMode.Anchor = ((System.Windows.Forms.AnchorStyles)(AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top)); button_worldsMode.Click += new System.EventHandler(worldButton_Click); //Bind button click event to worldButton_click function this.Controls.Add(button_worldsMode); //Creates endless mode button button_endlessMode = new Button(); button_endlessMode.Text = "Endless"; button_endlessMode.Size = new Size(250, 390); button_endlessMode.Font = new System.Drawing.Font("Comic Sans MS", 36F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); button_endlessMode.AutoSize = true; button_endlessMode.Location = new Point(375, 144); button_endlessMode.Anchor = ((AnchorStyles)(AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom)); //Needs event this.Controls.Add(button_endlessMode); }
private void hideShowPanel(object s, EventArgs e) { if (annotPanel == null) { return; } if (annotPanel.Visible) { annotPanel.Hide(); theSplitter.Hide(); hideBtn.Text = "+Notes+"; } else { theSplitter.Show(); annotPanel.Show(); hideBtn.Text = "-Notes-"; } }
private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e) { switch (toolBar1.Buttons.IndexOf(e.Button)) { case 0: view.SetLayerFlags(view.GetLayerFlags() ^ LayerFlags.Templates); break; case 1: view.SetLayerFlags(view.GetLayerFlags() ^ LayerFlags.Gobs); break; case 2: view.SetLayerFlags(view.GetLayerFlags() ^ LayerFlags.Areas); break; case 3: panelToolbar.Hide(); panelShowToolbar.Show(); break; } }
//---------------------------------------BEGIN HOUSEKEEPING---------------------------------------- public void housekeeping() { if (GV.debug == false) { this.Controls["savePackPanel"].Controls["testButton"].Hide(); } if (GV.debug == true) { AllocConsole(); } //this segment gets the location of where the text file will be saved textFilePath = System.Reflection.Assembly.GetEntryAssembly().Location; string temp = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name; textFilePath = textFilePath.Remove(textFilePath.Length - temp.Length - 4); missionPackage.MF = this; //-------------------------------------Begin top panel creation---------------------------- GoalCreatorPanel goalCreatorPanel = new GoalCreatorPanel(); goalCreatorPanel.Name = GV.goalCreatorPanelName; this.Controls.Add(goalCreatorPanel); GoalDetailPanel goalDetailPanel = new GoalDetailPanel(); goalDetailPanel.Name = GV.goalDetailPanelName; this.Controls.Add(goalDetailPanel); MissionInfoPanel missionInfoPanel = new MissionInfoPanel(); missionInfoPanel.Name = GV.missionInfoPanelName; this.Controls.Add(missionInfoPanel); MissionPackagePanel missionPackagePanel = new MissionPackagePanel(); missionPackagePanel.Name = GV.missionPackagePanelName; this.Controls.Add(missionPackagePanel); AllMissionInfoPanel allMissionInfoPanel = new AllMissionInfoPanel(); allMissionInfoPanel.Name = GV.allMissionInfoPanelName; this.Controls.Add(allMissionInfoPanel); //-------------------------------------End top panel creation---------------------------- //-------------------------------------Begin bottom panel creation---------------------------- int numberGoalTypes = GV.goalTypeList[0].GetLength(1); //returns number of types of goals for (int i = 0; i < numberGoalTypes; i++) { Panel panel = new Panel(); panel.Name = GV.goalTypeList[0][0, i]; createPanel(panel, GV.goalTypeList[i + 1]); panel.Location = new Point(5, GV.detailPanelInitialY); this.Controls[GV.goalDetailPanelName].Controls.Add(panel); panel.Hide(); panel.BackgroundImage = GV.goaLPanelImage; panel.BackgroundImageLayout = ImageLayout.Stretch; //panel.BackColor = GV.goalPanelColor; panel.BackColor = Color.Transparent; panel.SizeChanged += new EventHandler(panel_SizeChanged); //panel.VisibleChanged +=new EventHandler(panel_VisibleChanged); Label titleLabel = new Label(); titleLabel.Text = GV.goalTypeList[0][0, i] + " Parameters"; titleLabel.AutoSize = true; titleLabel.BackColor = Color.Transparent; titleLabel.Font = GV.titleFont; int titleLocationX = (GV.goalPanelHeight - TextRenderer.MeasureText(titleLabel.Text, titleLabel.Font).Width) / 2; titleLabel.Location = new Point(titleLocationX, 6); panel.Controls.Add(titleLabel); } //string[] t = GV.goalTypeList[0]; //This code automatically turns the orbit radioButton on RadioButton rb = (RadioButton)goalCreatorPanel.Controls["orbitGoalRadioButton"]; rb.Checked = true; rb.ForeColor = Color.Lime; for (int i = missionPackage.missionList.Count - 1; i >= 0; i--) { missionPackage.missionList.RemoveAt(i); } missionPackage.addMission(); //This segment does final preparations for stuff exceptionObjectHandling(); missionPackage.changeActiveMission(0); missionPackage.clearAllFields(); missionPackage.populateGoalPanels(); }
/*************************************************makes the panels appear/disappear***************************************************************/ private void PanelDisplay(Panel panel, ToolStripMenuItem toolStripMenuItem) { /*make the corresponding panel appear/disappear*/ if (panel.Visible == false) { toolStripMenuItem.Checked = true; panel.Show(); } else { panel.Hide(); toolStripMenuItem.Checked = false; } }
private void SetupButton(VirtualController.Button button, Panel panel) { string name = button.ToString(); SlotShape shape = SlotShape.Rounded; if (panel.Tag is string) try { shape = (SlotShape)Enum.Parse(typeof(SlotShape), panel.Tag as string); } catch (FormatException) { } RegisterOverlay(button, panel.Bounds, panel.BackColor, shape); panel.Tag = button; panel.Hide(); }
private void SetupAxisGesture(AxisGesture ag, Panel panel) { VirtualController.Axis stick = Util.StickFromGesture(ag), axis = Util.AxisFromGesture(ag); bool pos = Util.PoleFromGesture(ag); SlotShape shape = SlotShape.Rounded; if (panel.Tag is string) try { shape = (SlotShape)Enum.Parse(typeof(SlotShape), panel.Tag as string); } catch (FormatException) { } AxisActions.Gestures axisGesture = pos ? AxisActions.Gestures.Positive : AxisActions.Gestures.Negative; RegisterOverlay(axis, pos, panel.Bounds, panel.BackColor, shape); panel.Hide(); panel.Tag = ag; }
private void button1_Click(object sender, System.EventArgs e) { panel1.Hide(); }
private void frmQuestions_Load(object sender, EventArgs e) { //Fonts used to display the question and the answer are set up here to make //it easier to change the application style Font questionFont = new Font("Tahoma", 10F); Font answerFont = new Font("Tahoma", 10F); //Parse the raw questions and render them to the panels foreach (QuizQuestionRaw question in quizParameters.questions) { //Parse the question try { IQuizQuestion parsedQuestion = RegexQuestions.CreateQuestion(question); //Create a panel for it Panel thisQuestionPanel = new Panel(); thisQuestionPanel.Parent = this; thisQuestionPanel.Left = 0; thisQuestionPanel.Width = this.ClientRectangle.Width; thisQuestionPanel.Top = 0; thisQuestionPanel.Height = this.Height - 20; this.Controls.Add(thisQuestionPanel); //Each question's panel is hidden in the beginning thisQuestionPanel.Hide(); //Render the question to this panel and store it in the memory parsedQuestion.Render(thisQuestionPanel, questionFont, answerFont); quizQuestions.Add(parsedQuestion); renderedQuestions.Add(thisQuestionPanel); } catch (UnknownQuestionTypeException) { MessageBox.Show("Unsupported question detected among questions fetched from the server.", "ReQuiz Client", MessageBoxButtons.OK, MessageBoxIcon.Error); Close(); return; } } //Show the information about the quiz MessageBox.Show("This test has " + quizParameters.questions.Count + " questions." + Environment.NewLine + "You are allowed " + quizParameters.hintsAllowed + " hints." + Environment.NewLine + "Each question is worth 2 marks." + Environment.NewLine + "Each hint deducts 1 mark from your total score."); //Show the form, the first question and the needed buttons this.Show(); renderedQuestions[shuffledIDs[0]].Show(); UpdateStatusBar(); //Focus on the first question's answer field quizQuestions[shuffledIDs[0]].FocusOnAnswerField(); //All the startup procedures were successful, set the flag startupSuccessful = true; ttfrmQuestions.SetToolTip(btnNextQuestion, "Advances to the next question of the quiz"); ttfrmQuestions.SetToolTip(btnPrevQuestion, "Goes back to the previous question of the quiz"); ttfrmQuestions.SetToolTip(btnHint, "Shows a hint to the question. The usage of a hint penalises you for 1 mark"); ttfrmQuestions.SetToolTip(btnSubmit, "Submits the answers to the server. You can only submit the answers once."); }