public override void SubmitForm(Form form) { base.SubmitForm(form); BlockWidth = (int)form.Datas["BlockWidth"]; BlockHeight = (int)form.Datas["BlockHeight"]; BlockCenter = (Point)form.Datas["BlockCenter"]; }
public static void MainX() { var form = new Form(); var label = new Label(); label.Top = 10; label.Left = 10; label.Width = 200; label.Height = 20; label.Text = "Hello, Windows Forms!"; form.Controls.Add(label); var button = new Button(); button.Top = label.Bottom + 15; button.Left = label.Left; button.Width = label.Width; button.Height = 30; button.Text = "OK"; button.Click += (sender, args) => { form.Close(); }; form.Controls.Add(button); form.ClientSize = new System.Drawing.Size(button.Right + 10, button.Bottom + 10); Application.Run(form); }
public static Rectangle Draw(Pen pen, Form parent) { sPen = pen; // Record the start point mPos = parent.PointToClient(Control.MousePosition); // Create a transparent form on top of the parent form mMask = new Form(); mMask.FormBorderStyle = FormBorderStyle.None; mMask.BackColor = Color.Magenta; mMask.TransparencyKey = mMask.BackColor; mMask.ShowInTaskbar = false; mMask.StartPosition = FormStartPosition.Manual; mMask.Size = parent.ClientSize; mMask.Location = parent.PointToScreen(Point.Empty); mMask.MouseMove += MouseMove; mMask.MouseUp += MouseUp; mMask.Paint += PaintRectangle; mMask.Load += DoCapture; // Display the overlay mMask.ShowDialog(parent); // Clean-up and calculate return value mMask.Dispose(); mMask = null; Point pos = parent.PointToClient(Control.MousePosition); int x = Math.Min(mPos.X, pos.X); int y = Math.Min(mPos.Y, pos.Y); int w = Math.Abs(mPos.X - pos.X); int h = Math.Abs(mPos.Y - pos.Y); return new Rectangle(x, y, w, h); }
public void ResizeForm(Form ObjForm, int DesignerHeight, int DesignerWidth) { #region Code for Resizing and Font Change According to Resolution //Specify Here the Resolution Y component in which this form is designed //For Example if the Form is Designed at 800 * 600 Resolution then DesignerHeight=600 int i_StandardHeight = DesignerHeight; //Specify Here the Resolution X component in which this form is designed //For Example if the Form is Designed at 800 * 600 Resolution then DesignerWidth=800 int i_StandardWidth = DesignerWidth; int i_PresentHeight = Screen.PrimaryScreen.Bounds.Height;//Present Resolution Height int i_PresentWidth = Screen.PrimaryScreen.Bounds.Width;//Presnet Resolution Width f_HeightRatio = (float)((float)i_PresentHeight / (float)i_StandardHeight); f_WidthRatio = (float)((float)i_PresentWidth / (float)i_StandardWidth); ObjForm.AutoScaleMode = AutoScaleMode.None;//Make the Autoscale Mode=None ObjForm.Scale(new SizeF(f_WidthRatio, f_HeightRatio)); foreach (Control c in ObjForm.Controls) { if (c.HasChildren) { ResizeControlStore(c); } else { c.Font = new Font(c.Font.FontFamily, c.Font.Size * f_HeightRatio, c.Font.Style, c.Font.Unit, ((byte)(0))); } } ObjForm.Font = new Font(ObjForm.Font.FontFamily, ObjForm.Font.Size * f_HeightRatio, ObjForm.Font.Style, ObjForm.Font.Unit, ((byte)(0))); #endregion }
public static void Main() { Form form = new Form(); form.Controls.Add(GetRichTextBox("kasddddd sfasd asd\n fasdfas")); Application.Run(form); }
/// <summary> /// Half the size of a Ranorex.Form such as a browser window. /// </summary> /// <param name="form">Ranorex.Form to half the size of.</param> protected void HalfSize(Form form) { int currentHeight = form.Element.Size.Height; int currentWidth = form.Element.Size.Width; form.Resize(currentWidth / 2, currentHeight / 2); }
internal static void Run() { var f = new Form() { Width = 400, Height = 300 }; var b = new Button() { Text = "Run", Dock = DockStyle.Fill, Font = new Font("Consolas", 18) }; f.Controls.Add(b); b.Click += async delegate { b.Text = "... Running ... "; await Task.WhenAll(WithSyncCtx(), WithoutSyncCtx()); // warm-up var sw = new Stopwatch(); sw.Restart(); await WithSyncCtx(); var withTime = sw.Elapsed; sw.Restart(); await WithoutSyncCtx(); var withoutTime = sw.Elapsed; b.Text = string.Format("With : {0}\nWithout : {1}\n\nDiff : {2:F2}x", withTime, withoutTime, withTime.TotalSeconds / withoutTime.TotalSeconds); }; f.ShowDialog(); }
void MainForm_Load (object sender, EventArgs e) { InstructionsForm instructionsForm = new InstructionsForm (); instructionsForm.Show (); Form child1 = new Form (); child1.BackColor = Color.Blue; child1.Height = 200; child1.MdiParent = this; child1.Text = "Child #1"; child1.Show (); Form child2 = new Form (); child2.BackColor = Color.Red; child2.Height = 200; child2.MdiParent = this; child2.Text = "Child #2"; child2.Show (); Form child3 = new Form (); child3.BackColor = Color.Green; child3.Height = 200; child3.MdiParent = this; child3.Text = "Child #3"; child3.Show (); }
public void Main(string ApplicationPath, string[] Args) { Form frmPacman = new Form("frmPacman"); frmPacman.ButtonPressed += frmPacman_ButtonPressed; Bitmap bmpGame; Picturebox pbGame; bmpGame = new Bitmap(320, 240); if (Prompt.Show("Resolution Adjust", "Would you like to play at 640x480?", Fonts.Calibri18Bold, Fonts.Calibri14, PromptType.YesNo) == PromptResult.Yes) { pbGame = new Picturebox("pbGame", bmpGame, frmPacman.Width / 2 - 320, frmPacman.Height / 2 - 240, 640, 480, BorderStyle.BorderNone); pbGame.ScaleMode = ScaleMode.Stretch; } else pbGame = new Picturebox("pbGame", bmpGame, frmPacman.Width / 2 - 160, frmPacman.Height / 2 - 140, BorderStyle.BorderNone); pbGame.Background = Colors.Black; game = new PacmanGame(bmpGame, pbGame); frmPacman.AddControl(pbGame); Graphics.ActiveContainer = frmPacman; Thread.Sleep(100); if (joystick != null) { game.InputManager.AddInputProvider(joystick); game.Initialize(); } }
/// <summary> /// Included for API test stability purposes. Moves a Ranorex.Form such as a browser window down and up quickly four times. /// </summary> /// <param name="form">The Ranorex.Form to move.</param> protected void Fun(Form form) { int currentXCor = form.Element.ScreenLocation.X; int currentYCor = form.Element.ScreenLocation.Y; for (int l = 1; l <= 4; l++) { for (int i = 1; i <= 100; i++) { form.Move(currentXCor + i, currentYCor + i); Ranorex.Delay.Milliseconds(1); } currentXCor = form.Element.ScreenLocation.X; currentYCor = form.Element.ScreenLocation.Y; for (int i = 1; i <= 100; i++) { form.Move(currentXCor - i, currentYCor - i); Ranorex.Delay.Milliseconds(1); } currentXCor = form.Element.ScreenLocation.X; currentYCor = form.Element.ScreenLocation.Y; } }
public BallView(Form f) : base(f) { this.Image = global::BrickInvaders.Properties.Resources.windows_logo; this.BackColor = Color.Black; this.SizeMode = PictureBoxSizeMode.Zoom; }
/// <summary> /// Set Full Screen Mode /// </summary> /// <param name="form"></param> public static void StartFullScreen(Form form) { //if not Pocket Pc platform if (!Platform.PlatformDetection.IsPocketPC()) { //Set Full Screen For Windows CE Device //Normalize windows state form.WindowState = FormWindowState.Normal; IntPtr iptr = form.Handle; SHFullScreen(iptr, (int)FullScreenFlags.HideStartIcon); //detect taskbar height int taskbarHeight = Screen.PrimaryScreen.Bounds.Height - Screen.PrimaryScreen.WorkingArea.Height; // move the viewing window north taskbar height to get rid of the command //bar MoveWindow(iptr, 0, -taskbarHeight, Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height + taskbarHeight, 1); // move the task bar south taskbar height so that its not visible anylonger IntPtr iptrTB = FindWindowW("HHTaskBar", null); MoveWindow(iptrTB, 0, Screen.PrimaryScreen.Bounds.Height, Screen.PrimaryScreen.Bounds.Width, taskbarHeight, 1); } else //pocket pc platform { //Set Full Screen For Pocket Pc Device form.Menu = null; form.ControlBox = false; form.FormBorderStyle = FormBorderStyle.None; form.WindowState = FormWindowState.Maximized; form.Text = string.Empty; } }
public void CleaniREB() { MDIMain.dfuinstructions.Visible = false; MDIMain.dfuinstructionstxt.Visible = false; MDIMain.blue.Visible = false; MDIMain.Button1.Visible = false; BackgroundWorker1.Dispose(); BackgroundWorker2.Dispose(); // Display a child form. Form frm = new Form(); frm.MdiParent = MDIMain; frm.Width = this.Width / 2; frm.Height = this.Height / 2; frm.Show(); frm.Hide(); Welcome.MdiParent = MDIMain; Welcome.Show(); Welcome.Button1.Enabled = false; About.MdiParent = MDIMain; About.Show(); About.BringToFront(); MDIMain.done.Enabled = false; MDIMain.done.Checked = false; MDIMain.donetxt.ForeColor = Color.DimGray; this.Dispose(); }
public void InitializeComponent() { this.frm = new Form(); this.frm.Size = new Size(800, 800); this.ClientSize = new Size(800, 800); this.Paint += new PaintEventHandler(rect_paint); }
public static void SetPdfField(Form pdfForm, Dictionary<string, string> mapper, string key, string value) { if (value != null) { pdfForm.Fields[mapper[key]].Value = value; } }
public static void SetPdfField(Form pdfForm, Dictionary<string, string> mapper, string key, bool? value) { if(value.HasValue) { pdfForm.Fields[mapper[key]].Value = value.Value ? BooleanTrueString : null; } }
private void MenuItemClickHandler(object sender, EventArgs e) { try { ToolStripMenuItem clickedItem = (ToolStripMenuItem)sender; string selectClickedForm = string.Format("SELECT [menu_id] ,[parent_menu_id],[menu_name],[form_name],[menu_level] FROM [IMS].[dbo].[menu] where menu_id='{0}'", clickedItem.Name); DataSet ds = dbadmin.ReturnDataSet(selectClickedForm); if (ds.Tables[0].Rows.Count > 0) { CloseAllRunForm(); Type type = Type.GetType("WindowsFormsApplication1." + ds.Tables[0].Rows[0][3].ToString()); frmObj = Activator.CreateInstance(type) as Form; frmObj.MdiParent = this; //frmObj1 = Activator.CreateInstance(type) as object; //InsertComand = type.GetMethod("InsertComand"); //EditComand = type.GetMethod("EditComand"); //DeleteComand = type.GetMethod("DeleteComand"); //resize = type.GetMethod("resizeGroupBox"); frmObj.Show(); } } catch (Exception) { MessageBox.Show("Form not found. "); } }
public DxCanvas(Form form, int newWidth, int newHeight) { DX.SetUserWindow(form.Handle); DX.DxLib_Init(); Resize(newWidth, newHeight); }
public CSharpPendulum() { _form = new Form() { Text = "Pendulum", Width = 200, Height = 200 }; _timer = new Timer() { Interval = 30 }; _timer.Tick += delegate(object sender, EventArgs e) { int anchorX = (_form.Width / 2) - 12, anchorY = _form.Height / 4, ballX = anchorX + (int)(Math.Sin(_angle) * _length), ballY = anchorY + (int)(Math.Cos(_angle) * _length); _angleAccel = -9.81 / _length * Math.Sin(_angle); _angleVelocity += _angleAccel * _dt; _angle += _angleVelocity * _dt; Bitmap dblBuffer = new Bitmap(_form.Width, _form.Height); Graphics g = Graphics.FromImage(dblBuffer); Graphics f = Graphics.FromHwnd(_form.Handle); g.DrawLine(Pens.Black, new Point(anchorX, anchorY), new Point(ballX, ballY)); g.FillEllipse(Brushes.Black, anchorX - 3, anchorY - 4, 7, 7); g.FillEllipse(Brushes.DarkGoldenrod, ballX - 7, ballY - 7, 14, 14); f.Clear(Color.White); f.DrawImage(dblBuffer, new Point(0, 0)); }; _timer.Start(); Application.Run(_form); }
public MainForm() { InitializeComponent(); frmObj = new login(); frmObj.ShowDialog(); LoadMenu(); }
public AiDemo(Control paramGameController, Form paramPongGameForm) { pongGameForm = paramPongGameForm; gameController = paramGameController; picBoxAI1 = new PictureBox();// picBoxAI2 = new PictureBox();//Initializes the PictureBoxes picBoxBall = new PictureBox();// gameTime = new Timer();//Initializes the Timer gameTime.Enabled = true;//Enables the Timer gameTime.Interval = iGameTimeInterval;//Set the timer's interval gameTime.Tick += new EventHandler(gameTime_Tick);//Creates the Timer's Tick event pongGameForm.StartPosition = FormStartPosition.CenterScreen;//opens the form in center of the screen picBoxAI1.Size = sizePlayer;//sets the size of the picturebox picBoxAI1.Location = new Point(picBoxAI1.Width / 2, pongGameForm.Height / 2 - picBoxAI1.Height / 2);//sets it's location (centered) picBoxAI1.BackColor = Color.Blue;//fills the picturebox with a color gameController.Controls.Add(picBoxAI1);//adds the picture box to the form picBoxAI2.Size = sizeAI; picBoxAI2.Location = new Point(pongGameForm.Width - (picBoxAI2.Width + picBoxAI2.Width / 2), pongGameForm.Height / 2 - picBoxAI1.Height / 2); picBoxAI2.BackColor = Color.Red; gameController.Controls.Add(picBoxAI2); picBoxBall.Size = sizeBall; picBoxBall.Location = new Point(pongGameForm.Width / 2 - picBoxBall.Width / 2, pongGameForm.Height / 2 - picBoxBall.Height / 2); picBoxBall.BackColor = Color.Green; gameController.Controls.Add(picBoxBall); }
public static string ShowDialog(string baseSite,string text, string caption) { Form prompt = new Form(); string resultURL=""; prompt.Width = 600; prompt.Height = 420; prompt.Text = caption; Label textLabel = new Label() { Left = 10, Top=10, Width=580, Text=text }; ListBox lbCounty = new ListBox() { Left = 10, Top=40, Width=250, Height = 340, DisplayMember = "Label" }; Button confirmation = new Button() { Text = "Ok", Left=370, Width=100, Top=350 }; Button cancel = new Button() { Text = "Cancel", Left=480, Width=100, Top=350 }; confirmation.Click += (sender, e) => { if(lbCounty.SelectedItem!=null) {resultURL=lbCounty.SelectedItem.ToString();} prompt.Close(); }; lbCounty.DoubleClick += (sender, e) => { confirmation.PerformClick();}; cancel.Click += (sender, e) => { resultURL = "";prompt.Close(); }; prompt.Controls.Add(confirmation); prompt.Controls.Add(cancel); prompt.Controls.Add(textLabel); prompt.Controls.Add(lbCounty); FillLbCounty(lbCounty,baseSite); prompt.ShowDialog(); return resultURL; }
public static void Main () { int x = 25; foreach (FormBorderStyle style in Enum.GetValues (typeof(FormBorderStyle))) { Form f1 = new Form(); f1.FormBorderStyle = style; f1.Location = new Point (x, 25); f1.Size = new Size (200, 200); f1.StartPosition = FormStartPosition.Manual; f1.Menu = CreateMenu (""); f1.Text = style.ToString (); f1.Show (); x += f1.Width + 25; } Form mdi = new Form (); Form child = new Form (); mdi.IsMdiContainer = true; mdi.StartPosition = FormStartPosition.Manual; mdi.Location = new Point (25, 250); mdi.Size = new Size (600, 400); mdi.Menu = CreateMenu ("Main "); child.MdiParent = mdi; child.StartPosition = FormStartPosition.Manual; child.Location = new Point (25, 25); child.Size = new Size (200, 200); child.Menu = CreateMenu ("Child "); child.Show (); Application.Run (mdi); }
private void listView1_DoubleClick(object sender, EventArgs e) { Form f = new Form(); ListView lv = new ListView(); lv.Columns.Add("Value", 500); foreach (string item in listView1.SelectedItems[0].SubItems[1].Text.Split(';')) { lv.Items.Add(item); } lv.DoubleClick += (sender2, e2) => { ListView lv2 = (ListView)sender2; string path = lv2.SelectedItems[0].Text; if (!System.IO.Directory.Exists(path)) { return; } System.Diagnostics.Process.Start("explorer.exe", path); }; lv.View = View.Details; lv.Dock = DockStyle.Fill; f.Controls.Add(lv); f.Text = listView1.SelectedItems[0].Text; f.ShowDialog(); }
public static void Main() { Form fm = new Form(); fm.Text = "チャプター3"; fm.Width = 600; fm.Height = 600; Label lb = new Label(); lb.Text = "真ん中に表示するテキスト"; lb.Top = (fm.Height - lb.Height) / 2; lb.Left = (fm.Width - lb.Width) /2; Label lb1 = new Label(); Label lb2 = new Label(); lb1.Text = "左詰め"; lb2.Text = "+100"; lb2.Left = lb1.Width + 100; lb.Parent = fm; lb1.Parent = fm; lb2.Parent = fm; Application.Run(fm); }
/// <summary> /// Validates the state of this control. /// </summary> /// <param name="context">The <see cref="IMansionWebContext"/>.</param> /// <param name="form">The <see cref="Form"/> to which this control belongs.</param> /// <param name="results">The <see cref="ValidationResults"/> in which the validation results are stored.</param> protected override void DoValidate(IMansionWebContext context, Form form, ValidationResults results) { // loop over all the controls foreach (var control in FormControls) control.Validate(context, form, results); base.DoValidate(context, form, results); }
private void Page_Loaded(object sender, RoutedEventArgs e) { frm = new Form(); frm.Navigation(this.LayoutRoot); txtName.Focus(); }
protected override IEditableGridControl CreateEditableGridControl() { EditableGridControlVWG editableGridControlVWG = new EditableGridControlVWG(GetControlFactory()); Form frm = new Form(); frm.Controls.Add(editableGridControlVWG); return GetControlledLifetimeFor(editableGridControlVWG); }
public SubChart(Form fm1) { form1 = fm1; TotalChartArea = form1.ClientRectangle; totalChartBackColor = fm1.BackColor; totalChartBorderColor = fm1.BackColor; }
/// <summary> /// Initializes a new instance of the <see cref="ApplicationContext"/> class, using a given main windows Form. /// </summary> /// <param name="mainWindow">The main window.</param> public ApplicationContext(Form mainWindow) : base(mainWindow) { MainForm = mainWindow; _mainWindow = mainWindow; }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as PaymentReconciliation; if (dest == null) { throw new ArgumentException("Can only copy to an object of the same type", "other"); } base.CopyTo(dest); if (Identifier != null) { dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy()); } if (StatusElement != null) { dest.StatusElement = (Code <Hl7.Fhir.Model.FinancialResourceStatusCodes>)StatusElement.DeepCopy(); } if (Period != null) { dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopy(); } if (CreatedElement != null) { dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopy(); } if (Organization != null) { dest.Organization = (Hl7.Fhir.Model.ResourceReference)Organization.DeepCopy(); } if (Request != null) { dest.Request = (Hl7.Fhir.Model.ResourceReference)Request.DeepCopy(); } if (Outcome != null) { dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)Outcome.DeepCopy(); } if (DispositionElement != null) { dest.DispositionElement = (Hl7.Fhir.Model.FhirString)DispositionElement.DeepCopy(); } if (RequestProvider != null) { dest.RequestProvider = (Hl7.Fhir.Model.ResourceReference)RequestProvider.DeepCopy(); } if (RequestOrganization != null) { dest.RequestOrganization = (Hl7.Fhir.Model.ResourceReference)RequestOrganization.DeepCopy(); } if (Detail != null) { dest.Detail = new List <Hl7.Fhir.Model.PaymentReconciliation.DetailsComponent>(Detail.DeepCopy()); } if (Form != null) { dest.Form = (Hl7.Fhir.Model.CodeableConcept)Form.DeepCopy(); } if (Total != null) { dest.Total = (Hl7.Fhir.Model.Money)Total.DeepCopy(); } if (ProcessNote != null) { dest.ProcessNote = new List <Hl7.Fhir.Model.PaymentReconciliation.NotesComponent>(ProcessNote.DeepCopy()); } return(dest); }
private void btnNext_Click(object sender, EventArgs e) { IntegralCriterionMethods method = IntegralCriterionMethods.AdditiveCriterion; if (this.rbnAdditiveCriterion.Checked) { if (this.chbUtilityFunction.Checked) { method = IntegralCriterionMethods.AdditiveCriterionWithUtilityFunction; } else { method = IntegralCriterionMethods.AdditiveCriterion; } } if (this.rbnMultiplicativeCriterion.Checked) { if (this.chbUtilityFunction.Checked) { //method = IntegralCriterionMethods.MultiplicativeCriterionWithUtilityFunction; throw new NotImplementedException(); } else { // Проверим, все ли критерии имеют одинаковый тип if (MultiplicativeCriterionSolver.CriteriaHaveSimilarType(this._model)) { method = IntegralCriterionMethods.MultiplicativeCriterion; } else { // Критерии имеют разный тип. Скажем пользователю, // что нельзя ПОКА ЧТО использовать этот метод для // поиска окончательного решения MessageBoxHelper.ShowStop("Критерии в модели имеют разный тип: некоторые максимизируются, а некоторые минимизируются\nК сожалению, выбранный метод поиска окончательного решения работает только для моделей,\nв которых все критерии имеют одинаковый тип"); return; } } } if (this.rbnMiniMax.Checked) { method = IntegralCriterionMethods.MinimaxMethod; } if (this.rbnGeneticAlgorithm.Checked) { this._nextForm = new AdditiveGaParamsForm(this, this._model); } else { if (this.chbUtilityFunction.Checked) { this._nextForm = new UtilityFunctionForm(this, this._model, method); } else if (!this.chbUtilityFunction.Checked) { this._nextForm = new IntegralResultsForm(this, this._model, null, method); } } this._nextForm.Show(); this.Hide(); }
protected abstract void Render(Graphics graphics, Form form);
public static void mostrarVentanaNueva(Form ventanaNueva, Form ventanaPadre) { ventanaNueva.Visible = true; }
private string PromptForCorner() { Form QuestionForm = new Form(); QuestionForm.Text = "Corner Selection"; Label labelCornerChoice = new Label(); labelCornerChoice.Text = "Choose a corner to copy to:"; labelCornerChoice.Location = new Point(1, 1); labelCornerChoice.Size = new Size(200, labelCornerChoice.Size.Height); ComboBox CornerChoices = new ComboBox(); CornerChoices.Location = new Point(1, labelCornerChoice.Location.Y + labelCornerChoice.Height + 5); string[] corner_choices = { "Top Left", "Top Right", "Bottom Left", "Bottom Right" }; for (int i = 0; i < corner_choices.Length; ++i) { int BITMASK_NUMBER = (int)Math.Pow(2, i); if ((CORNER_BITMASK & BITMASK_NUMBER) != 0) { CornerChoices.Items.Add(corner_choices[i]); } } CornerChoices.SelectedIndex = 0; Button Done = new Button(); Done.Click += (s, g) => { Button b = (Button)s; Form f = (Form)b.Parent; f.Close(); }; CornerChoices.KeyDown += (s, g) => { if (g.KeyCode == Keys.Enter) { ComboBox cb = (ComboBox)s; Form f = (Form)cb.Parent; f.Close(); } }; Done.Text = "Done"; Done.Location = new Point(1, CornerChoices.Location.Y + CornerChoices.Height + 5);; QuestionForm.Controls.Add(CornerChoices); QuestionForm.Controls.Add(Done); QuestionForm.Controls.Add(labelCornerChoice); QuestionForm.FormBorderStyle = FormBorderStyle.FixedDialog; QuestionForm.AutoSize = true; QuestionForm.Height = Done.Location.Y + Done.Height + 5; //This is too small for the form, it autosizes to "big enough" QuestionForm.Width = CornerChoices.Location.X + CornerChoices.Width + 5; QuestionForm.ShowDialog(); if (CornerChoices.SelectedIndex >= 0) { string selectedText = CornerChoices.SelectedItem.ToString(); int selectedCorner = -1; switch (selectedText) { case "Top Left": selectedCorner = 0; break; case "Top Right": selectedCorner = 1; break; case "Bottom Left": selectedCorner = 2; break; case "Bottom Right": selectedCorner = 3; break; default: break; } if (selectedCorner == -1) { MessageBox.Show("Couldn't grab ComboBox content. This could be a bug. Please try again!\n\nTerminating...", "Wrong Corner", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(null); } int BITMASK_NUMBER = (int)Math.Pow(2, (selectedCorner)); if ((CORNER_BITMASK & BITMASK_NUMBER) == 0) { MessageBox.Show("This corner has already be chosen!\n\nTerminating...", "Wrong Corner", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(null); } CORNER_BITMASK -= BITMASK_NUMBER; switch (selectedCorner) { case 0: return("CornerTL"); case 1: return("CornerTR"); case 2: return("CornerBL"); case 3: return("CornerBR"); default: return(null); } } return(null); }
private int PromptForMaskNumber() { Form QuestionForm = new Form(); QuestionForm.Text = "Mask Selection"; Label labelMaskChoice = new Label(); labelMaskChoice.Text = "Choose a Mask to copy from:"; labelMaskChoice.Location = new Point(1, 1); labelMaskChoice.Size = new Size(200, labelMaskChoice.Size.Height); ComboBox MaskChoices = new ComboBox(); MaskChoices.Location = new Point(1, labelMaskChoice.Location.Y + labelMaskChoice.Height + 5); string[] mask_choices = { "Mask 1", "Mask 2", "Mask 3", "Mask 4", "Mask 5" }; for (int i = 0; i < mask_choices.Length; ++i) { int BITMASK_NUMBER = (int)Math.Pow(2, i); if ((MASK_BITMASK & BITMASK_NUMBER) != 0) { MaskChoices.Items.Add(mask_choices[i]); } } MaskChoices.SelectedIndex = 0; Button Done = new Button(); Done.Click += (s, g) => { Button b = (Button)s; Form f = (Form)b.Parent; f.Close(); }; MaskChoices.KeyDown += (s, g) => { if (g.KeyCode == Keys.Enter) { ComboBox cb = (ComboBox)s; Form f = (Form)cb.Parent; f.Close(); } }; Done.Text = "Done"; Done.Location = new Point(1, MaskChoices.Location.Y + MaskChoices.Height + 5);; QuestionForm.Controls.Add(MaskChoices); QuestionForm.Controls.Add(Done); QuestionForm.Controls.Add(labelMaskChoice); QuestionForm.FormBorderStyle = FormBorderStyle.FixedDialog; QuestionForm.AutoSize = true; QuestionForm.Height = Done.Location.Y + Done.Height + 5; //This is too small for the form, it autosizes to "big enough" QuestionForm.Width = MaskChoices.Location.X + MaskChoices.Width + 5; QuestionForm.ShowDialog(); if (MaskChoices.SelectedIndex >= 0) { string selectedText = MaskChoices.SelectedItem.ToString(); char last_char = selectedText[selectedText.Length - 1]; int selectedMask = int.Parse(last_char.ToString()) - 1; int BITMASK_NUMBER = (int)Math.Pow(2, (selectedMask)); /* * MessageBox.Show("Selected Index: " + MaskChoices.SelectedIndex.ToString() + "\n" * + "BITMASK_NUMBER: " + BITMASK_NUMBER.ToString() + "\n" * + "MASK_BITMASK: " + MASK_BITMASK + "\n" * + "MASK_BITMASK & BITMASK_NUMBER: " + (MASK_BITMASK & BITMASK_NUMBER)); */ if ((MASK_BITMASK & BITMASK_NUMBER) == 0) { MessageBox.Show("This Mask is not enabled, or you have selected this Mask twice!\n\nTerminating...", "Wrong Mask", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(-1); } MASK_BITMASK -= BITMASK_NUMBER; return(selectedMask); } return(-1); }
/// <summary> /// Validacion de formulario /// </summary> /// <param name="form">Formulario</param> /// <returns>si esta vacio devuelve true, de lo contrario false</returns> public static bool IsValid(this Form form, TipoControl tipoControl = TipoControl.TextBox) { ErrorMessage = string.Empty; bool vResult = false; switch (tipoControl) { case TipoControl.TextBox: var data = form.Controls.OfType <TextBox>().Where(x => x.Tag.ToLowerM() == "required" && string.IsNullOrEmpty(x.Text)); vResult = form.Controls.OfType <TextBox>().Any(x => x.Tag.ToLowerM() == "required" && string.IsNullOrEmpty(x.Text)); foreach (var item in data) { if (item.Tag != null) { if (item.Tag.ToString().ToLowerM() == "required") { string fields = item.Name.Replace("txt", ""); string formatField = string.Empty; foreach (Match match in Regex.Matches(fields, "[A-Z][a-z]+")) { if (match.Value != null) { formatField += match.Value + " "; } } ErrorMessage += $"El Campo {formatField.Trim()} es obligatorio \n"; } } } break; case TipoControl.ComboBox: vResult = form.Controls.OfType <ComboBox>().Any(x => x.Tag.ToLowerM() == "required" && x.SelectedValue == null); foreach (var item in form.Controls.OfType <ComboBox>()) { if (form.Controls.OfType <ComboBox>().Any(x => x.Tag != null && x.Name == item.Name)) { if (item.Tag.ToString().ToLowerM() == "required") { string fields = item.Name.Replace("combo", ""); string formatField = string.Empty; foreach (Match match in Regex.Matches(fields, "[A-Z][a-z]+")) { if (match.Value != null) { formatField += match.Value + " "; } } ErrorMessage += $"El Campo {formatField.Trim()} es obligatorio \n"; } } } break; default: break; } return(vResult); }
private void addListView(String col1, String col2, MaterialListView lv1, Form form1) { lv1.Items.Add(AddToList((lv1.Items.Count + 1), col1, col2)); form1.Refresh(); }
public void setXcustCatMappingTbl(MaterialListView lv1, Form form1, MaterialProgressBar pB1) { String uri = "", dump = ""; //HttpWebRequest request = CreateWebRequest(); XmlDocument soapEnvelopeXml = new XmlDocument(); const Int32 BufferSize = 128; String[] filePO; addListView("setXcustCatMappingTbl ", "Web Service", lv1, form1); //filePO = Cm.getFileinFolder(Cm.initC.PathZip); //String text = System.IO.File.ReadAllText(filePO[0]); //byte[] byteArraytext = Encoding.UTF8.GetBytes(text); //byte[] toEncodeAsBytestext = System.Text.ASCIIEncoding.ASCII.GetBytes(text); //String Arraytext = System.Convert.ToBase64String(toEncodeAsBytestext); //< soapenv:Envelope xmlns:soapenv = "http://schemas xmlsoap org/soap/envelope/" xmlns: v2 = "http://xmlns oracle com/oxp/service/v2" > uri = @" <soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:pub='http://xmlns.oracle.com/oxp/service/PublicReportService'> " + "<soapenv:Header/> " + "<soapenv:Body> " + "<v2:runReport> " + "<v2:reportRequest> " + "<v2:attributeLocale>en-US</v2:attributeLocale> " + "<v2:attributeTemplate>XCUST_CATEGORY_MAPPING_REP</v2:attributeTemplate> " + "<v2:reportAbsolutePath>/Custom/XCUST_CUSTOM/XCUST_CATEGORY_MAPPING_REP.xdo</v2:reportAbsolutePath> " + "<pub:parameterNameValues> " + "<pub:item> " + "<pub:multiValuesAllowed>False</pub:multiValuesAllowed> " + "<pub:name>p_last_update_fr</pub:name> " + "<pub:values> " + "<pub:item>" + Cm.initC.p_update_from + "</pub:item> " + "</pub:values>" + "</pub:item>" + "<pub:item>" + "<pub:multiValuesAllowed>False</pub:multiValuesAllowed> " + "<pub:name>p_last_update_to</pub:name> " + "<pub:values> " + "<pub:item>" + Cm.initC.p_update_to + "</pub:item> " + "</pub:values> " + "</pub:item> " + "</pub:parameterNameValues> " + "</v2:reportRequest> " + "<v2:userID>"+ Cm.initC.usercloud +"</v2:userID> " + "<v2:password>"+ Cm.initC.passcloud +"</v2:password> " + "</v2:runReport> " + "</soapenv:Body> " + "</soapenv:Envelope> "; //byte[] byteArray = Encoding.UTF8.GetBytes(envelope); byte[] byteArray = Encoding.UTF8.GetBytes(uri); addListView("setXcustCatMappingTbl Start", "Web Service", lv1, form1); // Construct the base 64 encoded string used as credentials for the service call byte[] toEncodeAsBytes = System.Text.ASCIIEncoding.ASCII.GetBytes(Cm.initC.usercloud + ":" + Cm.initC.passcloud); string credentials = System.Convert.ToBase64String(toEncodeAsBytes); // Create HttpWebRequest connection to the service HttpWebRequest request1 = (HttpWebRequest)WebRequest.Create("https://eglj.fa.us2.oraclecloud.com/xmlpserver/services/PublicReportService"); // Configure the request content type to be xml, HTTP method to be POST, and set the content length request1.Method = "POST"; request1.ContentType = "text/xml;charset=UTF-8"; request1.ContentLength = byteArray.Length; // Configure the request to use basic authentication, with base64 encoded user name and password, to invoke the service. request1.Headers.Add("Authorization", "Basic " + credentials); // Set the SOAP action to be invoked; while the call works without this, the value is expected to be set based as per standards request1.Headers.Add("SOAPAction", "https://eglj.fa.us2.oraclecloud.com/xmlpserver/services/PublicReportService"); // Write the xml payload to the request Stream dataStream = request1.GetRequestStream(); dataStream.Write(byteArray, 0, byteArray.Length); dataStream.Close(); addListView("setXcustCatMappingTbl Request", "Web Service", lv1, form1); // Get the response and process it; In this example, we simply print out the response XDocument doc; string actNumber = ""; XDocument doc; using (WebResponse response = request1.GetResponse()) { addListView("setXcustCatMappingTbl Response", "Web Service", lv1, form1); using (Stream stream = response.GetResponseStream()) { doc = XDocument.Load(stream); foreach (XNode node in doc.DescendantNodes()) { if (node is XElement) { XElement element = (XElement)node; if (element.Name.LocalName.Equals("reportBytes")) { actNumber = element.ToString().Replace(@"<ns1:reportBytes xmlns:ns1=""http://xmlns.oracle.com/oxp/service/PublicReportService"">", ""); actNumber = actNumber.Replace("</reportBytes>", "").Replace("</result>", "").Replace(@"""", "").Replace("<>", ""); actNumber = actNumber.Replace("<reportBytes>", "").Replace("</ns1:reportBytes>", ""); } } } } } actNumber = actNumber.Trim(); actNumber = actNumber.IndexOf("<reportContentType>") >= 0 ? actNumber.Substring(0, actNumber.IndexOf("<reportContentType>")) : actNumber; addListView("setXcustCatMappingTbl Extract html", "Web Service", lv1, form1); byte[] data = Convert.FromBase64String(actNumber); string decodedString = Encoding.UTF8.GetString(data); //XElement html = XElement.Parse(decodedString); //string[] values = html.Descendants("table").Select(td => td.Value).ToArray(); //int row = -1; //var doc1 = new HtmlAgilityPack.HtmlDocument(); //doc1.LoadHtml(html.ToString()); //var nodesTable = doc1.DocumentNode.Descendants("tr"); String[] data1 = decodedString.Split('\n'); //foreach (var nodeTr in nodesTable) for (int row = 0; row < data1.Length; row++) { if (row == 0) continue; if (data1[row].Length <= 0) continue; String[] data2 = data1[row].Split(','); XcustCatMappingMstTbl CATM = new XcustCatMappingMstTbl(); CATM.ORGANIZATION_ID = data2[0].Trim().ToString(); CATM.ORGANIZATION_CODE = data2[1].Trim().ToString(); CATM.INVENTORY_ITEM_ID = data2[2].Trim().Replace("\"", ""); CATM.CATEGORY_SET_ID = data2[3].Trim().Replace("\"", ""); CATM.CATEGORY_ID = data2[4].Trim().Replace("\"", ""); CATM.ENABLED_FLAG = data2[5].Trim().Replace("\"", ""); CATM.CATEGORY_CODE = data2[6].Trim().Replace("\"", ""); CATM.CATALOG_CODE_C = data2[7].Trim().Replace("\"", ""); CATM.MAPPING_SET_CODE = data2[8].Trim().Replace("\"", ""); CATM.VALUE_CODE_COMBINATION_ID = data2[9].Trim().Replace("\"", ""); CATM.SEGMENT1 = data2[10].Trim().Replace("\"", ""); CATM.SEGMENT2 = data2[11].Trim().Replace("\"", ""); CATM.SEGMENT3 = data2[12].Trim().Replace("\"", ""); CATM.SEGMENT4 = data2[13].Trim().Replace("\"", ""); CATM.SEGMENT5 = data2[14].Trim().Replace("\"", ""); CATM.SEGMENT6 = data2[15].Trim().Replace("\"", ""); CATM.CONCATESEGMENT = data2[16].Trim().Replace("\"", ""); CATM.CREATION_DATE = data2[17].Trim().Replace("\"", ""); CATM.LAST_UPDATE_DATE = data2[18].Trim().Replace("\"", ""); //MessageBox.Show("111"+item.CREATION_DATE); xCICatmDB.insertxCCatMappingMst(CATM); } Console.WriteLine(decodedString); }
/// Constructor /// </summary> public InputDeliveryLineUIForm(InputDeliveryLine line, InputDelivery delivery, SerieInfo serie, IAcreedorInfo provider, Form parent) : base(true, parent) { InitializeComponent(); _entity = line; _delivery = delivery; _serie = serie; _provider = provider; }
public GMPRenderer(Form parentContext, UInt32[] colorPalette, int colorPaletteSize) : base(parentContext, colorPalette, colorPaletteSize) { Real.DefaultPrecision = 128; }
public void InitWindowManager(Form mdiContainer) { WindowManager.CreateInstance(mdiContainer); }
public static CompositeElement SetRoot(this Form form, CompositeElement element) { form.RootElement = element; return(element); }
public override void BuildLayout(SingleContainer editorContainer, IAssetManager assetManager) { this.m_FontNameTextBox = new TextBox { Text = this.m_Asset.FontName }; this.m_FontNameTextBox.TextChanged += (sender, e) => { this.m_Asset.FontName = this.m_FontNameTextBox.Text; this.StartCompilation(assetManager); }; this.m_FontSizeTextBox = new TextBox { Text = this.m_Asset.FontSize.ToString() }; this.m_FontSizeTextBox.TextChanged += (sender, e) => { try { this.m_Asset.FontSize = Convert.ToInt32(this.m_FontSizeTextBox.Text); this.StartCompilation(assetManager); } catch (FormatException) { } }; this.m_UseKerningTextBox = new TextBox { Text = this.m_Asset.UseKerning.ToString() }; this.m_UseKerningTextBox.TextChanged += (sender, e) => { try { this.m_Asset.UseKerning = Convert.ToBoolean(this.m_UseKerningTextBox.Text); this.StartCompilation(assetManager); } catch (FormatException) { } }; this.m_SpacingTextBox = new TextBox { Text = this.m_Asset.Spacing.ToString() }; this.m_SpacingTextBox.TextChanged += (sender, e) => { try { this.m_Asset.Spacing = Convert.ToInt32(this.m_SpacingTextBox.Text); this.StartCompilation(assetManager); } catch (FormatException) { } }; var form = new Form(); form.AddControl("Font Name:", this.m_FontNameTextBox); form.AddControl("Font Size:", this.m_FontSizeTextBox); form.AddControl("Use Kerning (true/false):", this.m_UseKerningTextBox); form.AddControl("Spacing:", this.m_SpacingTextBox); this.m_StatusLabel = new Label(); this.m_StatusLabel.Text = ""; var fontViewer = new FontViewer(); fontViewer.Font = this.m_Asset; var vertContainer = new VerticalContainer(); vertContainer.AddChild(form, "*"); vertContainer.AddChild(this.m_StatusLabel, "20"); vertContainer.AddChild(fontViewer, "200"); editorContainer.SetChild(vertContainer); }
public void SetMainForm(Form frmMain, BarItem statusBarItem) { StatusBusy.SetMainForm(frmMain, statusBarItem); }
public frmRemoveStation(Form m) { InitializeComponent(); this.mainWindow = m; }
public abstract Task <Dictionary <string, int> > parse(System.IO.Stream s, Form parent, System.Threading.CancellationToken cancellationToken);
public static uint ExpandsArea(Form form, uint current_count, uint newdatacount, Undo.UndoData undodata) { InputFormRef InputFormRef = Init(null); return(InputFormRef.ExpandsArea(form, newdatacount, undodata, Program.ROM.RomInfo.unit_move_icon_pointer())); }
//打开首页 public void ShowForm(Form form, string menuName, string tabId) { int index = this.barMainContainer.Items.IndexOf(tabId); if (index < 0) { if (form != null) { //List<DockContainerItem> listitem = new List<DockContainerItem>(); //CloseTab delegateCloseTable = delegate() //{ // foreach (DockContainerItem item in listitem) // barMainContainer.CloseDockTab(item); //}; barMainContainer.BeginInit(); int displayWay = CustomConfigManager.GetDisplayWay();//显示方式 0 标准 1全屏 if (displayWay == 1) form.Dock = DockStyle.Fill; form.Size = new Size(1000, 600); form.FormBorderStyle = FormBorderStyle.None; form.TopLevel = false; if (this.barMainContainer.Width > form.Width) { form.Location = new Point((barMainContainer.Width - form.Width) / 2, 0); } else form.Location = new Point(0, 0); form.Show(); PanelDockContainer panelDockMain = new PanelDockContainer(); panelDockMain.Dock = DockStyle.Fill; panelDockMain.Controls.Add(form); panelDockMain.Location = new System.Drawing.Point(3, 28); panelDockMain.Style.Alignment = System.Drawing.StringAlignment.Center; panelDockMain.Style.GradientAngle = 90; panelDockMain.BackColor = Color.FromArgb(227, 239, 255); panelDockMain.AutoScroll = true; //string tabId = "view" + form.GetHashCode(); DockContainerItem item = new DockContainerItem(form.Text); item.Text = menuName; item.Name = tabId; item.Control = panelDockMain; item.Visible = true; item.Tag = form;//绑定界面对象 //item.Image = GetButtonImage(btnImage); //listitem.Add(item); //item.VisibleChanged += new EventHandler(item_VisibleChanged); //this.barMainContainer.Controls.Add(panelDockMain); this.barMainContainer.Items.Add(item); this.barMainContainer.SelectedDockContainerItem = item; barMainContainer.EndInit(); this.barMainContainer.Show(); if (form is BaseFormBusiness) { (form as BaseFormBusiness).ExecOpenWindowBefore(form, null); } } } else { DockContainerItem item= (DockContainerItem)this.barMainContainer.Items[index]; item.Text = menuName; this.barMainContainer.SelectedDockContainerItem = item; //if (item.Tag is IfrmWebBrowserView) //{ // IfrmWebBrowserView webbrowser = (IfrmWebBrowserView)item.Tag; // webbrowser.NavigateUrl();//重新加载网址 //} } openFormStack.Push(tabId); }
public void Test_Common() { // required for testing, otherwise the engine will require saving // the database (requires path of files for the archive and storage) GlobalOptions.Instance.AllowMediaStoreReferences = true; var appHost = (WFAppHost)AppHost.Instance; Assert.IsNotNull(appHost.AppContext); appHost.BaseClosed(null); appHost.CloseWindow(null); appHost.SaveWinMRU(null); // // at complex tests, first form hasn't focus ((Form)AppHost.Instance.RunningForms[0]).Show(); // FIXME fMainWin = (Form)AppHost.Instance.GetActiveWindow(); // Stage 1: call to AboutDlg, closing in AboutDlg_Handler ExpectModal("AboutDlg", "AboutDlg_Handler"); //ModalFormHandler = AboutDlgTests.AboutDlg_Handler; ClickToolStripMenuItem("miAbout", fMainWin); // Stage 2.1: GetCurrentFile() IBaseWindow curBase = AppHost.Instance.GetCurrentFile(); Assert.IsNotNull(curBase, "Stage 2.1"); Assert.AreEqual(fMainWin, curBase); // Stage 2.2: create an empty base //ClickToolStripButton("tbFileNew", fBaseSDI); // Stage 2.3: GetCurrentFile() fCurBase = AppHost.Instance.GetCurrentFile(); Assert.IsNotNull(fCurBase, "Stage 2.3"); // Stage 2.4: fill context for sample data TestUtils.FillContext(fCurBase.Context); fCurBase.UpdateSettings(); // Stage 2.5: select first individual record in base fCurBase.SelectRecordByXRef("I1"); Assert.AreEqual("I1", fCurBase.GetSelectedPerson().XRef); // Stage 3: call to FilePropertiesDlg ModalFormHandler = Dialog_Cancel_Handler; ClickToolStripMenuItem("miFileProperties", fMainWin); SetModalFormHandler(this, FilePropertiesDlgTests.FilePropertiesDlg_btnAccept_Handler); ClickToolStripMenuItem("miFileProperties", fMainWin); // Stage 4: call to OptionsDlg ModalFormHandler = Dialog_Cancel_Handler; ClickToolStripMenuItem("miOptions", fMainWin); ModalFormHandler = OptionsDlgTests.OptionsDlg_btnAccept_Handler; ClickToolStripMenuItem("miOptions", fMainWin); // Stage 5: internals of BaseWin BaseWin_Tests(fCurBase, "Stage 5"); // Stage 6 ModalFormHandler = DayTipsDlgTests.CloseModalHandler; AppHost.Instance.ShowTips(); // don't show dialog because BirthDays is empty AppHost.Instance.AddMRU("test.ged"); fMainWin.Activate(); Assert.AreEqual("Unknown", AppHost.Instance.GetCurrentFileName(), "check AppHost.Instance.GetCurrentFileName()"); Assert.Throws(typeof(ArgumentNullException), () => { AppHost.Instance.RequestGeoCoords(null, null); }); Assert.Throws(typeof(ArgumentNullException), () => { AppHost.Instance.RequestGeoCoords("Moscow", null); }); // IHost tests //IHost host = fMainWin; // FIXME: !!! IHost host = AppHost.Instance; GlobalOptions.Instance.LastDir = ""; string ufPath = host.GetUserFilesPath(""); Assert.AreEqual(GKUtils.GetHomePath(), ufPath); Assert.IsFalse(string.IsNullOrEmpty(ufPath)); IBaseWindow baseWin = host.FindBase("Unknown"); Assert.IsNotNull(baseWin); ModalFormHandler = MessageBox_OkHandler; AppHost.StdDialogs.ShowWarning("test warn"); ILangMan langMan = host.CreateLangMan(null); Assert.IsNull(langMan); host.WidgetShow(null); host.WidgetClose(null); Assert.IsFalse(host.IsWidgetActive(null)); host.EnableWindow(null, false); host.BaseRenamed(null, "", ""); ClickToolStripButton("tbNext", fMainWin); ClickToolStripButton("tbPrev", fMainWin); // Stage 7: call to QuickFind ((BaseWinSDI)fCurBase).ShowRecordsTab(GDMRecordType.rtIndividual); QuickSearchDlgTests.QuickSearch_Test(fMainWin); // Stage 21: call to TreeToolsWin SetModalFormHandler(this, TreeToolsWinTests.TreeCompareDlg_Handler); ClickToolStripMenuItem("miTreeCompare", fMainWin); SetModalFormHandler(this, TreeToolsWinTests.TreeMergeDlg_Handler); ClickToolStripMenuItem("miTreeMerge", fMainWin); SetModalFormHandler(this, TreeToolsWinTests.TreeSplitDlg_Handler); ClickToolStripMenuItem("miTreeSplit", fMainWin); SetModalFormHandler(this, TreeToolsWinTests.RecMergeDlg_Handler); ClickToolStripMenuItem("miRecMerge", fMainWin); SetModalFormHandler(this, TreeToolsWinTests.FamilyGroupsDlg_Handler); ClickToolStripMenuItem("miFamilyGroups", fMainWin); SetModalFormHandler(this, TreeToolsWinTests.TreeCheckDlg_Handler); ClickToolStripMenuItem("miTreeCheck", fMainWin); SetModalFormHandler(this, TreeToolsWinTests.PatSearchDlg_Handler); ClickToolStripMenuItem("miPatSearch", fMainWin); SetModalFormHandler(this, TreeToolsWinTests.PlacesManagerDlg_Handler); ClickToolStripMenuItem("miPlacesManager", fMainWin); // Stage 22-24: call to exports Exporter.TEST_MODE = true; ModalFormHandler = SaveFilePDF_Handler; ClickToolStripMenuItem("miExportToFamilyBook", fMainWin); ModalFormHandler = SaveFileXLS_Handler; ClickToolStripMenuItem("miExportToExcelFile", fMainWin); GeneratePedigree_Tests("Stage 24"); // FIXME: fatal loop //ModalFormHandler = SaveFilePDF_Handler; //ClickToolStripMenuItem("miExportToTreesAlbum", fMainWin); // Stage 25: call to CircleChartWin (required the base, selected person) fCurBase.SelectRecordByXRef("I3"); Assert.AreEqual("I3", fCurBase.GetSelectedPerson().XRef, "Stage 25.0"); ClickToolStripMenuItem("miAncestorsCircle", fMainWin); CircleChartWinTests.CircleChartWin_Tests(this, GetActiveForm("CircleChartWin"), "Stage 25"); // Stage 26: call to CircleChartWin (required the base, selected person) fCurBase.SelectRecordByXRef("I1"); Assert.AreEqual("I1", fCurBase.GetSelectedPerson().XRef, "Stage 26.0"); ClickToolStripMenuItem("miDescendantsCircle", fMainWin); CircleChartWinTests.CircleChartWin_Tests(this, GetActiveForm("CircleChartWin"), "Stage 26"); // Stage 27: call to TreeChartWin (required the base, selected person) fCurBase.SelectRecordByXRef("I3"); Assert.AreEqual("I3", fCurBase.GetSelectedPerson().XRef, "Stage 27.0"); ClickToolStripButton("tbTreeAncestors", fMainWin); TreeChartWinTests.TreeChartWin_Tests(this, fMainWin, GetActiveForm("TreeChartWin"), TreeChartKind.ckAncestors, "Stage 27", "I3"); // Stage 28: call to TreeChartWin (required the base, selected person) fCurBase.SelectRecordByXRef("I1"); Assert.AreEqual("I1", fCurBase.GetSelectedPerson().XRef, "Stage 28.0"); ClickToolStripButton("tbTreeDescendants", fMainWin); TreeChartWinTests.TreeChartWin_Tests(this, fMainWin, GetActiveForm("TreeChartWin"), TreeChartKind.ckDescendants, "Stage 28", "I1"); // Stage 29: call to TreeChartWin (required the base, selected person) ClickToolStripButton("tbTreeBoth", fMainWin); TreeChartWinTests.TreeChartWin_Tests(this, fMainWin, GetActiveForm("TreeChartWin"), TreeChartKind.ckBoth, "Stage 29", "I1"); // Stage 30: call to StatsWin (required the base) ClickToolStripButton("tbStats", fMainWin); StatisticsWinTests.StatsWin_Handler(this, GetActiveForm("StatisticsWin"), "Stage 30"); // Stage 31: call to SlideshowWin (required the base) ClickToolStripMenuItem("miSlideshow", fMainWin); SlideshowWinTests.SlideshowWin_Handler(this, GetActiveForm("SlideshowWin"), "Stage 31"); // Stage 32: call to ScriptEditWin (required the base) SetModalFormHandler(this, ScriptEditWinTests.ScriptEditWin_Handler); ClickToolStripMenuItem("miScripts", fMainWin); //Assert.IsTrue((Form)AppHost.Instance.GetActiveWindow(), "Stage 32"); // Stage 33: call to OrganizerWin ModalFormHandler = OrganizerWinTests.OrganizerWin_Handler; ClickToolStripMenuItem("miOrganizer", fMainWin); // Stage 34: call to RelationshipCalculatorDlg ModalFormHandler = RelationshipCalculatorDlgTests.RelationshipCalculatorDlg_Handler; ClickToolStripMenuItem("miRelationshipCalculator", fMainWin); // Stage 35: call to MapsViewerWin (required the base) ClickToolStripMenuItem("miMap", fMainWin); MapsViewerWinTests.MapsViewerWin_Handler(this, GetActiveForm("MapsViewerWin"), "Stage 35"); // Stage 36 ModalFormHandler = MessageBox_OkHandler; fCurBase.DuplicateRecord(); // Stage 47: close Base ModalFormHandler = MessageBox_CancelHandler; ClickToolStripMenuItem("miFileLoad", fMainWin); // Stage 48: close Base ModalFormHandler = MessageBox_CancelHandler; ClickToolStripMenuItem("miFileSaveAs", fMainWin); // Stage 49: close Base ModalFormHandler = MessageBox_CancelHandler; ClickToolStripMenuItem("miFileSave", fMainWin); // Stage 50: close Base Assert.IsTrue(fCurBase.Context.Modified); ModalFormHandler = MessageBox_CancelHandler; ClickToolStripMenuItem("miFileClose", fMainWin); // Stage 51: call to LanguageSelectDlg ModalFormHandler = LanguageSelectDlgTests.LanguageSelectDlg_Accept_Handler; AppHost.Instance.LoadLanguage(0); // Stage 52: exit //ClickToolStripMenuItem("miExit", fBaseSDI); // Other ModalFormHandler = MessageBox_OkHandler; AppHost.StdDialogs.ShowMessage("test msg"); ModalFormHandler = MessageBox_OkHandler; AppHost.StdDialogs.ShowError("test error msg"); }
public static StatusProgressForm ConstructEx(string strTitle, bool bCanCancel, bool bMarqueeProgress, Form fOwner, string strInitialOp) { StatusProgressForm dlg = new StatusProgressForm(); dlg.InitEx(strTitle, bCanCancel, bMarqueeProgress, fOwner); if (fOwner != null) { dlg.Show(fOwner); } else { dlg.Show(); } dlg.StartLogging(strInitialOp, false); return(dlg); }
public void ShowForm(UIType ui, Form form) { form.Show(); form.Focus(); }
public void EditorDlg_btnAccept_Handler(string name, IntPtr ptr, Form form) { if (form is NoteEditDlg) { NoteEditDlgTests.NoteEditDlg_Handler((NoteEditDlg)form); return; } if (form is FamilyEditDlg) { FamilyEditDlg_Handler((FamilyEditDlg)form); return; } if (form is GroupEditDlg) { GroupEditDlgTests.GroupEditDlg_Handler((GroupEditDlg)form); return; } if (form is PersonEditDlg) { PersonEditDlg_Handler((PersonEditDlg)form); return; } if (form is ResearchEditDlg) { ResearchEditDlgTests.ResearchEditDlg_Handler((ResearchEditDlg)form); return; } if (form is LocationEditDlg) { LocationEditDlgTests.LocationEditDlg_Handler((LocationEditDlg)form); return; } if (form is SourceEditDlg) { SourceEditDlgTests.SourceEditDlg_Handler((SourceEditDlg)form); return; } if (form is CommunicationEditDlg) { CommunicationEditDlgTests.CommunicationEditDlg_Handler((CommunicationEditDlg)form); return; } if (form is TaskEditDlg) { TaskEditDlgTests.TaskEditDlg_Handler((TaskEditDlg)form); return; } if (form is MediaEditDlg) { ClickButton("btnAccept", form); return; } if (form is RepositoryEditDlg) { ClickButton("btnAccept", form); return; } }
public Help(Form main) { InitializeComponent(); this.Parent = main; }
protected virtual DialogResult ShowRecurrenceForm(Form form) { return(FormTouchUIAdapter.ShowDialog(form, this)); }
static InputFormRef Init(Form self) { if (self != null || InstrumentHint == null) { PreLoadResourceInstrumentHint(U.ConfigDataFilename("song_instrument_")); } return(new InputFormRef(self , "" , new List <String> { "N00_", "N01_", "N02_", "N03_", "N04_", "N08_", "N09_", "N0A_", "N0B_", "N0C_", "N10_", "N40_", "N80_" } , 0 , 12 , (int i, uint addr) => { //読込最大値検索 if (i >= 128) { //最大数over! return false; } uint type = Program.ROM.u8(addr + 0); if (type == 0x00 || //directosound type == 0x08 || //directosound type == 0x10 || //directosound type == 0x18 || //directosound type == 0x03 || //wave type == 0x0B || //wave type == 0x80 //drum ) { uint p = Program.ROM.u32(addr + 4); if (!U.isSafetyPointer(p)) { //不正なアドレス return false; } return true; } if (type == 0x40) //multisamples { uint p = Program.ROM.u32(addr + 4); if (!U.isSafetyPointer(p)) { //不正なアドレス return false; } p = Program.ROM.u32(addr + 8); if (!U.isSafetyPointer(p)) { //不正なアドレス return false; } return true; } if (type == 0x01 || //Square Wave(Without Data) type == 0x02 || //Square Wave(Without Data) type == 0x03 || //Square Wave(Without Data) type == 0x04 || //Noise(Without Data) type == 0x09 || //Square Wave(Without Data) type == 0x0A || //Square Wave(Without Data) type == 0x0C //Square Wave(Without Data) ) { return true; } return false; } , (int i, uint addr) => { string fingerprint = SongInstrumentForm.FingerPrint(addr); if (fingerprint != "") { InstrumentHintSt hint; if (InstrumentHint.TryGetValue(fingerprint, out hint)) { return U.ToHexString(i) + " " + hint.name; } } uint type = Program.ROM.u8(addr); return U.ToHexString(i) + " " + GetInstrumentTypeName(type); } )); }
/// <summary> /// Sets the startup form. /// </summary> /// <param name="form">The form.</param> public static void SetStartupForm(Form form) { StartupForm = form; }
/// <summary> /// /// función privada usada para mover el formulario actual /// Se usa en evento MouseMove del control /// </summary> /// <param name="frm"></param> public static void MoveForm(Form frm) { WindowDllImport.ReleaseCapture(); WindowDllImport.SendMessage(frm.Handle, WindowDllImport.WM_SYSCOMMAND, WindowDllImport.MOUSE_MOVE, 0); }
private void OnStateBegin(object sender, EventArgs<State> e) { if (e.Data is Updates.UpdateAvailableState && this.updatesDialog == null) { bool showDialogNow = true; // If no other modal window is on top of us, then go ahead and present // the updates dialog. Otherwise, set a timer to check every few seconds // and only when there's no other dialog sitting on top of us will we // present the dialog. Form ourForm = AppWorkspace.FindForm(); PdnBaseForm asPBF = ourForm as PdnBaseForm; if (asPBF != null) { if (!asPBF.IsCurrentModalForm) { showDialogNow = false; } } if (showDialogNow) { ShowUpdatesDialog(); } else { if (this.retryDialogTimer != null) { this.retryDialogTimer.Enabled = false; this.retryDialogTimer.Dispose(); this.retryDialogTimer = null; } this.retryDialogTimer = new System.Windows.Forms.Timer(); this.retryDialogTimer.Interval = 3000; this.retryDialogTimer.Tick += delegate(object sender2, EventArgs e2) { bool done = false; if (IsDisposed) { done = true; } Form ourForm2 = AppWorkspace.FindForm(); PdnBaseForm asPBF2 = ourForm2 as PdnBaseForm; if (asPBF2 == null) { done = true; } else { if (this.updatesDialog != null) { // Updates dialog is already visible. done = true; } else if (asPBF2.IsCurrentModalForm && asPBF2.Enabled) { ShowUpdatesDialog(); done = true; } } if (done && this.retryDialogTimer != null) { this.retryDialogTimer.Enabled = false; this.retryDialogTimer.Dispose(); this.retryDialogTimer = null; } }; this.retryDialogTimer.Enabled = true; } } else if (e.Data is Updates.ReadyToCheckState) { if (this.updatesDialog == null) { DisposeUpdates(); } } }
public static void PrintPreview(Window owner, FormData data) { using (MemoryStream xpsStream = new MemoryStream()) { using (Package package = Package.Open(xpsStream, FileMode.Create, FileAccess.ReadWrite)) { string packageUriString = "memorystream://data.xps"; Uri packageUri = new Uri(packageUriString); PackageStore.AddPackage(packageUri, package); XpsDocument xpsDocument = new XpsDocument(package, CompressionOption.Maximum, packageUriString); XpsDocumentWriter writer = XpsDocument.CreateXpsDocumentWriter(xpsDocument); Form visual = new Form(data); PrintTicket printTicket = new PrintTicket(); printTicket.PageMediaSize = A4PaperSize; writer.Write(visual, printTicket); FixedDocumentSequence document = xpsDocument.GetFixedDocumentSequence(); xpsDocument.Close(); PrintPreviewWindow printPreviewWnd = new PrintPreviewWindow(document); printPreviewWnd.Owner = owner; printPreviewWnd.ShowDialog(); PackageStore.RemovePackage(packageUri); } } }