static public void ResizeObject(ref ResizeInfo R, ProgressBar pb, float sngRow, float sngCol, float sngNRows, float sngNCols, float adjustFont = 1) { pb.Location = getLocation(R, pb, sngRow, sngCol); pb.Size = new System.Drawing.Size((int)(sngNCols * R.W), (int)(sngNRows * R.H)); pb.Font = ChangeFontSize(pb.Font, R.FS * adjustFont); pb.TabIndex = ++R.tabIndex; }
static public void ResizeObject(ref ResizeInfo R, DateTimePicker dt, float sngRow, float sngCol, float sngNRows, float sngNCols, float adjustFont = 1) { dt.Location = getLocation(R, dt, sngRow, sngCol); dt.Size = new System.Drawing.Size((int)(sngNCols * R.W), (int)(sngNRows * R.H)); dt.Font = ChangeFontSize(dt.Font, R.FS * adjustFont); dt.TabIndex = ++R.tabIndex; }
static public void ResizeObject(ref ResizeInfo R, Button b, float sngRow, float sngCol, float sngNRows, float sngNCols, float adjustFont = 1) { b.Location = getLocation(R, b, sngRow, sngCol); b.Size = new System.Drawing.Size((int)(sngNCols * R.W), (int)(sngNRows * R.H)); b.Font = ChangeFontSize(b.Font, R.FS * adjustFont); if (R.setTabIndex) { b.TabIndex = ++R.tabIndex; } }
static public void ResizeObject(ref ResizeInfo R, ListBox l, float sngRow, float sngCol, float sngNRows, float sngNCols, float adjustFont = 0.8f) { l.Location = getLocation(R, l, sngRow, sngCol); l.Size = new System.Drawing.Size((int)(sngNCols * R.W), (int)(sngNRows * R.H)); l.Font = ChangeFontSize(l.Font, R.FS * adjustFont); l.ItemHeight = l.Font.Height; if (R.setTabIndex) { l.TabIndex = ++R.tabIndex; } }
static Point getLocation(ResizeInfo R, Control c, float nRow, float nCol) { Point result; if (c.Parent.GetType().Equals(typeof(TabPage))) { result = new System.Drawing.Point((int)(nCol * R.W), (int)(nRow * R.H + R.offset)); } else { result = new System.Drawing.Point((int)(nCol * R.W), (int)(nRow * R.H)); } return(result); }
// Adjust for screen resolution public void ResizeControls(ref ResizeInfo R, float GroupStart, float GroupHeight, int GroupWidth) { this.R = R; this.GroupWidth = GroupWidth; Utils.ResizeObject(ref R, SubControls, GroupStart + 0.75f, 0.5f, GroupHeight - 1, GroupWidth - 0.5f); { for (int i = 0; i < resizeNeeded.Length; i++) { resizeNeeded[i] = true; } resizeSubstitutions(ref R); } }
public void ResizeControls(ref ResizeInfo R, float GroupStart, float GroupHeight, int GroupWidth) { int tclHeight = (int)(tab.ClientSize.Height / R.H); this.R = R; Utils.ResizeObject(ref R, grpErrors, GroupStart, 1, GroupHeight, GroupWidth - 1); { Utils.ResizeObject(ref R, lbErrors, 1, 1, GroupHeight - 2, GroupWidth - 7, 1.5f); Utils.ResizeObject(ref R, lblErrorCount, GroupHeight - 9, GroupWidth - 5, 2, 3.5f); Utils.ResizeObject(ref R, txtErrorCount, GroupHeight - 9, GroupWidth - 5, 2, 3.5f); Utils.ResizeObject(ref R, cmdGetErrors, GroupHeight - 7, GroupWidth - 5, 3, 3.5f); Utils.ResizeObject(ref R, cmdClearErrors, GroupHeight - 3.5f, GroupWidth - 5, 3, 3.5f); } }
static public void ResizeObject(ref ResizeInfo R, TextBox t, float sngRow, float sngCol, float sngNRows, float sngNCols, float adjustFont = 1) { t.Location = getLocation(R, t, sngRow, sngCol); t.Size = new System.Drawing.Size((int)(sngNCols * R.W), (int)(sngNRows * R.H)); t.Font = ChangeFontSize(t.Font, R.FS * adjustFont); if (R.setTabIndex) { if (t.ReadOnly) { t.TabStop = false; } else { t.TabIndex = ++R.tabIndex; } } }
// Called from parent public void ResizeControls(ref ResizeInfo R) { int tclHeight = (int)(tab.ClientSize.Height / R.H); int tclWidth = (int)(tab.ClientSize.Width / R.W); float offset = (int)(tab.ClientSize.Height - tclHeight * R.H); if (parent.tclClasses.SelectedIndex != parent.tclClasses.TabPages.IndexOf(tab)) { return; } R.offset = offset; Utils.ResizeObject(ref R, tclViewXML, 0, 1, tclHeight - 7, tclWidth - 1); { Utils.ResizeObject(ref R, tvXML, 1, 1, tclHeight - 12, tclWidth - 3); Utils.ResizeObject(ref R, txtIndentedView, 1, 1, tclHeight - 12, tclWidth - 3); Utils.ResizeObject(ref R, chkIJPLibNames, tclHeight - 6, 1, 1.5f, 4); Utils.ResizeObject(ref R, chkErrorsOnly, tclHeight - 4.5f, 1, 1.5f, 4); Utils.ResizeObject(ref R, chkTraffic, tclHeight - 3, 1, 1.5f, 4); Utils.ResizeObject(ref R, cmdOpen, tclHeight - 6, 5, 2.5f, 4); Utils.ResizeObject(ref R, cmdRetrieve, tclHeight - 3, 5, 2.5f, 4); Utils.ResizeObject(ref R, cmdSend, tclHeight - 6, 9.5f, 2.5f, 4); Utils.ResizeObject(ref R, cmdVerify, tclHeight - 3, 9.5f, 2.5f, 4); Utils.ResizeObject(ref R, cmdSaveAs, tclHeight - 6, 14, 2.5f, 4); Utils.ResizeObject(ref R, cmdClear, tclHeight - 3, 14, 2.5f, 4); Utils.ResizeObject(ref R, lblSelectXmlTest, tclHeight - 6, 18.5f, 1, 6); Utils.ResizeObject(ref R, cbAvailableXmlTests, tclHeight - 5, 18.5f, 2, 6); Utils.ResizeObject(ref R, cmdBrowse, tclHeight - 3, 18.5f, 2.5f, 6); Utils.ResizeObject(ref R, cmdSendFileToPrinter, tclHeight - 6, 25, 2.5f, 4.5f); Utils.ResizeObject(ref R, cmdSendDisplayToPrinter, tclHeight - 3, 25, 2.5f, 4.5f); Utils.ResizeObject(ref R, lblSelectHardTest, tclHeight - 6, 30, 1, 5); Utils.ResizeObject(ref R, cbAvailableHardTests, tclHeight - 5, 30, 2, 5); Utils.ResizeObject(ref R, cmdRunHardTest, tclHeight - 3, 30, 2.5f, 5); // Resize VerifyView Utils.ResizeObject(ref R, VerifyView, 1, 1, tclHeight - 12, tclWidth - 3, 0.9f); Utils.ResizeObject(ref R, TrafficView, 1, 1, tclHeight - 12, tclWidth - 3, 0.9f); } R.offset = 0; }
// Called on resize or category change private void resizeSubstitutions(ref ResizeInfo R) { Utils.ResizeObject(ref R, lblAttribute, 1, 1, 1.5f, 4); Utils.ResizeObject(ref R, cbAttribute, 1, 5, 1.5f, 6); if (vCat >= 0 && resizeNeeded[vCat]) { resizeNeeded[vCat] = false; for (int i = 0; i < subLabels[vCat].Length; i++) { float r = 3.5f + 3 * (int)(i / 10); float c = (i % 10) * 3.25f + 0.25f; Utils.ResizeObject(ref R, subLabels[vCat][i], r, c, 1.5f, 1); Utils.ResizeObject(ref R, subTexts[vCat][i], r, c + 1, 1.5f, 2.25f); } } Utils.ResizeObject(ref R, subGet, 1, GroupWidth - 9, 1.5f, 3); Utils.ResizeObject(ref R, subSet, 1, GroupWidth - 5, 1.5f, 3); }
public void ResizeControls(ref ResizeInfo R, float GroupStart, float GroupHeight, int GroupWidth) { int tclHeight = (int)(tab.ClientSize.Height / R.H); this.R = R; float gap = 0.25f; float size = (GroupWidth - 3 * gap) / 2.0f; Utils.ResizeObject(ref R, grpGroups, GroupStart, gap, GroupHeight, size); { Utils.ResizeObject(ref R, lbGroupNames, 1, 1, GroupHeight - 4, size - 2, 1.5f); Utils.ResizeObject(ref R, cmdGetGroupNames, GroupHeight - 3, size - 5, 2, 4); } Utils.ResizeObject(ref R, grpMessages, GroupStart, size + gap * 2, GroupHeight, size); { Utils.ResizeObject(ref R, lbMessagesNames, 1, 1, GroupHeight - 4, size - 2, 1.5f); Utils.ResizeObject(ref R, cmdGetMessageNames, GroupHeight - 3, size - 5, 2, 4); } }
// Refit the controls based on the new space requirem,ents public void ResizeControls(ref ResizeInfo R, float GroupStart, float GroupHeight, int GroupWidth) { this.R = R; Utils.ResizeObject(ref R, UpControls, GroupStart + 0.75f, 0.5f, GroupHeight, GroupWidth - 0.5f); { Utils.ResizeObject(ref R, lblLayout, 2, 1, 1.5f, 2); Utils.ResizeObject(ref R, cbLayout, 2, 3, 1.5f, 4); Utils.ResizeObject(ref R, lblFontRows, 2, 7, 1.5f, 2); Utils.ResizeObject(ref R, cbFontRows, 2, 9, 1.5f, 3); Utils.ResizeObject(ref R, lblIcsCols, 2, 12, 1.5f, 2); Utils.ResizeObject(ref R, cbIcsCols, 2, 14, 1.5f, 3); Utils.ResizeObject(ref R, lblUpCount, 2, 17, 1.5f, 2); Utils.ResizeObject(ref R, cbUpCount, 2, 19, 1.5f, 3); Utils.ResizeObject(ref R, lblUpPosition, 2, 22, 1.5f, 2); Utils.ResizeObject(ref R, cbUpPosition, 2, 24, 1.5f, 3); Utils.ResizeObject(ref R, UpGet, 1.75f, 27.5f, 2, 3); Utils.ResizeObject(ref R, UpSet, 1.75f, 31, 2, 3); Utils.ResizeObject(ref R, grpGrid, 4, 1, GroupHeight - 8, GroupWidth - 2); { BitMapToImage(); } Utils.ResizeObject(ref R, hsbGrid, GroupHeight - 6, 1, 2, GroupWidth - 2); Utils.ResizeObject(ref R, UpNew, GroupHeight - 3, GroupWidth - 17, 2, 3); Utils.ResizeObject(ref R, UpClear, GroupHeight - 3, GroupWidth - 13, 2, 3); Utils.ResizeObject(ref R, UpBrowse, GroupHeight - 3, GroupWidth - 9, 2, 3); Utils.ResizeObject(ref R, UpSaveAs, GroupHeight - 3, GroupWidth - 5, 2, 3); } }
static public void ResizeObject(ref ResizeInfo R, DataGridView dg, float sngRow, float sngCol, float sngNRows, float sngNCols, float adjustFont = 1) { dg.Location = getLocation(R, dg, sngRow, sngCol); dg.Size = new System.Drawing.Size((int)(sngNCols * R.W), (int)(sngNRows * R.H)); dg.Font = ChangeFontSize(dg.Font, R.FS * adjustFont); }
static public void ResizeObject(ref ResizeInfo R, TabControl t, float sngRow, float sngCol, float sngNRows, float sngNCols, float adjustFont = 1) { t.Location = getLocation(R, t, sngRow, sngCol); t.Size = new System.Drawing.Size((int)(sngNCols * R.W), (int)(sngNRows * R.H)); t.Font = ChangeFontSize(t.Font, R.FS * adjustFont); }
static public void ResizeObject(ref ResizeInfo R, Label l, float sngRow, float sngCol, float sngNRows, float sngNCols, float adjustFont = 1) { l.Location = getLocation(R, l, sngRow, sngCol); l.Size = new System.Drawing.Size((int)(sngNCols * R.W), (int)(sngNRows * R.H)); l.Font = ChangeFontSize(l.Font, R.FS * adjustFont); }
// Resize all the controls on the tab public void ResizeControls(ref ResizeInfo R) { this.R = R; parent.tclClasses.Visible = false; tclHeight = (int)(tab.ClientSize.Height / R.H); tclWidth = (int)(tab.ClientSize.Width / R.W); float offset = (int)(tab.ClientSize.Height - tclHeight * R.H); R.offset = offset; float cw = 17.5f; float ExtraGroupHeight = 0; Utils.ResizeObject(ref R, hdrs[0], 0.5f, 0.25f, 1.5f, 8); Utils.ResizeObject(ref R, hdrs[1], 0.5f, 8.25f, 1.5f, 1f); Utils.ResizeObject(ref R, hdrs[2], 0.5f, 9.25f, 1.5f, 5); Utils.ResizeObject(ref R, hdrs[3], 0.5f, 14.25f, 1.5f, 3); if (labels.Length > Half) { Utils.ResizeObject(ref R, hdrs[4], 0.5f, 0.25f + cw, 1.5f, 8); Utils.ResizeObject(ref R, hdrs[5], 0.5f, 8.25f + cw, 1.5f, 1f); Utils.ResizeObject(ref R, hdrs[6], 0.5f, 9.25f + cw, 1.5f, 5); Utils.ResizeObject(ref R, hdrs[7], 0.5f, 14.25f + cw, 1.5f, 3); } for (int i = 0; i < labels.Length; i++) { int r; int c; if (i < Half) { r = 2 + i * 2; c = 0; } else { r = 2 + (i - Half) * 2; c = 1; } Utils.ResizeObject(ref R, labels[i], r, 0.25f + c * cw, 1.5f, 8); Utils.ResizeObject(ref R, counts[i], r, 8.25f + c * cw, 1.5f, 1); Utils.ResizeObject(ref R, texts[i], r, 9.5f + c * cw, 1.5f, 4.75f); if (dropdowns[i] != null) { Utils.ResizeObject(ref R, dropdowns[i], r, 9.5f + c * cw, 1.5f, 4.75f); } if (gets[i] != null) { Utils.ResizeObject(ref R, gets[i], r, 14.5f + c * cw, 1.5f, 1.5f); } if (sets[i] != null) { Utils.ResizeObject(ref R, sets[i], r, 16.25f + c * cw, 1.5f, 1.5f); } if (services[i] != null) { Utils.ResizeObject(ref R, services[i], r, 14.5f + c * cw, 1.5f, 3.25f); } } Utils.ResizeObject(ref R, getAll, tclHeight - 4, 27.5f, 2.75f, 3.5f); Utils.ResizeObject(ref R, setAll, tclHeight - 4, 31.5f, 2.75f, 3.5f); if (extrasUsed > 0) { ExtraGroupHeight = (2 * ((extrasUsed + 1) / 2)) + 1.25f; Utils.ResizeObject(ref R, ExtraControls, tclHeight - 2 - 2 * ((extrasUsed + 1) / 2), 0.5f, ExtraGroupHeight, 26.5f); int r = -1; int c = 0; for (int i = 0; i < extrasUsed; i++) { if ((i & 1) == 0) { c = 0; r += 2; } else { c = 13; } Utils.ResizeObject(ref R, ExtraLabel[i], r, 0.25f + c, 2, 4.5f); Utils.ResizeObject(ref R, ExtraText[i], r, 5 + c, 1.5f, 3); if (ExtraDropdowns[i] != null) { Utils.ResizeObject(ref R, ExtraDropdowns[i], r, 5 + c, 1.5f, 3); } Utils.ResizeObject(ref R, ExtraGet[i], r, 8.5f + c, 1.5f, 2); Utils.ResizeObject(ref R, ExtraSet[i], r, 11 + c, 1.5f, 2); } } // Tab specific controls float groupStart = (cc == ClassCode.Substitution_rules || cc == ClassCode.IJP_operation || cc == ClassCode.Print_data_management) ? (labels.Length / 2 + 1) * 2 : (labels.Length + 1) * 2; float groupHeight = tclHeight - groupStart - Math.Max(ExtraGroupHeight, 3.5f) - 1; Substitution?.ResizeControls(ref R, groupStart, groupHeight, tclWidth); UserPattern?.ResizeControls(ref R, groupStart, groupHeight - 1, tclWidth); Errors?.ResizeControls(ref R, groupStart, groupHeight - 1, tclWidth); PrintManagement?.ResizeControls(ref R, groupStart, groupHeight - 1, tclWidth); R.offset = 0; parent.tclClasses.Visible = true; }
// Handle all screen resolutions private void HitachiBrowser_Resize(object sender, EventArgs e) { // // Avoid resize before Program Load has run or on screen minimize if (initComplete && ClientRectangle.Height > 0) { // this.SuspendLayout(); // Build local parameters R = Utils.InitializeResize(this, 49, 47, true); #region Left Column Utils.ResizeObject(ref R, lblIPAddress, 1, 1, 2, 3); Utils.ResizeObject(ref R, txtIPAddress, 1, 4, 2, 5); Utils.ResizeObject(ref R, lblPort, 3, 1, 2, 3); Utils.ResizeObject(ref R, txtPort, 3, 4, 2, 5); Utils.ResizeObject(ref R, lblSessionID, 5, 1, 2, 3); Utils.ResizeObject(ref R, txtSessionID, 5, 4, 2, 5); Utils.ResizeObject(ref R, lblSoftwareVersion, 7, 1, 2, 3); Utils.ResizeObject(ref R, cbSoftwareVersion, 7, 4, 2, 5); Utils.ResizeObject(ref R, btnStartSession, 9.5f, 0.5f, 2, 4); Utils.ResizeObject(ref R, btnEndSession, 9.5f, 5, 2, 4); Utils.ResizeObject(ref R, btnForwardOpen, 12, 0.5f, 2, 4); Utils.ResizeObject(ref R, btnForwardClose, 12, 5, 2, 4); Utils.ResizeObject(ref R, lblClassCode, 15, 0.5f, 1, 8.5f); Utils.ResizeObject(ref R, cbClassCode, 16, 0.5f, 2, 8.5f); Utils.ResizeObject(ref R, lblFunction, 18, 0.5f, 1, 8.5f); Utils.ResizeObject(ref R, cbFunction, 19, 0.5f, 2, 8.5f); Utils.ResizeObject(ref R, btnIssueGet, 21, 0.5f, 2, 4); Utils.ResizeObject(ref R, btnIssueSet, 21, 5, 2, 4); Utils.ResizeObject(ref R, btnIssueService, 21, 0.5f, 2, 8.5f); Utils.ResizeObject(ref R, lblStatus, 23, 0.5f, 1, 8.5f); Utils.ResizeObject(ref R, txtStatus, 24, 0.5f, 2, 8.5f); Utils.ResizeObject(ref R, lblCountOut, 26, 0.5f, 1, 1); Utils.ResizeObject(ref R, lbldataOut, 26, 2, 1, 7); Utils.ResizeObject(ref R, txtCountOut, 27, 0.5f, 2, 1); Utils.ResizeObject(ref R, txtDataOut, 27, 2, 2, 7); Utils.ResizeObject(ref R, txtDataBytesOut, 29, 0.5f, 2, 8.5f); Utils.ResizeObject(ref R, lblCountIn, 31, 0.5f, 1, 1); Utils.ResizeObject(ref R, lbldataIn, 31, 2, 1, 7); Utils.ResizeObject(ref R, txtCountIn, 32, 0.5f, 2, 1); Utils.ResizeObject(ref R, txtDataIn, 32, 2, 2, 7); Utils.ResizeObject(ref R, txtDataBytesIn, 34, 0.5f, 2, 8.5f); Utils.ResizeObject(ref R, lblSaveFolder, 36, 0.5f, 1, 6); Utils.ResizeObject(ref R, txtSaveFolder, 37, 0.5f, 2, 8.5f); Utils.ResizeObject(ref R, btnBrowse, 39, 0.5f, 2, 4); Utils.ResizeObject(ref R, btnProperties, 39, 5, 2, 4); Utils.ResizeObject(ref R, lstErrors, 42, 0.5f, 6, 8.5f); #endregion #region Classes Utils.ResizeObject(ref R, tclClasses, 1, 10, 44, 36); switch (tclClasses.SelectedIndex) { case 0: // ccIDX == 0x7A Index function indexAttr.ResizeControls(ref R); break; case 1: // ccIJP == 0x75 IJP operation function oprAttr.ResizeControls(ref R); break; case 2: // ccPDM == 0x66 Print data management function pdmAttr.ResizeControls(ref R); break; case 3: // ccPS == 0x68 Print specification function psAttr.ResizeControls(ref R); break; case 4: // ccPF == 0x67 Print format function pFmtAttr.ResizeControls(ref R); break; case 5: // ccCal == 0x69 Calendar function calAttr.ResizeControls(ref R); break; case 6: // ccSR == 0x6C Substitution rules function sRulesAttr.ResizeControls(ref R); break; case 7: // ccCount == 0x79 Count function countAttr.ResizeControls(ref R); break; case 8: // ccUI == 0x73 Unit Information function unitInfoAttr.ResizeControls(ref R); break; case 9: // ccES == 0x71 Enviroment setting function envirAttr.ResizeControls(ref R); break; case 10: // ccOM == 0x74 Operation management function mgmtAttr.ResizeControls(ref R); break; case 11: // ccUP == 0x6B User pattern function userPatAttr.ResizeControls(ref R); break; case 12: processXML.ResizeControls(ref R); break; } #endregion #region Bottom Row Utils.ResizeObject(ref R, btnCom, 45.5f, 10, 3, 4); Utils.ResizeObject(ref R, btnAutoReflection, 45.5f, 14.5f, 3, 5); Utils.ResizeObject(ref R, btnManagementFlag, 45.5f, 20, 3, 5); Utils.ResizeObject(ref R, btnRefresh, 45.5f, 25.5f, 3, 3); Utils.ResizeObject(ref R, btnReformat, 45.5f, 25.5f, 3, 3); Utils.ResizeObject(ref R, btnStop, 45.5f, 29, 3, 3); Utils.ResizeObject(ref R, btnViewTraffic, 45.5f, 32.5f, 3, 3); Utils.ResizeObject(ref R, btnResetTraffic, 45.5f, 36, 3, 3); Utils.ResizeObject(ref R, btnReadAll, 45.5f, 39.5f, 3, 3); Utils.ResizeObject(ref R, btnExit, 45.5f, 43, 3, 3); #endregion //this.Refresh(); this.ResumeLayout(); } }
static public void ResizeObject(ref ResizeInfo R, PictureBox p, float sngRow, float sngCol, float sngNRows, float sngNCols, float adjustFont = 1) { p.Location = getLocation(R, p, sngRow, sngCol); p.Size = new System.Drawing.Size((int)(sngNCols * R.W), (int)(sngNRows * R.H)); }
static public void ResizeObject(ref ResizeInfo R, HScrollBar h, float sngRow, float sngCol, float sngNRows, float sngNCols, float adjustFont = 1) { h.Location = getLocation(R, h, sngRow, sngCol); h.Size = new System.Drawing.Size((int)(sngNCols * R.W), (int)(sngNRows * R.H)); }
static public void ResizeObject(ref ResizeInfo R, TreeView tv, float sngRow, float sngCol, float sngNRows, float sngNCols, float adjustFont = 1) { tv.Location = getLocation(R, tv, sngRow, sngCol); tv.Size = new System.Drawing.Size((int)(sngNCols * R.W), (int)(sngNRows * R.H)); }