void btn_MouseDown(object sender, MouseEventArgs e) { if (e.Button == System.Windows.Forms.MouseButtons.Right) { IRgbProcessor p = (sender as Button).Tag as IRgbProcessor; foreach (IRgbProcessorArgEditor editor in _importedArgEditors) { if (editor.IsSupport(p.GetType())) { if (p.Arguments == null) { p.CreateDefaultArguments(); } editor.OnPreviewing += new OnArgEditorPreviewing(RerenderBitmap); editor.OnApplyClicked += new OnArgEditorApplyClick(RerenderBitmap); RgbProcessorArg oldArg = p.Arguments.Clone(); (editor as Form).Text = p.Name + "参数设置..."; editor.Init(this as IRgbArgEditorEnvironmentSupport, p); editor.Show(p.Arguments); //if (editor.ShowDialog(p.Arguments) == System.Windows.Forms.DialogResult.OK) //{ // Invalidate(); //} //else //{ // p.Arguments = oldArg; // Invalidate(); //} } } } }
private void DisplayArgEditor(IRgbProcessor processor, IRasterDrawing drawing, ICanvasViewer viewer) { if (_registeredEditors == null) { _registeredEditors = GetRegisteredEditors(); } if (_registeredEditors == null) { return; } foreach (IRgbProcessorArgEditor editor in _registeredEditors) { if (editor.IsSupport(processor.GetType())) { IRgbProcessorArgEditor argeditor = Activator.CreateInstance(editor.GetType()) as IRgbProcessorArgEditor; if (processor.Arguments == null) { processor.CreateDefaultArguments(); } if (drawing.SelectedBandNos.Length == 1 || drawing.BandCount == 1) { processor.BytesPerPixel = 1; if (argeditor is frmReversalColorEditor) { return; } } else { processor.BytesPerPixel = 3; } argeditor.OnPreviewing += new OnArgEditorPreviewing((senser, arg) => { viewer.Canvas.Refresh(Core.DrawEngine.enumRefreshType.RasterLayer); } ); argeditor.OnApplyClicked += new OnArgEditorApplyClick((senser, arg) => { viewer.Canvas.Refresh(Core.DrawEngine.enumRefreshType.RasterLayer); } ); argeditor.OnCancelClicked += new OnArgEditorCancelClick((senser, arg) => { drawing.RgbProcessorStack.RemoveLast(); viewer.Canvas.Refresh(Core.DrawEngine.enumRefreshType.RasterLayer); }); if (argeditor is Form) { (argeditor as Form).Owner = _smartSession.SmartWindowManager.MainForm as Form; (argeditor as Form).StartPosition = FormStartPosition.Manual; (argeditor as Form).Location = _smartSession.SmartWindowManager.ViewLeftUpperCorner; (argeditor as Form).Text = processor.Name + "参数设置..."; } argeditor.Init(viewer.RgbProcessorArgEditorEnvironment as IRgbArgEditorEnvironmentSupport, processor); argeditor.Show(processor.Arguments); return; } } }