private void AddRftTextBoxes(DesignerForm newDialog, XmlNodeList rtfTexts) { foreach (XmlNode text in rtfTexts) { try { RichTextBox rtfCtrl = new RichTextBox(); SetControlAttributes(rtfCtrl, text); string elementText = GetTextFromXmlElement(text); rtfCtrl.Rtf = elementText; newDialog.AddControl(text, rtfCtrl); } catch { } } }
private void AddProgressBars(DesignerForm newDialog, XmlNodeList progressBars) { foreach (XmlNode progressbar in progressBars) { try { ProgressBar progressCtrl = new ProgressBar(); SetControlAttributes(progressCtrl, progressbar); progressCtrl.Maximum = 100; progressCtrl.Value = 33; newDialog.AddControl(progressbar, progressCtrl); } catch { } } }
private void AddRadioButtonGroups(DesignerForm newDialog, XmlNodeList radioButtonGroups) { foreach (XmlNode radioButtonGroup in radioButtonGroups) { try { string radioGroupName = radioButtonGroup.Attributes["Property"].Value; string defaultValue = ExpandWixProperties(String.Format("[{0}]", radioGroupName)); XmlNode radioGroup = wixFiles.WxsDocument.SelectSingleNode(String.Format("//wix:RadioGroup[@Property='{0}']", radioGroupName), wixFiles.WxsNsmgr); if (radioGroup == null) { radioGroup = wixFiles.WxsDocument.SelectSingleNode(String.Format("//wix:RadioButtonGroup[@Property='{0}']", radioGroupName), wixFiles.WxsNsmgr); } Panel panel = new Panel(); SetControlAttributes(panel, radioButtonGroup); foreach (XmlNode radioElement in radioGroup.ChildNodes) { RadioButton radioCtrl = new RadioButton(); SetText(radioCtrl, radioElement); SetTag(radioCtrl, radioElement); SetControlAttributes(radioCtrl, radioElement); panel.Controls.Add(radioCtrl); if (((string)radioCtrl.Tag).ToLower() == defaultValue.ToLower()) { radioCtrl.Checked = true; } } newDialog.AddControl(radioButtonGroup, panel); } catch { } } }
private void AddMaskedEdits(DesignerForm newDialog, XmlNodeList maskedEdits) { foreach (XmlNode edit in maskedEdits) { try { TextBox newEdit = new TextBox(); SetControlAttributes(newEdit, edit); SetText(newEdit, edit); newEdit.BorderStyle = BorderStyle.Fixed3D; newDialog.AddControl(edit, newEdit); } catch { } } }
private void AddPathEditBoxes(DesignerForm newDialog, XmlNodeList patheditboxes) { foreach (XmlNode pathEdit in patheditboxes) { try { TextBox newPathEdit = new TextBox(); SetControlAttributes(newPathEdit, pathEdit); SetText(newPathEdit, pathEdit); newDialog.AddControl(pathEdit, newPathEdit); } catch { } } }
private void AddVolumeComboBoxes(DesignerForm newDialog, XmlNodeList volumeCombos) { foreach (XmlNode volumeCombo in volumeCombos) { try { ComboBox comboCtrl = new ComboBox(); comboCtrl.Items.Add("VolumeCombo"); comboCtrl.SelectedIndex = 0; SetControlAttributes(comboCtrl, volumeCombo); newDialog.AddControl(volumeCombo, comboCtrl); } catch { } } }
private void AddButtons(DesignerForm newDialog, XmlNodeList buttons) { foreach (XmlNode button in buttons) { try { Button newButton = new Button(); SetControlAttributes(newButton, button); if (button.Attributes["Icon"] != null && button.Attributes["Icon"].Value.ToLower() == "yes") { string binaryId = GetTextFromXmlElement(button); try { using (Stream imageStream = GetBinaryStream(binaryId)) { Bitmap bmp = new Icon(imageStream).ToBitmap(); Bitmap dest = new Bitmap((int)Math.Round(bmp.Width * scale), (int)Math.Round(bmp.Height * scale)); Graphics g = Graphics.FromImage(dest); g.InterpolationMode = InterpolationMode.HighQualityBicubic; g.DrawImage(bmp, new Rectangle(0, 0, dest.Width, dest.Height), new Rectangle(0, 0, bmp.Width, bmp.Height), GraphicsUnit.Pixel); g.Dispose(); bmp.Dispose(); newButton.Image = dest; } } catch { SetText(newButton, button); } } else { newButton.FlatStyle = FlatStyle.System; SetText(newButton, button); } newDialog.AddControl(button, newButton); } catch { } } }
private void AddHyperlinks(DesignerForm newDialog, XmlNodeList hyperlinks) { foreach (XmlNode hyperlink in hyperlinks) { try { Label label = new Label(); SetControlAttributes(label, hyperlink); SetText(label, hyperlink); label.BackColor = Color.Transparent; label.ForeColor = Color.Blue; label.Font = new Font(label.Font, FontStyle.Underline); newDialog.AddControl(hyperlink, label); } catch { } } }
private void AddIcons(DesignerForm newDialog, XmlNodeList icons) { foreach (XmlNode icon in icons) { try { PictureBox picCtrl = new PictureBox(); SetControlAttributes(picCtrl, icon); picCtrl.SizeMode = PictureBoxSizeMode.StretchImage; string binaryId = GetTextFromXmlElement(icon); try { using (Stream imageStream = GetBinaryStream(binaryId)) { picCtrl.Image = new Icon(imageStream).ToBitmap(); } } catch { } newDialog.AddControl(icon, picCtrl); } catch { } } }
private void AddDirectoryLists(DesignerForm newDialog, XmlNodeList directoryLists) { foreach (XmlNode directoryList in directoryLists) { try { ListBox listBox = new ListBox(); listBox.Items.Add("Director content"); listBox.SelectedIndex = 0; SetControlAttributes(listBox, directoryList); newDialog.AddControl(directoryList, listBox); } catch { } } }
private void AddGroupBoxes(DesignerForm newDialog, XmlNodeList groupBoxes) { foreach (XmlNode group in groupBoxes) { try { GroupBox groupCtrl = new GroupBox(); // The FlatStyle.System makes the control look weird. // groupCtrl.FlatStyle = FlatStyle.System; SetControlAttributes(groupCtrl, group); SetText(groupCtrl, group); newDialog.AddControl(group, groupCtrl); } catch { } } }
private void AddDirectoryCombos(DesignerForm newDialog, XmlNodeList directoryCombos) { foreach (XmlNode directoryCombo in directoryCombos) { try { ComboBox comboCtrl = new ComboBox(); comboCtrl.Items.Add("Directories"); comboCtrl.SelectedIndex = 0; SetControlAttributes(comboCtrl, directoryCombo); newDialog.AddControl(directoryCombo, comboCtrl); } catch { } } }
private void AddComboBoxes(DesignerForm newDialog, XmlNodeList comboBoxes) { foreach (XmlNode comboBox in comboBoxes) { try { ComboBox comboCtrl = new ComboBox(); SetControlAttributes(comboCtrl, comboBox); comboCtrl.Items.Add("ComboBox"); comboCtrl.SelectedIndex = 0; newDialog.AddControl(comboBox, comboCtrl); } catch { } } }
private void AddCheckBoxes(DesignerForm newDialog, XmlNodeList checkboxes) { foreach (XmlNode check in checkboxes) { try { CheckBox checkBox = new CheckBox(); SetControlAttributes(checkBox, check); SetText(checkBox, check); newDialog.AddControl(check, checkBox); } catch { } } }
private void AddSelectionTrees(DesignerForm newDialog, XmlNodeList selectionTrees) { foreach (XmlNode selectionTree in selectionTrees) { try { TreeView treeView = new TreeView(); treeView.Scrollable = false; treeView.Nodes.Add(new TreeNode("Selection tree")); SetControlAttributes(treeView, selectionTree); newDialog.AddControl(selectionTree, treeView); } catch { } } }
private void AddLines(DesignerForm newDialog, XmlNodeList lines) { foreach (XmlNode line in lines) { try { Label label = new Label(); SetControlAttributes(label, line); label.Height = 2; label.BorderStyle = BorderStyle.Fixed3D; newDialog.AddControl(line, label); } catch { } } }
private void AddTexts(DesignerForm newDialog, XmlNodeList texts) { foreach (XmlNode text in texts) { try { Label label = new Label(); SetControlAttributes(label, text); SetText(label, text); label.BackColor = Color.Transparent; newDialog.AddControl(text, label); } catch { } } }
private void AddListBoxes(DesignerForm newDialog, XmlNodeList listBoxes) { foreach (XmlNode list in listBoxes) { try { ListBox listCtrl = new ListBox(); SetControlAttributes(listCtrl, list); listCtrl.Items.Add(GetFromXmlElement(list, "Property")); newDialog.AddControl(list, listCtrl); } catch { } } }
private void AddVolumeCostLists(DesignerForm newDialog, XmlNodeList volumeCostLists) { foreach (XmlNode volumeCostList in volumeCostLists) { try { ListView listView = new ListView(); ColumnHeader columnHeader1 = new ColumnHeader(); ColumnHeader columnHeader2 = new ColumnHeader(); ColumnHeader columnHeader3 = new ColumnHeader(); ColumnHeader columnHeader4 = new ColumnHeader(); ColumnHeader columnHeader5 = new ColumnHeader(); columnHeader1.Text = "Volume"; columnHeader2.Text = "Disk Size"; columnHeader3.Text = "Available"; columnHeader4.Text = "Required"; columnHeader5.Text = "Difference"; columnHeader1.TextAlign = HorizontalAlignment.Left; columnHeader2.TextAlign = HorizontalAlignment.Right; columnHeader3.TextAlign = HorizontalAlignment.Right; columnHeader4.TextAlign = HorizontalAlignment.Right; columnHeader5.TextAlign = HorizontalAlignment.Right; listView.Columns.AddRange(new ColumnHeader[] { columnHeader1, columnHeader2, columnHeader3, columnHeader4, columnHeader5}); listView.Items.Add(new ListViewItem(new string[] { "C:", "30GB", "3200MB", "1MB", "3189MB" })); listView.View = System.Windows.Forms.View.Details; SetControlAttributes(listView, volumeCostList); newDialog.AddControl(volumeCostList, listView); } catch { } } }
private void AddBackgroundBitmaps(DesignerForm newDialog, XmlNodeList bitmaps) { PictureControl pictureCtrl = null; ArrayList allPictureControls = new ArrayList(); foreach (XmlNode bitmap in bitmaps) { try { string binaryId = GetTextFromXmlElement(bitmap); Bitmap bmp = null; try { using (Stream imageStream = GetBinaryStream(binaryId)) { bmp = new Bitmap(imageStream); } } catch { } pictureCtrl = new PictureControl(bmp, allPictureControls); allPictureControls.Add(pictureCtrl); SetControlAttributes(pictureCtrl, bitmap); newDialog.AddControl(bitmap, pictureCtrl); } catch { } } if (pictureCtrl != null) { pictureCtrl.Draw(); } }