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() { 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(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); } } } }
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); } } } }
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 }
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 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; } } } }