/// <summary> /// The <see cref="Control.Click"/> event handler for the /// <see cref="Button"/> <see cref="btnShapes"/>. /// Shows a <see cref="ShapeDialog"/> to define a shape /// element that is added to all imported slides. /// </summary> /// <param name="sender">Source of the event.</param> /// <param name="e">An empty <see cref="EventArgs"/></param> private void btnShapes_Click(object sender, EventArgs e) { ShapeDialog dlg = new ShapeDialog(); if (dlg.ShowDialog() == DialogResult.OK) { VGElement shape = dlg.NewShape; this.cbbDesignedItem.Items.Add(shape); this.cbbDesignedItem.SelectedItem = shape; } }
/// <summary> /// Creates and displays a <c>FillerEditorDialog</c> dialog if <c>value</c> is a <c>Filler</c>. /// </summary> /// <param name="context">An ITypeDescriptorContext that can be used to gain additional context information.</param> /// <param name="provider">An IServiceProvider through which editing services may be obtained.</param> /// <param name="value">An instance of <c>Filler</c> being edited.</param> /// <returns>The new value of the <c>Filler</c> being edited.</returns> public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value) { if (value is ShapePopulate) { ShapeDialog dialog = new ShapeDialog((ShapePopulate)value); //dialog.Show(); if (dialog.ShowDialog() == DialogResult.OK) { return(dialog.ShapePopulate); } } return(value); }
private static Dictionary <int, SHAPEntry> ReadSHAP(BinaryReaderEx br, bool dsr, Dictionary <int, string> strings, int shprOffset) { ReadSectionHeader(br, "SHAP", out int entrySize, out int entryCount); int startPosition = (int)br.Position; Dictionary <int, SHAPEntry> shapEntries = new Dictionary <int, SHAPEntry>(); for (int i = 0; i < entryCount; i++) { int offset = (int)br.Position - startPosition; int typeOffset = br.ReadInt32(); int shprEntryOffset = br.ReadInt32(); int restorePosition = (int)br.Position; SHAPEntry entry; string type = strings[typeOffset]; br.Position = shprOffset + shprEntryOffset; if (type == "Null") { entry = new ShapeNull(br); } else if (type == "Dialog") { entry = new ShapeDialog(br); } else if (type == "ScrollText") { entry = new ShapeScrollText(br); } else if (type == "Text") { entry = new ShapeText(br); } else if (type == "Sprite") { entry = new ShapeSprite(br, dsr); } else if (type == "MonoRect") { entry = new ShapeMonoRect(br); } else if (type == "GouraudRect") { entry = new ShapeGouraudRect(br); } else if (type == "MonoFrame") { entry = new ShapeMonoFrame(br); } else if (type == "GouraudSprite") { entry = new ShapeGouraudSprite(br); } else if (type == "Mask") { entry = new ShapeMask(br); } else { throw null; } entry.Offset = shprOffset + shprEntryOffset; shapEntries[offset] = entry; br.Position = restorePosition; } br.Pad(0x10); return(shapEntries); }