public virtual void OnPropertyGridPopupContextMenu(object sender, EventArgs e) { if (CurrentGrid.SelectedObject == null) { return; } MenuItem menuItemSeparator = new IconMenuItem("-"); MenuItem menuItem1 = new IconMenuItem("Add &New", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp"))); MenuItem menuItem3 = new IconMenuItem("&Delete", new Bitmap(WixFiles.GetResourceStream("bmp.delete.bmp"))); MenuItem menuItem4 = new IconMenuItem("&Rename"); MenuItem menuItem5 = new IconMenuItem("&Import XML", new Bitmap(WixFiles.GetResourceStream("bmp.import.bmp"))); menuItem1.Click += new EventHandler(OnNewPropertyGridItem); menuItem3.Click += new EventHandler(OnDeletePropertyGridItem); menuItem4.Click += new EventHandler(OnRenamePropertyGridItem); menuItem5.Click += new EventHandler(OnImportPropertyGridItem); CurrentGridContextMenu.MenuItems.Clear(); CurrentGridContextMenu.MenuItems.Add(menuItem1); if (CurrentGrid.SelectedGridItem.PropertyDescriptor != null) { CurrentGridContextMenu.MenuItems.Add(menuItem3); CurrentGridContextMenu.MenuItems.Add(menuItem4); } CurrentGridContextMenu.MenuItems.Add(menuItem5); }
public void DrawSelection(Control ctrl, Graphics formGraphics) { int size = 6; Brush horBorderBrush = new TextureBrush(new Bitmap(WixFiles.GetResourceStream("hcontrolborder.bmp"))); Brush verBorderBrush = new TextureBrush(new Bitmap(WixFiles.GetResourceStream("vcontrolborder.bmp"))); Rectangle topBorder = new Rectangle(ctrl.Left, ctrl.Top - size - 1, ctrl.Width, size + 1); Rectangle bottomBorder = new Rectangle(ctrl.Left, ctrl.Bottom, ctrl.Width, size + 1); formGraphics.FillRectangles(horBorderBrush, new Rectangle[] { topBorder, bottomBorder }); Rectangle rightBorder = new Rectangle(ctrl.Right, ctrl.Top, size + 1, ctrl.Height); Rectangle leftBorder = new Rectangle(ctrl.Left - size - 1, ctrl.Top, size + 1, ctrl.Height); formGraphics.FillRectangles(verBorderBrush, new Rectangle[] { rightBorder, leftBorder }); Rectangle leftTop = new Rectangle(ctrl.Left - size - 1, ctrl.Top - size - 1, size, size); Rectangle rightTop = new Rectangle(ctrl.Right, ctrl.Top - size - 1, size, size); Rectangle leftBottom = new Rectangle(ctrl.Left - size - 1, ctrl.Bottom, size, size); Rectangle rightBottom = new Rectangle(ctrl.Right, ctrl.Bottom, size, size); Rectangle leftMid = new Rectangle(ctrl.Left - size - 1, ctrl.Top + (ctrl.Height - size) / 2, size, size); Rectangle rightMid = new Rectangle(ctrl.Right, ctrl.Top + (ctrl.Height - size) / 2, size, size); Rectangle midBottom = new Rectangle(ctrl.Left + (ctrl.Width - size) / 2, ctrl.Bottom, size, size); Rectangle midTop = new Rectangle(ctrl.Left + (ctrl.Width - size) / 2, ctrl.Top - size - 1, size, size); formGraphics.FillRectangles(Brushes.White, new Rectangle[] { leftTop, rightTop, leftBottom, rightBottom, leftMid, rightMid, midBottom, midTop }); formGraphics.DrawRectangles(Pens.Black, new Rectangle[] { leftTop, rightTop, leftBottom, rightBottom, leftMid, rightMid, midBottom, midTop }); }
public override void OnPropertyGridPopupContextMenu(object sender, EventArgs e) { base.OnPropertyGridPopupContextMenu(sender, e); MenuItem menuItem2 = new IconMenuItem("Add &File", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp"))); menuItem2.Click += new EventHandler(OnAddFilePropertyGridItem); CurrentGridContextMenu.MenuItems.Add(1, menuItem2); }
private static ImageList CreateImageList(StringCollection types) { ImageList images = new ImageList(); Bitmap unknownBmp = new Bitmap(WixFiles.GetResourceStream("elements.unknown.bmp")); unknownBmp.MakeTransparent(); Bitmap typeBmp; foreach (string type in types) { try { typeBmp = null; if (type.StartsWith("deprecated")) { if (WixFiles.HasResource(String.Format("elements.{0}.bmp", type.Remove(0, 11).ToLower()))) { typeBmp = new Bitmap(WixFiles.GetResourceStream(String.Format("elements.{0}.bmp", type.Remove(0, 11).ToLower()))); Bitmap tmpBmp = OverlayWarning(typeBmp); typeBmp.Dispose(); typeBmp = tmpBmp; } } else { if (WixFiles.HasResource(String.Format("elements.{0}.bmp", type.ToLower()))) { typeBmp = new Bitmap(WixFiles.GetResourceStream(String.Format("elements.{0}.bmp", type.ToLower()))); } } if (typeBmp != null) { typeBmp.MakeTransparent(); } else { typeBmp = unknownBmp; } } catch { typeBmp = unknownBmp; } images.Images.Add(typeBmp); } Bitmap unsupportedBmp = new Bitmap(WixFiles.GetResourceStream("elements.unsupported.bmp")); unsupportedBmp.MakeTransparent(); images.Images.Add(unsupportedBmp); return(images); }
protected override void PopupPanelContextMenu(System.Object sender, System.EventArgs e) { // clear menu and add import menu base.PopupPanelContextMenu(sender, e); // add custom menu, index has to be used!!! IconMenuItem subMenuItem = new IconMenuItem("New Feature", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp"))); subMenuItem.Click += new EventHandler(NewCustomElement_Click); PanelContextMenu.MenuItems.Add(0, subMenuItem); }
protected virtual void PopupPanelContextMenu(System.Object sender, System.EventArgs e) { //clear menu panelContextMenu.MenuItems.Clear(); //add import menu IconMenuItem itemImport = new IconMenuItem("&Import XML", new Bitmap(WixFiles.GetResourceStream("bmp.import.bmp"))); itemImport.Click += new System.EventHandler(ImportElement_Click); panelContextMenu.MenuItems.Add(new IconMenuItem("-")); panelContextMenu.MenuItems.Add(itemImport); }
public StepSheet(XmlElement step, WizardForm creator) : base(creator) { this.stepElement = step; this.AutoScroll = true; errorProvider = new ErrorProviderFixed(); errorProvider.ContainerControl = this; errorProvider.AutoPopDelay = 20000; errorProvider.BlinkStyle = ErrorBlinkStyle.NeverBlink; Bitmap b = new Bitmap(WixFiles.GetResourceStream("bmp.info.bmp")); errorProvider.Icon = Icon.FromHandle(b.GetHicon()); }
public override void OnPropertyGridPopupContextMenu(object sender, EventArgs e) { if (CurrentGrid.SelectedObject == null) { return; } base.OnPropertyGridPopupContextMenu(sender, e); if (CurrentGrid.SelectedGridItem.PropertyDescriptor != null) { XmlNode selectedElement = GetSelectedGridObject(); XmlNodeList selectedSubElements = selectedElement.SelectNodes("*", WixFiles.WxsNsmgr); MenuItem menuItemSeparator1 = new IconMenuItem("-"); CurrentGridContextMenu.MenuItems.Add(1, menuItemSeparator1); if (selectedSubElements.Count == 0) { MenuItem subMenuItem = new IconMenuItem("Insert", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp"))); CurrentGridContextMenu.MenuItems.Add(1, subMenuItem); XmlNode definition = WixFiles.GetXsdElementNode("Property"); XmlNodeList subElements = definition.SelectNodes("xs:complexType/xs:sequence/xs:element", WixFiles.XsdNsmgr); foreach (XmlNode sub in subElements) { string subName = sub.Attributes["ref"].Value; MenuItem subSubMenuItem = new IconMenuItem(subName); subSubMenuItem.Click += new EventHandler(OnNewSubPropertyGridItem); subMenuItem.MenuItems.Add(subSubMenuItem); } } else if (selectedSubElements.Count == 1) { MenuItem subMenuItem = new IconMenuItem("Remove " + selectedSubElements[0].Name, new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp"))); CurrentGridContextMenu.MenuItems.Add(1, subMenuItem); subMenuItem.Click += new EventHandler(OnRemoveSubPropertyGridItem); } else { MenuItem subMenuItem = new IconMenuItem("Multiple subitems in property are unsupported!", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp"))); subMenuItem.Enabled = false; CurrentGridContextMenu.MenuItems.Add(1, subMenuItem); } MenuItem menuItemSeparator2 = new IconMenuItem("-"); CurrentGridContextMenu.MenuItems.Add(1, menuItemSeparator2); } }
private void SetTreeImageList() { Bitmap theBmp = new Bitmap(WixFiles.GetResourceStream("directory.drive.bmp")); theBmp.MakeTransparent(); _imageList.Images.Add(theBmp); theBmp = new Bitmap(WixFiles.GetResourceStream("directory.closed.bmp")); theBmp.MakeTransparent(); _imageList.Images.Add(theBmp); theBmp = new Bitmap(WixFiles.GetResourceStream("directory.open.bmp")); theBmp.MakeTransparent(); _imageList.Images.Add(theBmp); }
protected void LaunchFile(string filename, int anchorNumber, int numberOfAnchors, int lineNumber, string message) { try { XslCompiledTransform transform = new XslCompiledTransform(); using (Stream strm = WixFiles.GetResourceStream("viewWixXml.xsl")) { XmlTextReader xr = new XmlTextReader(strm); transform.Load(xr, null, null); } string outputFile = Path.Combine(Path.GetTempPath(), Path.GetFileName(filename)) + ".html"; if ( (File.Exists(outputFile) && (File.GetLastWriteTimeUtc(outputFile).CompareTo(File.GetLastWriteTimeUtc(filename)) > 0) && (File.GetLastWriteTimeUtc(outputFile).CompareTo(File.GetLastWriteTimeUtc(Assembly.GetExecutingAssembly().Location)) > 0)) == false ) { File.Delete(outputFile); transform.Transform(filename, outputFile); } if (xmlDisplayForm.Visible == false) { xmlDisplayForm = new XmlDisplayForm(); } StringBuilder anchorBuilder = new StringBuilder(); for (int i = 0; i < numberOfAnchors; i++) { anchorBuilder.AppendFormat("{0},", anchorNumber + i); } anchorBuilder.Remove(anchorBuilder.Length - 1, 1); xmlDisplayForm.Text = String.Format("{0}({1}) {2}", Path.GetFileName(filename), lineNumber, message); xmlDisplayForm.ShowFile(String.Format("{0}?{1}#a{1}", outputFile, anchorBuilder.ToString())); xmlDisplayForm.Show(); xmlDisplayForm.Activate(); } catch (XmlException ex) { // Invalid XML MessageBox.Show("Failed to show XML, is it a valid XML file?\r\n\r\nMessage:\r\n" + ex.Message, "Failed to load XML", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Initialize(string title, string description) { this.BackColor = Color.White; picture = new PictureBox(); picture.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom; picture.Height = this.Height; picture.Left = 0; picture.Width = 164; picture.Image = new Bitmap(WixFiles.GetResourceStream("dlgbmp.bmp")); picture.SizeMode = PictureBoxSizeMode.StretchImage; this.Controls.Add(picture); titleLabel = new Label(); titleLabel.Text = title; titleLabel.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; titleLabel.Height = 50; titleLabel.Width = this.Width - picture.Width; titleLabel.Top = 0; titleLabel.Left = picture.Width; titleLabel.Padding = new Padding(7, 12, 0, 0); titleLabel.Font = new Font("Verdana", 13, FontStyle.Bold, GraphicsUnit.Point ); titleLabel.BackColor = Color.White; this.Controls.Add(titleLabel); descriptionLabel = new Label(); descriptionLabel.Text = description; descriptionLabel.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; descriptionLabel.Width = this.Width - picture.Width; descriptionLabel.Left = picture.Width; descriptionLabel.Height = this.Height - titleLabel.Height; descriptionLabel.Top = titleLabel.Height; descriptionLabel.Padding = new Padding(7, 15, 5, 5); this.Controls.Add(descriptionLabel); }
//I am not sure if we should impelement Import function in this panel. //if yes it should be implemented either new function. protected override void PopupPanelContextMenu(System.Object sender, System.EventArgs e) { //clear menu and add import menu base.PopupPanelContextMenu(sender, e); if (currTreeView.Nodes.Count == 0) { //add custom menu, index has to be used!!! IconMenuItem subMenuItem = new IconMenuItem("New", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp"))); IconMenuItem subSubMenuItem1 = new IconMenuItem("Product"); IconMenuItem subSubMenuItem2 = new IconMenuItem("Module"); subSubMenuItem1.Click += new EventHandler(NewCustomElement_Click); subSubMenuItem2.Click += new EventHandler(NewCustomElement_Click); subMenuItem.MenuItems.Add(subSubMenuItem1); subMenuItem.MenuItems.Add(subSubMenuItem2); PanelContextMenu.MenuItems.Add(0, subMenuItem); } }
protected override void PopupPanelContextMenu(System.Object sender, System.EventArgs e) { //clear menu and add import menu base.PopupPanelContextMenu(sender, e); //add custom menu, index has to be used!!! IconMenuItem subMenuItem = new IconMenuItem("New", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp"))); MenuItem subSubMenuItem1 = new MenuItem("InstallExecuteSequence"); MenuItem subSubMenuItem2 = new MenuItem("AdminExecuteSequence"); MenuItem subSubMenuItem3 = new MenuItem("AdvertiseExecuteSequence"); subSubMenuItem1.Click += new EventHandler(NewCustomElement_Click); subSubMenuItem2.Click += new EventHandler(NewCustomElement_Click); subSubMenuItem3.Click += new EventHandler(NewCustomElement_Click); subMenuItem.MenuItems.Add(subSubMenuItem1); subMenuItem.MenuItems.Add(subSubMenuItem2); subMenuItem.MenuItems.Add(subSubMenuItem3); PanelContextMenu.MenuItems.Add(0, subMenuItem); }
public void OnPropertyGridPopupContextMenu(object sender, EventArgs e) { elementPropertyGridContextMenu.MenuItems.Clear(); if (elementPropertyGrid.SelectedObject == null) { return; } XmlAttributeAdapter attAdapter = (XmlAttributeAdapter)elementPropertyGrid.SelectedObject; if (attAdapter.XmlNodeDefinition == null) { // Don't know, but can not show the context menu. return; } // Need to change "Delete" to "Clear" for required items. bool isRequired = false; // Get the XmlAttribute from the PropertyDescriptor XmlAttributePropertyDescriptor desc = elementPropertyGrid.SelectedGridItem.PropertyDescriptor as XmlAttributePropertyDescriptor; if (desc != null) { XmlAttribute att = desc.Attribute; XmlNode xmlAttributeDefinition = attAdapter.XmlNodeDefinition.SelectSingleNode(String.Format("xs:attribute[@name='{0}']", att.Name), wixFiles.XsdNsmgr); if (xmlAttributeDefinition.Attributes["use"] != null && xmlAttributeDefinition.Attributes["use"].Value == "required") { isRequired = true; } } MenuItem menuItemSeparator = new IconMenuItem("-"); // See if new menu item should be shown. bool canCreateNew = false; XmlNodeList xmlAttributes = attAdapter.XmlNodeDefinition.SelectNodes("xs:attribute", wixFiles.XsdNsmgr); foreach (XmlNode at in xmlAttributes) { string attName = at.Attributes["name"].Value; if (attAdapter.XmlNode.Attributes[attName] == null) { canCreateNew = true; } } if (canCreateNew) { // Define the MenuItem objects to display for the TextBox. MenuItem menuItem1 = new IconMenuItem("&New", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp"))); menuItem1.Click += new EventHandler(OnNewPropertyGridItem); elementPropertyGridContextMenu.MenuItems.Add(menuItem1); } // Add the clear or delete menu item MenuItem menuItem2 = null; if (elementPropertyGrid.SelectedGridItem.PropertyDescriptor != null && !(elementPropertyGrid.SelectedGridItem.PropertyDescriptor is InnerTextPropertyDescriptor)) { if (isRequired) { menuItem2 = new IconMenuItem("&Clear", new Bitmap(WixFiles.GetResourceStream("bmp.clear.bmp"))); } else { menuItem2 = new IconMenuItem("&Delete", new Bitmap(WixFiles.GetResourceStream("bmp.delete.bmp"))); } menuItem2.Click += new EventHandler(OnDeletePropertyGridItem); elementPropertyGridContextMenu.MenuItems.Add(menuItem2); } if (elementPropertyGridContextMenu.MenuItems.Count > 0) { elementPropertyGridContextMenu.MenuItems.Add(menuItemSeparator); } MenuItem menuItem3 = new IconMenuItem("Description"); menuItem3.Click += new EventHandler(OnToggleDescriptionPropertyGrid); menuItem3.Checked = elementPropertyGrid.HelpVisible; elementPropertyGridContextMenu.MenuItems.Add(menuItem3); }
public FileSheet(WizardForm creator) : base(creator) { this.AutoScroll = true; titleLabel = new Label(); titleLabel.Text = "Add files and folders to install."; titleLabel.Dock = DockStyle.Top; titleLabel.Height = 20; titleLabel.Left = 0; titleLabel.Top = 0; titleLabel.Padding = new Padding(5, 5, 5, 0); titleLabel.Font = new Font("Verdana", 10, FontStyle.Bold, GraphicsUnit.Point ); titleLabel.BackColor = Color.White; descriptionLabel = new Label(); descriptionLabel.Text = "Select Files and Directories you want to add to the installer"; descriptionLabel.Dock = DockStyle.Top; descriptionLabel.Height = 50 - titleLabel.Height; descriptionLabel.Left = 0; descriptionLabel.Top = titleLabel.Height; descriptionLabel.Padding = new Padding(8, 3, 5, 0); descriptionLabel.BackColor = Color.White; this.Controls.Add(descriptionLabel); this.Controls.Add(titleLabel); lineLabel = new Label(); lineLabel.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; lineLabel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; lineLabel.Location = new Point(0, titleLabel.Height + descriptionLabel.Height); lineLabel.Size = new Size(this.Width, 2); this.Controls.Add(lineLabel); tree = new TreeView(); tree.HideSelection = false; tree.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; tree.Location = new Point(4, titleLabel.Height + descriptionLabel.Height + lineLabel.Height + 5); tree.Width = this.Width - 8 - 100 - 8; tree.Height = this.Height - tree.Top - 7; tree.ImageList = ImageListFactory.GetImageList(); tree.MouseDown += new MouseEventHandler(tree_MouseDown); this.Controls.Add(tree); newFolderButton = new Button(); newFolderButton.Anchor = AnchorStyles.Top | AnchorStyles.Right; newFolderButton.Location = new Point(tree.Location.X + tree.Width + 8, tree.Top); newFolderButton.Width = 100; newFolderButton.Height = 23; newFolderButton.Text = "New folder"; newFolderButton.Click += new EventHandler(newFolderButton_Click); this.Controls.Add(newFolderButton); removeButton = new Button(); removeButton.Anchor = AnchorStyles.Top | AnchorStyles.Right; removeButton.Location = new Point(tree.Location.X + tree.Width + 8, newFolderButton.Bottom + 8); removeButton.Width = 100; removeButton.Height = 23; removeButton.Text = "Remove folder"; removeButton.Click += new EventHandler(removeButton_Click); this.Controls.Add(removeButton); importDirectoryButton = new Button(); importDirectoryButton.Anchor = AnchorStyles.Top | AnchorStyles.Right; importDirectoryButton.Location = new Point(tree.Location.X + tree.Width + 8, removeButton.Bottom + 8); importDirectoryButton.Width = 100; importDirectoryButton.Height = 23; importDirectoryButton.Text = "Import directory"; importDirectoryButton.Click += new EventHandler(importDirectoryButton_Click); this.Controls.Add(importDirectoryButton); importFilesButton = new Button(); importFilesButton.Anchor = AnchorStyles.Top | AnchorStyles.Right; importFilesButton.Location = new Point(tree.Location.X + tree.Width + 8, importDirectoryButton.Bottom + 8); importFilesButton.Width = 100; importFilesButton.Height = 23; importFilesButton.Text = "Import files"; importFilesButton.Click += new EventHandler(importFilesButton_Click); this.Controls.Add(importFilesButton); contextMenu = new ContextMenu(); contextMenu.Popup += new EventHandler(contextMenu_Popup); // tree.ContextMenu = contextMenu; importFilesMenuItem = new IconMenuItem("&Import Files", new Bitmap(WixFiles.GetResourceStream("bmp.import.bmp"))); importFilesMenuItem.Click += new System.EventHandler(importFilesMenuItem_Click); contextMenu.MenuItems.Add(importFilesMenuItem); newFolderMenuItem = new IconMenuItem("&New Folder", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp"))); newFolderMenuItem.Click += new System.EventHandler(newFolderMenuItem_Click); contextMenu.MenuItems.Add(newFolderMenuItem); importFolderMenuItem = new IconMenuItem("&Import Folder", new Bitmap(WixFiles.GetResourceStream("bmp.import.bmp"))); importFolderMenuItem.Click += new System.EventHandler(importFolderMenuItem_Click); contextMenu.MenuItems.Add(importFolderMenuItem); newSpecialFolderMenuItem = new IconMenuItem("New Special Folder", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp"))); foreach (string specialFolder in specialFolders) { IconMenuItem subItem = new IconMenuItem(specialFolder); subItem.Click += new EventHandler(specialFolderSubItem_Click); newSpecialFolderMenuItem.MenuItems.Add(subItem); } contextMenu.MenuItems.Add(newSpecialFolderMenuItem); newComponentMenuItem = new IconMenuItem("New Component", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp"))); newComponentMenuItem.Click += new EventHandler(newComponentMenuItem_Click); contextMenu.MenuItems.Add(newComponentMenuItem); deleteMenuItem = new IconMenuItem("&Delete", new Bitmap(WixFiles.GetResourceStream("bmp.delete.bmp"))); deleteMenuItem.Click += new EventHandler(deleteMenuItem_Click); contextMenu.MenuItems.Add(deleteMenuItem); XmlDocument wxsDoc = Wizard.WixFiles.WxsDocument; XmlNamespaceManager wxsNsmgr = Wizard.WixFiles.WxsNsmgr; XmlNodeList dirNodes = wxsDoc.SelectNodes("/wix:Wix/*/wix:Directory", wxsNsmgr); TreeNodeCollection treeNodes = tree.Nodes; InitTreeView(dirNodes); }
private void InitializeComponent() { Text = "WiX Edit Settings"; Icon = new Icon(WixFiles.GetResourceStream("dialog.source.ico")); ClientSize = new System.Drawing.Size(500, 450); StartPosition = FormStartPosition.CenterParent; FormBorderStyle = FormBorderStyle.Sizable; MinimizeBox = false; MaximizeBox = false; ShowInTaskbar = false; SizeGripStyle = SizeGripStyle.Hide; propertyGrid = new CustomPropertyGrid(); propertyGridContextMenu = new ContextMenu(); // // propertyGrid // propertyGrid.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; propertyGrid.Font = new Font("Tahoma", 8.25F, FontStyle.Regular, GraphicsUnit.Point, ((System.Byte)(0))); propertyGrid.Location = new Point(0, 0); propertyGrid.Name = "propertyGrid"; propertyGrid.TabIndex = 1; propertyGrid.PropertySort = PropertySort.CategorizedAlphabetical; propertyGrid.ToolbarVisible = false; propertyGrid.HelpVisible = true; propertyGrid.ContextMenu = propertyGridContextMenu; // // propertyGridContextMenu // propertyGridContextMenu.Popup += new EventHandler(OnPropertyGridPopupContextMenu); propertyGrid.SelectedObject = WixEditSettings.Instance; Controls.Add(propertyGrid); ok = new Button(); ok.Text = "OK"; ok.FlatStyle = FlatStyle.System; ok.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; Controls.Add(ok); ok.Click += new EventHandler(OnOk); cancel = new Button(); cancel.Text = "Cancel"; cancel.FlatStyle = FlatStyle.System; cancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; Controls.Add(cancel); cancel.Click += new EventHandler(OnCancel); AcceptButton = ok; CancelButton = cancel; int padding = 2; int w = (ClientSize.Width - cancel.ClientSize.Width) - padding; int h = (ClientSize.Height - cancel.ClientSize.Height) - padding; cancel.Location = new Point(w, h); w -= ok.ClientSize.Width + padding; ok.Location = new Point(w, h); h -= ok.ClientSize.Height + padding; propertyGrid.Size = new Size(ClientSize.Width, ClientSize.Height - (padding * 2) - ok.ClientSize.Height); }
public DesignerForm GenerateDialog(XmlNode dialog, Control parent) { DesignerForm newDialog = new DesignerForm(wixFiles, dialog); parentHwnd = (int)parent.Handle; newDialog.Font = new Font("Tahoma", (float)(scale * 8.00F), FontStyle.Regular, GraphicsUnit.Point, ((System.Byte)(0))); newDialog.ShowInTaskbar = true; // newDialog.TopMost = true; // newDialog.Opacity = 0.75; newDialog.Icon = new Icon(WixFiles.GetResourceStream("dialog.msi.ico")); newDialog.StartPosition = FormStartPosition.Manual; newDialog.MinimizeBox = false; newDialog.MaximizeBox = false; newDialog.FormBorderStyle = FormBorderStyle.FixedDialog; if (dialog.Attributes["Width"] == null || dialog.Attributes["Width"].Value.Trim().Length == 0 || dialog.Attributes["Height"] == null || dialog.Attributes["Height"].Value.Trim().Length == 0) { return(null); } newDialog.ClientSize = new Size(DialogUnitsToPixelsWidth(XmlConvert.ToInt32(dialog.Attributes["Width"].Value.Trim())), DialogUnitsToPixelsHeight(XmlConvert.ToInt32(dialog.Attributes["Height"].Value.Trim()))); // Background Images should be added first, these controls should be used as parent // to get correct transparancy. For now only 1 bitmap is supported per Dialog. // - Is this the correct way to handle the transparancy? // - How does MSI handle transparant labels when having 2 bitmaps as background? XmlNodeList buttons = dialog.SelectNodes("wix:Control[@Type='PushButton']", wixFiles.WxsNsmgr); AddButtons(newDialog, buttons); XmlNodeList edits = dialog.SelectNodes("wix:Control[@Type='Edit']", wixFiles.WxsNsmgr); AddEditBoxes(newDialog, edits); XmlNodeList checks = dialog.SelectNodes("wix:Control[@Type='CheckBox']", wixFiles.WxsNsmgr); AddCheckBoxes(newDialog, checks); XmlNodeList pathEdits = dialog.SelectNodes("wix:Control[@Type='PathEdit']", wixFiles.WxsNsmgr); AddPathEditBoxes(newDialog, pathEdits); XmlNodeList lines = dialog.SelectNodes("wix:Control[@Type='Line']", wixFiles.WxsNsmgr); AddLines(newDialog, lines); XmlNodeList texts = dialog.SelectNodes("wix:Control[@Type='Text']", wixFiles.WxsNsmgr); AddTexts(newDialog, texts); XmlNodeList rtfTexts = dialog.SelectNodes("wix:Control[@Type='ScrollableText']", wixFiles.WxsNsmgr); AddRftTextBoxes(newDialog, rtfTexts); XmlNodeList groupBoxes = dialog.SelectNodes("wix:Control[@Type='GroupBox']", wixFiles.WxsNsmgr); AddGroupBoxes(newDialog, groupBoxes); XmlNodeList icons = dialog.SelectNodes("wix:Control[@Type='Icon']", wixFiles.WxsNsmgr); AddIcons(newDialog, icons); XmlNodeList listBoxes = dialog.SelectNodes("wix:Control[@Type='ListBox']", wixFiles.WxsNsmgr); AddListBoxes(newDialog, listBoxes); XmlNodeList comboBoxes = dialog.SelectNodes("wix:Control[@Type='ComboBox']", wixFiles.WxsNsmgr); AddComboBoxes(newDialog, comboBoxes); XmlNodeList progressBars = dialog.SelectNodes("wix:Control[@Type='ProgressBar']", wixFiles.WxsNsmgr); AddProgressBars(newDialog, progressBars); XmlNodeList radioButtonGroups = dialog.SelectNodes("wix:Control[@Type='RadioButtonGroup']", wixFiles.WxsNsmgr); AddRadioButtonGroups(newDialog, radioButtonGroups); XmlNodeList maskedEdits = dialog.SelectNodes("wix:Control[@Type='MaskedEdit']", wixFiles.WxsNsmgr); AddMaskedEdits(newDialog, maskedEdits); XmlNodeList volumeCostLists = dialog.SelectNodes("wix:Control[@Type='VolumeCostList']", wixFiles.WxsNsmgr); AddVolumeCostLists(newDialog, volumeCostLists); XmlNodeList volumeComboBoxes = dialog.SelectNodes("wix:Control[@Type='VolumeSelectCombo']", wixFiles.WxsNsmgr); AddVolumeComboBoxes(newDialog, volumeComboBoxes); // Skipping tooltips /* * XmlNodeList tooltips = dialog.SelectNodes("wix:Control[@Type='Tooltips']", wixFiles.WxsNsmgr); * AddTooltips(newDialog, tooltips); */ XmlNodeList directoryCombos = dialog.SelectNodes("wix:Control[@Type='DirectoryCombo']", wixFiles.WxsNsmgr); AddDirectoryCombos(newDialog, directoryCombos); XmlNodeList directoryLists = dialog.SelectNodes("wix:Control[@Type='DirectoryList']", wixFiles.WxsNsmgr); AddDirectoryLists(newDialog, directoryLists); XmlNodeList selectionTrees = dialog.SelectNodes("wix:Control[@Type='SelectionTree']", wixFiles.WxsNsmgr); AddSelectionTrees(newDialog, selectionTrees); XmlNodeList bitmaps = dialog.SelectNodes("wix:Control[@Type='Bitmap']", wixFiles.WxsNsmgr); AddBackgroundBitmaps(newDialog, bitmaps); if (dialog.Attributes["Title"] != null) { newDialog.Text = ExpandWixProperties(dialog.Attributes["Title"].Value); } if (dialog.Attributes["NoMinimize"] == null) { newDialog.MinimizeBox = true; } else { newDialog.MinimizeBox = (dialog.Attributes["NoMinimize"].Value.ToLower() != "yes"); } return(newDialog); }
private void InitializeComponent() { Text = "Error"; okButton = new System.Windows.Forms.Button(); cancelButton = new System.Windows.Forms.Button(); detailsButton = new System.Windows.Forms.Button(); pictureBox = new System.Windows.Forms.PictureBox(); errorLabel = new System.Windows.Forms.Label(); errorMessageLabel = new System.Windows.Forms.Label(); SuspendLayout(); // // okButton // okButton.FlatStyle = System.Windows.Forms.FlatStyle.System; okButton.Location = new System.Drawing.Point(160, 100); okButton.Name = "okButton"; okButton.TabIndex = 0; okButton.Text = "OK"; okButton.Click += new EventHandler(okButton_Click); AcceptButton = okButton; // // cancelButton // cancelButton.FlatStyle = System.Windows.Forms.FlatStyle.System; cancelButton.Location = new System.Drawing.Point(240, 100); cancelButton.Name = "cancelButton"; cancelButton.TabIndex = 1; cancelButton.Text = "Cancel"; CancelButton = cancelButton; // // detailsButton // detailsButton.FlatStyle = System.Windows.Forms.FlatStyle.System; detailsButton.Location = new System.Drawing.Point(320, 100); detailsButton.Name = "detailsButton"; detailsButton.TabIndex = 2; detailsButton.Text = "Details"; detailsButton.Click += new EventHandler(detailsButton_Click); // // pictureBox // pictureBox.Location = new System.Drawing.Point(11, 11); pictureBox.Name = "pictureBox"; pictureBox.Size = new System.Drawing.Size(40, 40); pictureBox.TabIndex = 3; pictureBox.TabStop = false; Bitmap errorImage = new Bitmap(WixFiles.GetResourceStream("error.png")); errorImage.MakeTransparent(); pictureBox.Image = errorImage; // // errorLabel // errorLabel.Location = new System.Drawing.Point(64, 20); errorLabel.Name = "errorLabel"; errorLabel.Size = new System.Drawing.Size(456, 40); errorLabel.TabIndex = 4; errorLabel.Text = message; // // errorLabel // errorMessageLabel.Location = new System.Drawing.Point(64, 60); errorMessageLabel.Name = "errorMessageLabel"; errorMessageLabel.Size = new System.Drawing.Size(456, 40); errorMessageLabel.TabIndex = 4; errorMessageLabel.Text = "Error message: " + exception.Message; // // ExceptionForm // AutoScaleBaseSize = new System.Drawing.Size(5, 13); ClientSize = new System.Drawing.Size(545, 134); Controls.Add(errorLabel); Controls.Add(errorMessageLabel); Controls.Add(pictureBox); Controls.Add(detailsButton); Controls.Add(cancelButton); Controls.Add(okButton); FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; MaximizeBox = false; MinimizeBox = false; Name = "ExceptionForm"; ShowInTaskbar = false; ResumeLayout(false); okButton.Focus(); CenterToScreen(); }
private void InitializeComponent(Panel[] panels) { TabStop = true; int buttonWidth = 11; int buttonHeigth = 11; int paddingX = 2; int paddingY = 2; closeButton = new Button(); outputLabel = new Label(); tabControl = new CustomTabControl(); closeButton.Size = new Size(buttonWidth, buttonHeigth); closeButton.Anchor = AnchorStyles.Top | AnchorStyles.Right; closeButton.Location = new Point(ClientSize.Width - buttonWidth - 2 * paddingX, paddingY); closeButton.BackColor = Color.Transparent; closeButton.Click += new EventHandler(OnCloseClick); outputLabel.Text = "Results Panel"; outputLabel.Font = new Font("Tahoma", 8.25F, FontStyle.Bold, GraphicsUnit.Point, ((System.Byte)(0)));; outputLabel.BorderStyle = BorderStyle.FixedSingle; Bitmap bmp = new Bitmap(WixFiles.GetResourceStream("close_8x8.bmp")); bmp.MakeTransparent(); closeButton.Image = bmp; closeButton.FlatStyle = FlatStyle.Flat; tabControl.Alignment = TabAlignment.Bottom; tabControl.Dock = DockStyle.Fill; tabControl.Location = new Point(0, buttonHeigth + 3 * paddingY); tabControl.Size = new Size(200, ClientSize.Height - tabControl.Location.Y); tabControl.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; TabPage page = null; foreach (Panel panel in panels) { page = new TabPage(panel.Text); page.Controls.Add(panel); panel.Dock = DockStyle.Fill; tabControl.TabPages.Add(page); } outputLabel.Size = new Size(ClientSize.Width - 2 * paddingX, buttonHeigth + (2 * paddingY)); outputLabel.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; outputLabel.Location = new Point(paddingX, 0); outputLabel.BackColor = Color.Gray; outputLabel.ForeColor = Color.LightGray; Controls.Add(closeButton); Controls.Add(outputLabel); Controls.Add(tabControl); closeButton.TabStop = true; outputLabel.TabStop = true; closeButton.LostFocus += new EventHandler(HasFocus); outputLabel.LostFocus += new EventHandler(HasFocus); closeButton.GotFocus += new EventHandler(HasFocus); outputLabel.GotFocus += new EventHandler(HasFocus); closeButton.Enter += new EventHandler(HasFocus); outputLabel.Enter += new EventHandler(HasFocus); closeButton.Click += new EventHandler(HasFocus); outputLabel.Click += new EventHandler(HasFocus); }
protected override void AddCustomTreeViewContextMenuItems(XmlNode node, ContextMenu treeViewContextMenu) { if (node.Name == "Component") { IconMenuItem importFilesMenu = new IconMenuItem("&Import Files", new Bitmap(WixFiles.GetResourceStream("bmp.import.bmp"))); importFilesMenu.Click += new System.EventHandler(ImportFiles_Click); treeViewContextMenu.MenuItems.Add(1, importFilesMenu); } else if (node.Name == "Directory") { IconMenuItem importFolderMenu = new IconMenuItem("&Import Folder", new Bitmap(WixFiles.GetResourceStream("bmp.import.bmp"))); importFolderMenu.Click += new System.EventHandler(ImportFolder_Click); treeViewContextMenu.MenuItems.Add(1, importFolderMenu); } }
private void InitializeComponent() { int padding = 4; int indent = 16; ClientSize = new Size(400, 200); Text = "Edit Settings"; Icon = new Icon(WixFiles.GetResourceStream("dialog.source.ico")); StartPosition = FormStartPosition.CenterParent; FormBorderStyle = FormBorderStyle.FixedDialog; MinimizeBox = false; MaximizeBox = false; ShowInTaskbar = false; SizeGripStyle = SizeGripStyle.Hide; bool hasCandleArgs = (wixFiles.ProjectSettings.CandleArgs != null && wixFiles.ProjectSettings.CandleArgs.Length > 0); bool hasLightArgs = (wixFiles.ProjectSettings.LightArgs != null && wixFiles.ProjectSettings.LightArgs.Length > 0); candleArgsCheck = new CheckBox(); candleArgs = new TextBox(); lightArgsCheck = new CheckBox(); lightArgs = new TextBox(); cancelButton = new Button(); okButton = new Button(); candleArgsCheck.Text = "Use custom commandline for Candle.exe"; candleArgsCheck.CheckedChanged += new EventHandler(candleArgsCheck_CheckedChanged); candleArgsCheck.Checked = hasCandleArgs; candleArgsCheck.Size = new Size(ClientSize.Width - padding * 2, 27); candleArgsCheck.Location = new Point(padding, 0); Controls.Add(candleArgsCheck); if (hasCandleArgs) { candleArgs.Text = wixFiles.ProjectSettings.CandleArgs; } else { candleArgs.Text = wixFiles.ProjectSettings.DefaultCandleArgs; candleArgs.Enabled = false; } candleArgs.Size = new Size(ClientSize.Width - indent - padding * 2, 27); candleArgs.Location = new Point(padding + indent, candleArgsCheck.Bottom); Controls.Add(candleArgs); lightArgsCheck.Checked = hasLightArgs; lightArgsCheck.Text = "Use custom commandline for Light.exe"; lightArgsCheck.CheckedChanged += new EventHandler(lightArgsCheck_CheckedChanged); lightArgsCheck.Size = new Size(ClientSize.Width - padding * 2, 27); lightArgsCheck.Location = new Point(padding, candleArgs.Bottom); Controls.Add(lightArgsCheck); if (hasLightArgs) { lightArgs.Text = wixFiles.ProjectSettings.LightArgs; } else { lightArgs.Text = wixFiles.ProjectSettings.DefaultLightArgs; lightArgs.Enabled = false; } lightArgs.Size = new Size(ClientSize.Width - indent - padding * 2, 27); lightArgs.Location = new Point(padding + indent, lightArgsCheck.Bottom); Controls.Add(lightArgs); cancelButton.Text = "Cancel"; cancelButton.Location = new Point(ClientSize.Width - cancelButton.Width - padding, lightArgs.Bottom + padding); cancelButton.FlatStyle = FlatStyle.System; Controls.Add(cancelButton); CancelButton = cancelButton; okButton.Text = "OK"; okButton.Location = new Point(ClientSize.Width - cancelButton.Width - padding - okButton.Width - padding, lightArgs.Bottom + padding); okButton.FlatStyle = FlatStyle.System; okButton.Click += new EventHandler(okButton_Click); Controls.Add(okButton); AcceptButton = okButton; ClientSize = new Size(ClientSize.Width, okButton.Bottom + padding); }
private void Initialize() { Font = new Font("Tahoma", 8.25F, FontStyle.Regular, GraphicsUnit.Point, ((Byte)(0))); StartPosition = FormStartPosition.CenterParent; FormBorderStyle = FormBorderStyle.None; ShowInTaskbar = false; Width = 320; Height = 160; backgroundImage = Image.FromStream(WixFiles.GetResourceStream("About.png")); int labelHeight = 16; versionLabel = new Label(); versionLabel.Text = String.Format(versionFormatString, Assembly.GetExecutingAssembly().GetName().Version.ToString()); versionLabel.Left = 70; versionLabel.Top = 86; versionLabel.Width = 300; versionLabel.Height = labelHeight; versionLabel.BackColor = Color.Transparent; versionLabel.Click += new EventHandler(OnClose); Controls.Add(versionLabel); copyrightLabel = new Label(); copyrightLabel.Text = copyright; copyrightLabel.Left = 70; copyrightLabel.Top = versionLabel.Top + versionLabel.Height; copyrightLabel.Width = 300; copyrightLabel.Height = labelHeight; copyrightLabel.BackColor = Color.Transparent; copyrightLabel.Click += new EventHandler(OnClose); Controls.Add(copyrightLabel); urlLabel = new LinkLabel(); urlLabel.Text = url; urlLabel.Left = 70; urlLabel.Top = copyrightLabel.Top + copyrightLabel.Height; urlLabel.Width = 160; urlLabel.Height = labelHeight; urlLabel.BackColor = Color.Transparent; urlLabel.Links.Add(0, url.Length, url); urlLabel.LinkClicked += new LinkLabelLinkClickedEventHandler(OnUrlClicked); Controls.Add(urlLabel); Click += new EventHandler(OnClose); // Make the background color of form display transparently. // The image with the semi transparant stuff, will use this color (glow-like) if (useRealTransparency) { BackColor = realTransparencyColor; TransparencyKey = BackColor; } }
protected void PopupTreeViewContextMenu(System.Object sender, System.EventArgs e) { currTreeViewContextMenu.MenuItems.Clear(); if (currTreeView.SelectedNode == null) { return; } XmlNode node = currTreeView.SelectedNode.Tag as XmlNode; if (node == null) { return; } IconMenuItem item1 = new IconMenuItem("&New", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp"))); IconMenuItem item2 = new IconMenuItem("&Delete", new Bitmap(WixFiles.GetResourceStream("bmp.delete.bmp"))); item2.Click += new System.EventHandler(DeleteElement_Click); IconMenuItem item3 = new IconMenuItem("&Info", new Bitmap(WixFiles.GetResourceStream("bmp.info.bmp"))); item3.Click += new System.EventHandler(InfoAboutCurrentElement_Click); ArrayList newElementStrings = WixFiles.GetXsdSubElements(node.Name, SkipElements); bool isExtention = false; foreach (string newElementString in newElementStrings) { if (!isExtention && newElementString.Contains(":")) { item1.MenuItems.Add(new MenuItem("-")); isExtention = true; } MenuItem subMenuItem = new MenuItem(newElementString); subMenuItem.Click += new EventHandler(NewElement_Click); item1.MenuItems.Add(subMenuItem); } if (item1.MenuItems.Count > 0) { currTreeViewContextMenu.MenuItems.Add(item1); } currTreeViewContextMenu.MenuItems.Add(item2); XmlAttributeAdapter attAdapter = (XmlAttributeAdapter)CurrentGrid.SelectedObject; if (attAdapter != null) { XmlDocumentationManager docManager = new XmlDocumentationManager(WixFiles); if (docManager.HasDocumentation(attAdapter.XmlNodeDefinition)) { currTreeViewContextMenu.MenuItems.Add(new IconMenuItem("-")); currTreeViewContextMenu.MenuItems.Add(item3); } } AddCustomTreeViewContextMenuItems(node, currTreeViewContextMenu); }