private void RepositionControls() { int wid, hgt, aHgt; if (ToolsCF.UpdateScreenDimensions(out wid, out hgt, out aHgt)) { //int gap = 4; // A small value, used as the basis for providing horiz and vert spacing if (CFSysInfo.Data.DeviceSpecs.Platform == Platform.SmartPhone) { // To Do: Still to need to flesh out SmartPhone positioning } else { if (wid < hgt) // Is it in Portrait mode? { } else // Landscape mode { } } } }
private void RepositionControls() { int wid, hgt, aHgt; ToolsCF.UpdateScreenDimensions(out wid, out hgt, out aHgt); int gap = 4; // A small value, used as the basis for providing horiz and vert spacing panelOuter.Location = new Point(0, 0); panelOuter.Size = this.Size; panelInner.Width = panelOuter.Width - gap; panelInner.Left = gap / 2; panelInner.Height = panelOuter.Height - gap; panelInner.Top = gap / 2; this.Left = (wid - this.Width) / 2; if (CFSysInfo.Data.DeviceSpecs.Platform == Platform.SmartPhone) { // Debug: SmartPhone code still to be fleshed out this.Top = (aHgt - this.Height) / 2; } else { if (wid < hgt) // Is it in Portrait mode? { this.Top = (aHgt - this.Height) / 2 + 18; // Designed to cover up the large PP icon in the background } else // Landscape mode { this.Top = 30; } } }
private void RepositionControls(bool forceRedraw) { int wid = 0, hgt = 0, aHgt = 0; if ((ToolsCF.UpdateScreenDimensions(out wid, out hgt, out aHgt)) | forceRedraw) { int gap = 4; // A small value, used as the basis for providing horiz and vert spacing if (CFSysInfo.Data.DeviceSpecs.Platform == Platform.SmartPhone) { // To Do: Still to need to flesh out SmartPhone positioning } else { int x = gap * 2; int y = x; labelCurrentUserIntro.Location = new Point(x, y); labelCurrentUser.Location = new Point(x * 10, y); if (hgt > wid) // Is it in Portrait mode? { labelIntro.Location = new Point(x, labelCurrentUserIntro.Bottom + 2 * y); labelIntro.Size = new Size(wid - x * 2, labelIntro.Height); int subWid = textBoxFirstName.Right - labelFirstName.Left; labelFirstName.Location = new Point((wid - subWid) / 2, labelIntro.Bottom + gap * 5); textBoxFirstName.Location = new Point(labelFirstName.Right + gap, labelFirstName.Top - 3); labelLastName.Location = new Point(labelFirstName.Left, labelFirstName.Bottom + gap * 5); textBoxLastName.Location = new Point(textBoxFirstName.Left, labelLastName.Top - 3); panelUserName.Location = new Point((wid - panelUserName.Width) / 2, labelLastName.Bottom + gap * 5); } else // Landscape mode { labelIntro.Location = new Point(x, labelCurrentUserIntro.Bottom + 2 * y); labelIntro.Size = new Size(wid - x * 2, labelIntro.Height); labelFirstName.Location = new Point(x, labelIntro.Bottom + gap * 4); textBoxFirstName.Location = new Point(labelFirstName.Right + 0, labelFirstName.Top - 3); textBoxLastName.Location = new Point(wid - x - textBoxLastName.Width, textBoxFirstName.Top); labelLastName.Location = new Point(textBoxLastName.Left - 0 - labelLastName.Width, labelFirstName.Top); panelUserName.Location = new Point((wid - panelUserName.Width) / 2, textBoxFirstName.Bottom + gap * 6); } } } }
/// <summary> /// /// </summary> /// <param name="pollName"></param> /// <param name="pollModel"></param> /// <param name="sequenceVal"></param> // The previously selected Sequence value, if any /// <param name="dateValues"></param> // The previously selected Data values, if any private void Initialize(string pollName, Poll pollModel, int sequenceVal, ArrayList dateValues) { Cursor.Current = Cursors.WaitCursor; InitializeComponent(); PollName = pollName; PollModel = pollModel; InitializeScreen(); PopulateForm(pollModel, sequenceVal, dateValues); ToolsCF.SipShowIM(0); // Hide SIP, in case it's visible this.BringToFront(); Cursor.Current = Cursors.Default; this.Resize += new System.EventHandler(this.frmCriteria_Resize); this.ShowDialog(); this.Resize -= new System.EventHandler(this.frmCriteria_Resize); if (ScreenAdv == 1) { // Determine which [single] Sequence value was selected foreach (ListViewItem item in listViewSelectRecent.Items) { if (item.Checked) { sequenceVal = (int)recentCriteria[item.Index]; break; } } // Determine which Date(s) were selected dateValues = new ArrayList(); if (!listViewSelectDate.Items[0].Checked) // If "ALL" was selected then we'll just pass an empty array { foreach (ListViewItem item in listViewSelectDate.Items) { if (item.Checked) { dateValues.Add(dateCriteria[item.Index]); } } } // Now that we know what data the user wants to view, we can display it frmStats statsForm = new frmStats(PollName, PollModel, sequenceVal, dateValues); } }
private void RepositionControls(bool forceRedraw) { int wid = 0, hgt = 0, aHgt = 0; if ((ToolsCF.UpdateScreenDimensions(out wid, out hgt, out aHgt)) | forceRedraw) { int gap = 4; // A small value, used as the basis for providing horiz and vert spacing labelIntro.Location = new Point(gap * 2, gap * 2); labelIntro.Size = new Size(wid - gap * 4, labelIntro.Height); textBoxMain.Location = new Point(gap * 2, gap * 8); textBoxMain.Size = new Size(wid - gap * 4, aHgt - gap * 12); } }
private void RepositionControls(bool forceRedraw) { ToolsCF.SipShowIM(0); // Ensure that SIP is collapsed int wid = 0, hgt = 0, aHgt = 0; if ((ToolsCF.UpdateScreenDimensions(out wid, out hgt, out aHgt)) | forceRedraw) { int gap = 4; // A small value, used as the basis for providing horiz and vert spacing double daHgt = Convert.ToDouble(aHgt); // First position top label labelInstructions.Location = new Point(gap * 4, gap * 2); Font font = labelRespondents.Font; // Base font for all labels // Logic to handle display of the two listboxes if (CFSysInfo.Data.DeviceSpecs.Platform == Platform.SmartPhone) { // To Do: Future code to go here } else { if (hgt > wid) // Portrait { listBoxFiles.Location = new Point(gap * 4, gap * 7); listBoxFiles.Size = new Size(wid - gap * 8, Convert.ToInt32(daHgt * 0.45)); AdjustSummaryInfoLocations(Orientation.Portrait); textBoxSummary.Location = new Point(listBoxFiles.Left, textBoxQuestions.Bottom + gap * 2); textBoxSummary.Size = new Size(wid - gap * 8, aHgt - gap * 2 - textBoxSummary.Top); } else // Landscape { listBoxFiles.Location = new Point(gap * 4, Convert.ToInt32(daHgt * 0.15)); listBoxFiles.Size = new Size(wid / 2 - gap * 5, Convert.ToInt32(daHgt * 0.7)); textBoxSummary.Location = new Point(listBoxFiles.Right + gap * 2, listBoxFiles.Top); textBoxSummary.Size = listBoxFiles.Size; AdjustSummaryInfoLocations(Orientation.Landscape); } } } }
public int ScreenAdv; // -1 : Move backward one screen +1 : Move forward one screen public frmInstructions(string text, InstructType mode, ref int screenAdv, ref bool backAvail) { Cursor.Current = Cursors.WaitCursor; InitializeComponent(); InitializeScreen(); SetIntroText(mode, backAvail); textBoxMain.Text = text; ToolsCF.SipShowIM(0); this.BringToFront(); Cursor.Current = Cursors.Default; this.Resize += new System.EventHandler(this.frmInstructions_Resize); this.ShowDialog(); screenAdv = ScreenAdv; backAvail = true; // Setting this to true will make this just displayed screen the "back one" this.Resize -= new System.EventHandler(this.frmInstructions_Resize); }
public int ScreenAdv; // -1 : Move backward one screen +1 : Move forward one screen public frmChangeUserName(ref int screenAdv, ref bool backAvail) { Cursor.Current = Cursors.WaitCursor; InitializeComponent(); InitializeScreen(); // Display the current user's name near the top of the screen labelCurrentUser.Text = CFSysInfo.Data.MobileOptions.FirstName + " " + CFSysInfo.Data.MobileOptions.LastName; ToolsCF.SipShowIM(0); this.BringToFront(); Cursor.Current = Cursors.Default; this.Resize += new System.EventHandler(this.frmChangeUserName_Resize); this.ShowDialog(); screenAdv = ScreenAdv; backAvail = true; // Setting this to true will make this just displayed screen the "back one" this.Resize -= new System.EventHandler(this.frmChangeUserName_Resize); }
private void RepositionControls(bool forceRedraw) { ToolsCF.SipShowIM(0); // Ensure that SIP is collapsed int wid = 0, hgt = 0, aHgt = 0; if ((ToolsCF.UpdateScreenDimensions(out wid, out hgt, out aHgt)) | forceRedraw) { if (CFSysInfo.Data.DeviceSpecs.Platform == Platform.SmartPhone) { // To Do: Still to need to flesh out SmartPhone positioning } else { //int horizMargin = leftMargin + gap * 2; if (wid < hgt) // Is it in Portrait mode? { listViewSelectRecent.Left = wid / 2 - gap - listViewSelectRecent.Width; listViewSelectRecent.Height = hgt / 2; labelSequence.Left = listViewSelectRecent.Left - 1; listViewSelectDate.Left = wid / 2 + gap; listViewSelectDate.Height = listViewSelectRecent.Height; labelDate.Left = listViewSelectDate.Left - 1; } else // Landscape mode { listViewSelectRecent.Left = wid / 2 - gap * 4 - listViewSelectRecent.Width; listViewSelectRecent.Height = aHgt - gap * 4 - listViewSelectRecent.Top; labelSequence.Left = listViewSelectRecent.Left; listViewSelectDate.Left = wid / 2 + gap * 4; listViewSelectDate.Height = listViewSelectRecent.Height; labelDate.Left = listViewSelectDate.Left; } } } }
private void RepositionControls(bool forceRedraw) { int wid = 0, hgt = 0, aHgt = 0; if ((ToolsCF.UpdateScreenDimensions(out wid, out hgt, out aHgt)) || forceRedraw) { int gap = 4; // A small value, used as the basis for providing horiz and vert spacing if (panelTopics == null) { return; } if (CFSysInfo.Data.DeviceSpecs.Platform == Platform.SmartPhone) { // To Do: Still to need to flesh out SmartPhone positioning } else { // Both orientations panelTopics.Width = wid - gap * 4; if (wid < hgt) // Is it in Portrait mode? { labelTopIntro.Left = gap * 3; labelTopIntro.Width = wid - gap * 6; panelTopics.Height = aHgt - gap * 8; } else // Landscape mode { labelTopIntro.Left = gap * 3; labelTopIntro.Width = (int)(wid * 0.8); panelTopics.Height = aHgt - gap * 10; } } } }
private void PopulateForm(ArrayList respInfoArray) { int gap = 4; // A small value, used as the basis for providing horiz and vert spacing int rowHeight = 18; int wid, hgt, aHgt; ToolsCF.UpdateScreenDimensions(out wid, out hgt, out aHgt); // Create the scrolling panel for the topic controls panelTopics = new DataObjects.AutoScrollPanel(); panelTopics.Location = new Point(gap * 4, gap * 10); panelTopics.Size = new Size(wid - gap * 4, aHgt - gap * 8); this.Controls.Add(panelTopics); int top = gap * 2; int colWidth = panelTopics.Contents.Width / 2 - gap * 2; foreach (RespondentInfo respInfo in respInfoArray) { string propName = respInfo.PropName; string labelText = respInfo.LabelText; // Intro Label Label labelIntro = new Label(); labelIntro.Text = labelText + " :"; labelIntro.Location = new Point(0, top + 1); labelIntro.Size = new Size(gap * 18, rowHeight); labelIntro.TextAlign = ContentAlignment.TopLeft; labelIntro.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular); panelTopics.Contents.Controls.Add(labelIntro); // We've now added the label to the scrolling panel. So now see what type of control should be to its right if (respInfo.Presets != null) { ComboBoxEx comboBox = new ComboBoxEx(); comboBox.DropDownStyle = ComboBoxStyle.DropDownList; comboBox.Location = new Point(gap * 22, top); comboBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular); comboBox.Size = new Size(gap * 24, rowHeight); comboBox.Enabled = true; comboBox.Tag = respInfo; Tools.FillCombo(comboBox, respInfo.Presets); comboBox.Text = respInfo.Value; panelTopics.Contents.Controls.Add(comboBox); } else { TextBoxEx textBox = new TextBoxEx(); textBox.Tag = respInfo; // propName; textBox.Location = new Point(gap * 22, top); textBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular); textBox.Size = new Size(gap * 24, rowHeight); textBox.Enabled = true; textBox.Tag = respInfo; textBox.AcceptsTab = true; textBox.BackColor = Color.White; textBox.KeyPress += new KeyPressEventHandler(TextBox_KeyPress); // For now, we've only figured out how to check Numeric-Only on the fly textBox.LostFocus += new EventHandler(TextBox_LostFocus); textBox.Text = respInfo.Value; panelTopics.Contents.Controls.Add(textBox); } top += rowHeight + gap * 3; } panelTopics.SetScrollHeight(top + gap + 80); // The numeric value wad added to account for the SIP }
/// <summary> /// Adjusts the position of the controls holding the # of Respondents, # of Questions, and Revision # /// </summary> /// <param name="orientation"></param> private void AdjustSummaryInfoLocations(Orientation orientation) { int gap = 4; if (orientation == Orientation.Portrait) { if (!NewPoll) { ToolsCF.AutoSizeLabelText(labelRespondents, "Resp:"); labelRespondents.Location = new Point(listBoxFiles.Left, listBoxFiles.Bottom + gap * 2 + 2); textBoxRespondents.Location = new Point(labelRespondents.Right + gap, labelRespondents.Top - 3); ToolsCF.AutoSizeLabelText(labelQuestions, "Quest:"); labelQuestions.Location = new Point(textBoxRespondents.Right + gap * 4, labelRespondents.Top); textBoxQuestions.Location = new Point(labelQuestions.Right + gap, textBoxRespondents.Top); textBoxRevision.Location = new Point(listBoxFiles.Right - gap - textBoxRevision.Width, textBoxQuestions.Top); ToolsCF.AutoSizeLabelText(labelRevision, "Rev:"); labelRevision.Location = new Point(textBoxRevision.Left - gap - labelRevision.Width, labelQuestions.Top); } else { ToolsCF.AutoSizeLabelText(labelQuestions, "Questions:"); labelQuestions.Location = new Point(listBoxFiles.Left, listBoxFiles.Bottom + gap * 2 + 2); textBoxQuestions.Location = new Point(labelQuestions.Right + gap, labelQuestions.Top - 3); textBoxRevision.Location = new Point(listBoxFiles.Right - gap - textBoxRevision.Width, textBoxQuestions.Top); ToolsCF.AutoSizeLabelText(labelRevision, "Revision:"); labelRevision.Location = new Point(textBoxRevision.Left - gap - labelRevision.Width, labelQuestions.Top); } } else // Landscape mode { if (!NewPoll) { ToolsCF.AutoSizeLabelText(labelRespondents, "Responses:"); labelRespondents.Location = new Point(listBoxFiles.Left, listBoxFiles.Bottom + gap * 2); textBoxRespondents.Location = new Point(labelRespondents.Right + gap, labelRespondents.Top - 3); ToolsCF.AutoSizeLabelText(labelQuestions, "Questions:"); labelQuestions.Location = new Point(textBoxRespondents.Right + gap * 5, labelRespondents.Top); textBoxQuestions.Location = new Point(labelQuestions.Right + gap, textBoxRespondents.Top); textBoxRevision.Location = new Point(textBoxSummary.Right - gap - textBoxRevision.Width, textBoxQuestions.Top); ToolsCF.AutoSizeLabelText(labelRevision, "Revision:"); labelRevision.Location = new Point(textBoxRevision.Left - gap - labelRevision.Width, labelQuestions.Top); } else { ToolsCF.AutoSizeLabelText(labelQuestions, "Questions:"); labelQuestions.Location = new Point(listBoxFiles.Left + gap * 4, listBoxFiles.Bottom + gap * 2); textBoxQuestions.Location = new Point(labelQuestions.Right + gap, labelQuestions.Top - 3); textBoxRevision.Location = new Point(textBoxSummary.Right - gap * 8 - textBoxRevision.Width, textBoxQuestions.Top); ToolsCF.AutoSizeLabelText(labelRevision, "Revision:"); labelRevision.Location = new Point(textBoxRevision.Left - gap - labelRevision.Width, labelQuestions.Top); } } }
public void ShowSIP(bool show) { ToolsCF.SipShowIM((show == true) ? 1 : 0); }
private void RepositionControls(bool forceRedraw) { int wid = 0, hgt = 0, aHgt = 0; if ((ToolsCF.UpdateScreenDimensions(out wid, out hgt, out aHgt)) | forceRedraw) { int gap = 4; // A small value, used as the basis for providing horiz and vert spacing if (CFSysInfo.Data.DeviceSpecs.Platform == Platform.SmartPhone) { // To Do: Still to need to flesh out SmartPhone positioning } else { if (hgt > wid) // Is it in Portrait mode? { labelInstructions.Size = new Size(156, 46); labelInstructions.Left = (wid - labelInstructions.Width) / 2 + 5; labelInstructions.Top = 12; // Now size and stack buttons with available space // Topmost button will be gap*4 pixels below the Instructions text // Bottommost button will be gap*3 pixels above bottom edge of screen int topEdge = labelInstructions.Bottom + gap * 3; int availSpace = aHgt - topEdge - (gap * 4); // How we calculate 'unitHgt': // 4 Buttons: 4 buttons + 3 spaces (ie. 4*2 + 3*1 = 11) // 3 Buttons: 3 buttons + 2 spaces (ie. 3*2 + 2*1 = 8) int unitHgt = (numButtons == 4) ? availSpace / 11 : availSpace / 8; if (numButtons == 4) { buttonPersonalInfo.Top = topEdge; buttonPersonalInfo.Height = unitHgt * 2; buttonPersonalInfo.Left = (wid - buttonPersonalInfo.Width) / 2; buttonPollAgain.Top = buttonPersonalInfo.Bottom + unitHgt; } else { buttonPollAgain.Top = topEdge; } buttonPollAgain.Height = unitHgt * 2; buttonPollAgain.Left = (wid - buttonPollAgain.Width) / 2; buttonClose.Top = buttonPollAgain.Bottom + unitHgt; buttonClose.Height = buttonPollAgain.Height; buttonClose.Left = buttonPollAgain.Left; buttonComplete.Top = buttonClose.Bottom + unitHgt; buttonComplete.Height = buttonClose.Height; buttonComplete.Left = buttonClose.Left; } else // Landscape mode { labelInstructions.Size = new Size(200, 46); labelInstructions.Left = (wid - labelInstructions.Width) / 2 + 5; labelInstructions.Top = 12; int topEdge = labelInstructions.Bottom + gap * 3; int availSpace = aHgt - topEdge - (gap * 3); if (numButtons == 4) { // Now size and stack buttons with available space, in 2 x 2 pattern // Topmost button will be gap*3 pixels below the Instructions text // Bottommost button will be gap*3 pixels above bottom edge of screen int unitHgt = availSpace / 5; // 2 buttons + 1 space (ie. 2*2 + 1*1 = 5) buttonPersonalInfo.Top = topEdge; buttonPersonalInfo.Height = unitHgt * 2; buttonPersonalInfo.Left = wid / 2 - 10 - buttonPersonalInfo.Width; buttonPollAgain.Top = buttonPersonalInfo.Top; buttonPollAgain.Height = unitHgt * 2; buttonPollAgain.Left = wid / 2 + 10; buttonClose.Top = buttonPersonalInfo.Bottom + unitHgt; buttonClose.Height = buttonPersonalInfo.Height; buttonClose.Left = buttonPersonalInfo.Left; buttonComplete.Top = buttonClose.Top; buttonComplete.Height = buttonClose.Height; buttonComplete.Left = buttonPollAgain.Left; } else { // Stack the buttons 3 high, like in Portrait mode int unitHgt = availSpace / 8; // 3 buttons + 2 spaces (ie. 3*2 + 2*1 = 8) buttonPollAgain.Top = topEdge; buttonPollAgain.Height = unitHgt * 2; buttonPollAgain.Left = (wid - buttonPollAgain.Width) / 2; buttonClose.Top = buttonPollAgain.Bottom + unitHgt; buttonClose.Height = buttonPollAgain.Height; buttonClose.Left = buttonPollAgain.Left; buttonComplete.Top = buttonClose.Bottom + unitHgt; buttonComplete.Height = buttonClose.Height; buttonComplete.Left = buttonClose.Left; } } } } }
private void InitializeScreen() { ToolsCF.SipShowIM(0); // Ensure that SIP is collapsed RepositionControls(true); }
private void RepositionControls() { int wid, hgt, aHgt; if (ToolsCF.UpdateScreenDimensions(out wid, out hgt, out aHgt)) { int gap = 4; // A small value, used as the basis for providing horiz and vert spacing if (CFSysInfo.Data.DeviceSpecs.Platform == Platform.SmartPhone) { // To Do: Still to need to flesh out SmartPhone positioning } else { int x = gap * 2; int y = x; pictureAnimation.Left = (wid - pictureAnimation.Width) / 2; if (hgt > wid) // Is it in Portrait mode? { labelProdNameIntro.Location = new Point(x, y); labelProdName.Location = new Point(labelProdNameIntro.Right + 4, y); labelVersionIntro.Location = new Point(x, y + gap * 5); labelVersion.Location = new Point(labelProdName.Left, labelVersionIntro.Top); labelGuidIntro.Visible = true; labelGuid.Visible = true; labelGuidIntro.Location = new Point(x, labelVersion.Top + gap * 5); labelGuid.Location = new Point(x, labelGuidIntro.Top + gap * 4); labelDataPathIntro.Location = new Point(x, labelGuid.Top + gap * 5); labelDataPath.Location = new Point(x, labelDataPathIntro.Top + gap * 4); panelInfo.Size = new Size(Math.Max(labelGuid.Right + 4, labelDataPath.Right + 4), labelDataPath.Bottom + 4); panelInfo.Left = (wid - panelInfo.Width) / 2; panelInfo.Top = aHgt - gap * 4 - panelInfo.Height; } else // Landscape mode { labelProdNameIntro.Location = new Point(x, y); labelProdName.Location = new Point(labelProdNameIntro.Right + 6, y); labelVersionIntro.Location = new Point(x, y + gap * 5); labelVersion.Location = new Point(labelProdName.Left, labelVersionIntro.Top); // No room for GUID labelGuidIntro.Visible = false; labelGuid.Visible = false; labelDataPathIntro.Location = new Point(x, labelVersion.Top + gap * 5); labelDataPath.Location = new Point(labelProdName.Left, labelDataPathIntro.Top); panelInfo.Size = new Size(labelDataPath.Right + 4, labelDataPath.Bottom + 4); panelInfo.Left = (wid - panelInfo.Width) / 2; panelInfo.Top = aHgt - gap - panelInfo.Height; } } } }