protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { if (_editor.FlyMode && !_editor.Configuration.UI_Hotkeys["ToggleFlyMode"].Contains(keyData)) { return(base.ProcessCmdKey(ref msg, keyData)); } // Don't process reserved camera keys if (Hotkey.ReservedCameraKeys.Contains(keyData)) { return(base.ProcessCmdKey(ref msg, keyData)); } // Don't process one-key and shift hotkeys if we're focused on control which allows text input if (WinFormsUtils.CurrentControlSupportsInput(this, keyData)) { return(base.ProcessCmdKey(ref msg, keyData)); } CommandHandler.ExecuteHotkey(new CommandArgs { Editor = _editor, KeyData = keyData, Window = this }); // Don't open menus with the alt key if (keyData.HasFlag(Keys.Alt)) { return(true); } return(base.ProcessCmdKey(ref msg, keyData)); }
private void EditAttributeValue() { ListView activeListView = GetActiveListView(); ListViewItem selectedItem = WinFormsUtils.GetSingleSelectedItem(activeListView); if (selectedItem == null) { return; } ObjectAttribute objectAttribute = (ObjectAttribute)selectedItem.Tag; string attributeName = selectedItem.Text; byte[] attributeValue = objectAttribute.GetValueAsByteArray() ?? new byte[0]; using (HexEditor hexEditor = new HexEditor(attributeName, attributeValue)) { if (hexEditor.ShowDialog() == DialogResult.OK) { ObjectAttribute updatedObjectAttribute = new ObjectAttribute(objectAttribute.Type, hexEditor.Bytes); selectedItem.Tag = updatedObjectAttribute; ReloadListView(activeListView); } } }
private void LoadListViewDetails() { ListViewDetails.BeginUpdate(); ListViewDetails.Columns.Clear(); ListViewDetails.Items.Clear(); ListViewDetails.Groups.Clear(); ListViewDetails.AddColumn("Field", EnhancedListView.ColumnType.String, HorizontalAlignment.Left); ListViewDetails.AddColumn("Value", EnhancedListView.ColumnType.String, HorizontalAlignment.Left); List <KeyValuePair <object, string[]> > data = new List <KeyValuePair <object, string[]> >(); data.Add(new KeyValuePair <object, string[]>(null, new string[] { "Issuer", _cert.Issuer })); data.Add(new KeyValuePair <object, string[]>(null, new string[] { "Subject", _cert.Subject })); data.Add(new KeyValuePair <object, string[]>(null, new string[] { "Serial number", _cert.SerialNumber })); data.Add(new KeyValuePair <object, string[]>(null, new string[] { "Invalid before", _cert.NotBefore.ToString("R") })); data.Add(new KeyValuePair <object, string[]>(null, new string[] { "Invalid after", _cert.NotAfter.ToString("R") })); data.Add(new KeyValuePair <object, string[]>(null, new string[] { "Public key type", _cert.PublicKey.Oid.FriendlyName ?? _cert.PublicKey.Oid.Value })); data.Add(new KeyValuePair <object, string[]>(null, new string[] { "Signature algorithm", _cert.SignatureAlgorithm.FriendlyName ?? _cert.SignatureAlgorithm.Value })); data.Add(new KeyValuePair <object, string[]>(null, new string[] { "Thumbprint", _cert.Thumbprint })); WinFormsUtils.AppendToListView(ListViewDetails, null, data); ListViewDetails.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); ListViewDetails.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); ListViewDetails.EndUpdate(); }
private void EditAttributeValue() { ListViewItem selectedItem = WinFormsUtils.GetSingleSelectedItem(ListViewAttributes); if (selectedItem == null) { return; } IObjectAttribute objectAttribute = (IObjectAttribute)selectedItem.Tag; string attributeName = selectedItem.Text; byte[] attributeValue = (objectAttribute.CannotBeRead) ? new byte[0] : objectAttribute.GetValueAsByteArray(); using (HexEditor hexEditor = new HexEditor(attributeName, attributeValue)) { if (hexEditor.ShowDialog() == DialogResult.OK) { AttributeModified = true; IObjectAttribute updatedObjectAttribute = Pkcs11Admin.Instance.Factories.ObjectAttributeFactory.Create(objectAttribute.Type, hexEditor.Bytes); _pkcs11Slot.SaveObjectAttributes(_pkcs11ObjectInfo, new List <IObjectAttribute>() { updatedObjectAttribute }); selectedItem.Tag = updatedObjectAttribute; ReloadListView(); } } }
private async void ButtonGenerate_Click(object sender, EventArgs e) { try { ComboBoxKeyTypeItem selectedKeyTypeItem = GetSelectedComboBoxItem(); if (selectedKeyTypeItem.Kind == ComboBoxKeyTypeItem.Kinds.Asymmetric) { List <ObjectAttribute> privateKeyObjectAttributes = GetObjectAttributesFromListView(ListViewPrivateKeyAttributes); List <ObjectAttribute> publicKeyObjectAttributes = GetObjectAttributesFromListView(ListViewPublicKeyAttributes); await WaitDialog.Execute( this, () => _pkcs11Slot.GenerateAsymmetricKeyPair(selectedKeyTypeItem.KeyType, privateKeyObjectAttributes, publicKeyObjectAttributes) ); } else { List <ObjectAttribute> secretKeyObjectAttributes = GetObjectAttributesFromListView(ListViewSecretKeyAttributes); await WaitDialog.Execute( this, () => _pkcs11Slot.GenerateSymmetricKey(selectedKeyTypeItem.KeyType, secretKeyObjectAttributes) ); } DialogResult = DialogResult.OK; } catch (Exception ex) { WinFormsUtils.ShowError(this, ex); } }
/// <summary> /// Initializes chart data from XML. /// </summary> protected void InitializeXMLData() { //Initializes a new DataSet. DataSet xmlDataSet = new DataSet(); //Loads the dataset with xml data. xmlDataSet.ReadXmlSchema(WinFormsUtils.FindFile(@"..\..\..\..\..\..\Common\Data\Chart", "dataschema.xslt")); xmlDataSet.ReadXml(WinFormsUtils.FindFile(@"..\..\..\..\..\..\Common\Data\Chart", "data.xml")); //Initializes new chart series. ChartSeries series = new ChartSeries(); series.Name = tableName; model = new ChartDataBindModel(xmlDataSet, "Products"); model.XName = "ExpiresDate"; model.YNames = new string[] { "Quantity" }; series.SeriesModel = model; //Adds the series to the ChartSeriesCollection. this.chartControl1.Series.Add(series); //Specifies the value type of the Chart Axis. this.chartControl1.PrimaryXAxis.ValueType = ChartValueType.DateTime; //Specifies the format in which the Date-Time values display. this.chartControl1.PrimaryXAxis.DateTimeFormat = "MM/dd/yy"; //Specifies the mode of displaying the label of the x-axis on intersection. this.chartControl1.PrimaryXAxis.LabelIntersectAction = ChartLabelIntersectAction.MultipleRows; //Specifies the column width mode for the Column Type chart. this.chartControl1.ColumnWidthMode = ChartColumnWidthMode.FixedWidthMode; }
public DrivetrainLayoutForm(RobotDataManager robotDataManager) { this.robotDataManager = robotDataManager; InitializeComponent(); controls.Add(RigidNode_Base.DriveTrainType.TANK, tankOption); controls.Add(RigidNode_Base.DriveTrainType.H_DRIVE, hdriveOption); controls.Add(RigidNode_Base.DriveTrainType.CUSTOM, customOption); foreach (var keyValuePair in controls) { WinFormsUtils.RecursiveControlNavigator(keyValuePair.Value, control => control.MouseDown += (sender, args) => SelectType(keyValuePair.Key)); WinFormsUtils.RecursiveControlNavigator(keyValuePair.Value, control => control.MouseEnter += (sender, args) => { if (driveTrainType != keyValuePair.Key) { keyValuePair.Value.BackColor = HoverColor; } }); WinFormsUtils.RecursiveControlNavigator(keyValuePair.Value, control => control.MouseLeave += (sender, args) => { if (driveTrainType != keyValuePair.Key) { keyValuePair.Value.BackColor = DefaultColor; } }); } SelectType(robotDataManager.RobotBaseNode.driveTrainType); }
private void EditAttributeValue() { ListViewItem selectedItem = WinFormsUtils.GetSingleSelectedItem(ListViewAttributes); if (selectedItem == null) { return; } IObjectAttribute objectAttribute = (IObjectAttribute)selectedItem.Tag; string attributeName = selectedItem.Text; byte[] attributeValue = objectAttribute.GetValueAsByteArray() ?? new byte[0]; using (HexEditor hexEditor = new HexEditor(attributeName, attributeValue)) { if (hexEditor.ShowDialog() == DialogResult.OK) { IObjectAttribute updatedObjectAttribute = Pkcs11Admin.Instance.Factories.ObjectAttributeFactory.Create(objectAttribute.Type, hexEditor.Bytes); selectedItem.Tag = updatedObjectAttribute; ReloadListView(); } } }
public MainForm() { // Make the GUI ignore the DPI setting Font = new Font(Font.Name, 8.25f * 96f / CreateGraphics().DpiX, Font.Style, Font.Unit, Font.GdiCharSet, Font.GdiVerticalFont); InitializeComponent(); WinFormsUtils.SetFixedClientSize(this, 568, 183); this.Text += " " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(3); }
public JointCardUC(RigidNode_Base node, JointEditorForm jointEditorForm, RobotDataManager robotDataManager) { this.robotDataManager = robotDataManager; this.jointEditorForm = jointEditorForm; this.node = node; InitializeComponent(); WinFormsUtils.DisableScrollSelection(this); AddHighlightAction(this); }
private void GenerateKeysDialog_Shown(object sender, EventArgs e) { if (ComboBoxKeyType.Items.Count <= 0) { WinFormsUtils.ShowError(this, "PKCS#11 library does not support generation of the known key types"); DialogResult = DialogResult.Cancel; } else { ComboBoxKeyType.SelectedIndex = 0; } }
private void ButtonOk_Click(object sender, EventArgs e) { try { _slot.Login(_userType, TextBoxPin.Text); DialogResult = DialogResult.OK; } catch (Exception ex) { WinFormsUtils.ShowError(this, ex); } }
private async void ButtonOk_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(TextBoxPkcs11Library.Text)) { WinFormsUtils.ShowError(this, "PKCS#11 library is not specified"); return; } if (CheckBoxEnableLogging.Checked) { if (string.IsNullOrEmpty(TextBoxPkcs11Logger.Text)) { WinFormsUtils.ShowError(this, "PKCS#11 logging library is not specified"); return; } if (string.IsNullOrEmpty(TextBoxLogFile.Text)) { WinFormsUtils.ShowError(this, "Log file is not specified"); return; } if (!Path.IsPathRooted(TextBoxLogFile.Text)) { WinFormsUtils.ShowError(this, "Path to log file is not absolute path"); return; } } try { await WaitDialog.Execute( this, () => Pkcs11Admin.Instance.LoadLibrary( TextBoxPkcs11Library.Text, TextBoxPkcs11Logger.Text, TextBoxLogFile.Text, CheckBoxEnableLogging.Checked, CheckBoxOverwriteLogFile.Checked ) ); DialogResult = DialogResult.OK; Properties.Settings d = Properties.Settings.Default; d.UserPkcs11Library = TextBoxPkcs11Library.Text; d.Save(); } catch (Exception ex) { WinFormsUtils.ShowError(this, ex); } }
private static void TestOpenTextFile() { var fileNames = WinFormsUtils.OpenFiles(requiredFilesCount: 4); if (fileNames != null) { ConsoleUtils.WriteLines(fileNames); } var result = WinFormsUtils.OpenTextFile(); ConsoleUtils.WriteResult("Zawartość otworzonego pliku", result?.Item1); }
private async void ButtonOk_Click(object sender, EventArgs e) { try { await WaitDialog.Execute(this, () => _slot.InitToken(null, TextBoxTokenLabel.Text)); DialogResult = DialogResult.OK; } catch (Exception ex) { WinFormsUtils.ShowError(this, ex); } }
private async void ButtonGenerate_Click(object sender, EventArgs e) { try { if (ListViewSubject.Items.Count < 1) { WinFormsUtils.ShowInfo(null, "Please specify subject first"); return; } DnEntry[] dnEntries = new DnEntry[ListViewSubject.Items.Count]; for (int i = 0; i < ListViewSubject.Items.Count; i++) { dnEntries[i] = (DnEntry)ListViewSubject.Items[i].Tag; } string fileName = null; byte[] fileContent = null; // TODO - Parametrize HashAlgorithm // TODO - Specify SAN await WaitDialog.Execute( this, () => _pkcs11Slot.GenerateCsr(_privKeyInfo, _pubKeyInfo, dnEntries, HashAlgorithm.SHA256, out fileName, out fileContent) ); using (SaveFileDialog saveFileDialog = new SaveFileDialog()) { saveFileDialog.FileName = fileName; saveFileDialog.Filter = "All files (*.*)|*.*|DER encoded certificate signing request (*.csr)|*.csr"; saveFileDialog.FilterIndex = 2; saveFileDialog.AddExtension = true; saveFileDialog.CreatePrompt = false; saveFileDialog.OverwritePrompt = true; if (saveFileDialog.ShowDialog(this) == DialogResult.OK) { File.WriteAllBytes(saveFileDialog.FileName, fileContent); WinFormsUtils.ShowInfo(this, "CSR successfully saved"); DialogResult = DialogResult.OK; } } } catch (Exception ex) { WinFormsUtils.ShowError(this, ex); } }
public HashSet <Room> GetRoomSelection(Panel2DMap parent) { if (_roomSelectionCache == null && _area.Size.Length() > 0.5f) { _roomSelectionCache = new HashSet <Room>( WinFormsUtils.BoolCombine(parent._editor.SelectedRooms, parent._editor.Level.Rooms.Where(room => room != null) .Where(room => parent._depthBar.CheckRoom(room)) .Where(room => room.Position.X + room.NumXSectors > Math.Min(_area.Start.X, _area.End.X) && room.Position.Z + room.NumZSectors > Math.Min(_area.Start.Y, _area.End.Y) && room.Position.X < Math.Max(_area.Start.X, _area.End.X) && room.Position.Z < Math.Max(_area.Start.Y, _area.End.Y)), ModifierKeys)); } return(_roomSelectionCache); }
protected override Control CreateDefaultPaletteControl() { _viewModel = new ActionSequenceViewModel(); var view = new ActionSequenceView() { DataContext = _viewModel }; view.Margin = new Thickness(10); // http://stackoverflow.com/questions/592017/my-images-are-blurry-why-isnt-wpfs-snapstodevicepixels-working view.UseLayoutRounding = true; //for let wpf user control docked fully in the parent winform var formControl = WinFormsUtils.CreateElementHost(view); return(formControl); }
public static RigidNode_Base ExportSkeleton(IProgress <ProgressUpdate> progress) { // If no components if (RobotExporterAddInServer.Instance.OpenAssemblyDocument.ComponentDefinition.Occurrences.OfType <ComponentOccurrence>().ToList().Count == 0) { return(null); } //Getting Rigid Body Info... progress?.Report(new ProgressUpdate("Getting physics info...", 1, 4)); var rigidGetOptions = RobotExporterAddInServer.Instance.Application.TransientObjects.CreateNameValueMap(); rigidGetOptions.Add("DoubleBearing", false); var asmDocument = RobotExporterAddInServer.Instance.OpenAssemblyDocument; var rawRigidResults = asmDocument.ComponentDefinition.RigidBodyAnalysis(rigidGetOptions); var rigidResults = new CustomRigidResults(rawRigidResults); try { RigidBodyCleaner.CleanGroundedBodies(rigidResults); } catch (NoGroundException) { WinFormsUtils.ShowErrorDialog("Please ground a part in your assembly to export your robot.", "No Ground"); return(null); } //Building Model... progress?.Report(new ProgressUpdate("Building model...", 2, 4)); var skeletonBase = RigidBodyCleaner.BuildAndCleanDijkstra(rigidResults); //Cleaning Up... progress?.Report(new ProgressUpdate("Cleaning up...", 3, 4)); var nodes = new List <RigidNode_Base>(); skeletonBase.ListAllNodes(nodes); foreach (var node in nodes) { node.ModelFileName = ((RigidNode)node).group.ToString(); node.ModelFullID = node.GetModelID(); } progress?.Report(new ProgressUpdate("Done", 4, 4)); return(skeletonBase); }
/// <summary> /// Initializes chart data from Excel Sheet. /// </summary> protected void InitializeChartExcelData() { string fileName = WinFormsUtils.FindFile(@"..\..\..\..\..\..\Common\Data\Chart", "ChartData.xls"); //The Oledbconnection. OleDbConnection excelConn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + fileName + ";Extended Properties=\"Excel 8.0;HDR=Yes;\""); excelConn.Open(); //Query for retriving the data from the excel sheet. string query = "Select * From [Sheet1$A1:B11]"; OleDbCommand excelCommand = new OleDbCommand(query, excelConn); OleDbDataReader excelReader = excelCommand.ExecuteReader(CommandBehavior.CloseConnection); //Load the contents to a dataset. DataSet excelDataSet = ConvertToDataSet(excelReader, "ExcelTable"); this.chartControl1.Indexed = true; //Initializes new chart series. ChartSeries series = new ChartSeries(); series.Name = tableName; series.Type = ChartSeriesType.Column; model = new ChartDataBindModel(excelDataSet, "ExcelTable"); model.XName = "X Value"; model.YNames = new string[] { "Y Value" }; series.SeriesModel = model; //Specifies the column width mode for the Column Type chart. this.chartControl1.ColumnWidthMode = ChartColumnWidthMode.FixedWidthMode; //Adds the series to the ChartSeriesCollection. this.chartControl1.Series.Add(series); //Close the connection. excelReader.Close(); excelConn.Close(); this.chartControl1.Text = "Chart Data From Excel"; }
/// <summary> /// Imports chart data from a CSV file. /// </summary> protected void InitializeChartFromCSV() { string fileName = WinFormsUtils.FindFile(@"..\..\..\..\..\..\Common\Data\Chart\", "ChartData.csv"); OleDbConnection csvConn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + ";Extended Properties=\"Text;HDR=Yes;FMT=Delimited\""); csvConn.Open(); //Query for retriving the data from the csv file. string query = "Select * From " + fileName; OleDbCommand csvCommand = new OleDbCommand(query, csvConn); OleDbDataReader csvReader = csvCommand.ExecuteReader(CommandBehavior.CloseConnection); //Load the contents to a dataset. DataSet csvDataSet = ConvertToDataSet(csvReader, "CSVTable"); this.chartControl1.Indexed = true; //Initializes new chart series. ChartSeries series = new ChartSeries(); series.Style.DisplayText = true; series.Style.TextOrientation = ChartTextOrientation.Up; series.Name = tableName; model = new ChartDataBindModel(csvDataSet, "CSVTable"); model.XName = "X Value"; model.YNames = new string[] { "Y Value" }; series.SeriesModel = model; //Adds the series to the ChartSeriesCollection. this.chartControl1.Series.Add(series); ////Specifies the column width mode for the Column Type chart. this.chartControl1.ColumnWidthMode = ChartColumnWidthMode.FixedWidthMode; //Close the connection. csvReader.Close(); csvConn.Close(); }
private void ButtonAsn1_Click(object sender, EventArgs e) { ListViewItem selectedItem = WinFormsUtils.GetSingleSelectedItem(ListViewAttributes); if (selectedItem == null) { return; } ObjectAttribute objectAttribute = (ObjectAttribute)selectedItem.Tag; string attributeName = selectedItem.Text; byte[] attributeValue = (objectAttribute.CannotBeRead) ? new byte[0] : objectAttribute.GetValueAsByteArray(); using (Asn1Viewer asn1Viewer = new Asn1Viewer(attributeName, attributeValue)) asn1Viewer.ShowDialog(); }
protected override void OnMouseDoubleClick(MouseEventArgs e) { base.OnMouseDown(e); Vector2 clickPos = FromVisualCoord(e.Location); switch (e.Button) { case MouseButtons.Left: if (!ModifierKeys.HasFlag(Keys.Shift)) { int?currentProbeIndex = FindClosestProbe(clickPos); if (currentProbeIndex.HasValue) { _depthBar.DepthProbes.RemoveAt(currentProbeIndex.Value); } else { _depthBar.DepthProbes.Add(new DepthBar.DepthProbe(_depthBar) { Position = clickPos }); } Invalidate(); } break; case MouseButtons.Middle: Room clickedRoom = DoPicking(clickPos); Keys modifierKeys = ModifierKeys; if (clickedRoom != null) { IEnumerable <Room> connectedRooms = _editor.Level.GetConnectedRooms(clickedRoom); connectedRooms = WinFormsUtils.BoolCombine(_editor.SelectedRooms, _editor.Level.GetConnectedRooms(clickedRoom), ModifierKeys); connectedRooms = // Don't use the currently clicked room because it was already processed with the previous single click. _editor.SelectedRooms.Where(room => room == clickedRoom || room == clickedRoom.AlternateOpposite) .Concat( connectedRooms.Where(room => room != clickedRoom && room != clickedRoom.AlternateOpposite)); _editor.SelectRoomsAndResetCamera(connectedRooms); } _selectionArea = null; break; } }
private async void ButtonOk_Click(object sender, EventArgs e) { if (TextBoxPin.Text != TextBoxConfirmPin.Text) { WinFormsUtils.ShowInfo(this, "New PIN entries do not match"); return; } try { await WaitDialog.Execute(this, () => _slot.InitToken(TextBoxPin.Text, TextBoxTokenLabel.Text)); DialogResult = DialogResult.OK; } catch (Exception ex) { WinFormsUtils.ShowError(this, ex); } }
private void ButtonSave_Click(object sender, EventArgs e) { using (SaveFileDialog saveFileDialog = new SaveFileDialog()) { saveFileDialog.FileName = TextBoxName.Text; saveFileDialog.Filter = "All files (*.*)|*.*"; saveFileDialog.FilterIndex = 1; saveFileDialog.CreatePrompt = false; saveFileDialog.OverwritePrompt = true; if (saveFileDialog.ShowDialog(this) == DialogResult.OK) { File.WriteAllBytes(saveFileDialog.FileName, Bytes); WinFormsUtils.ShowInfo(this, "Attribute value was successfully saved"); } } }
private void ButtonSave_Click(object sender, EventArgs e) { using (SaveFileDialog saveFileDialog = new SaveFileDialog()) { saveFileDialog.FileName = _name; saveFileDialog.Filter = "All files (*.*)|*.*"; saveFileDialog.FilterIndex = 1; saveFileDialog.CreatePrompt = false; saveFileDialog.OverwritePrompt = true; if (saveFileDialog.ShowDialog(this) == DialogResult.OK) { File.WriteAllBytes(saveFileDialog.FileName, _content); WinFormsUtils.ShowInfo(this, "Data object successfully exported"); } } }
private void ButtonOk_Click(object sender, EventArgs e) { if (TextBoxNewPin.Text != TextBoxConfirmNewPin.Text) { WinFormsUtils.ShowInfo(this, "New PIN entries do not match"); return; } try { _slot.ChangePin(TextBoxCurrentPin.Text, TextBoxNewPin.Text); WinFormsUtils.ShowInfo(this, (_userType == CKU.CKU_SO) ? "SO PIN successfuly changed" : "PIN successfuly changed"); DialogResult = DialogResult.OK; } catch (Exception ex) { WinFormsUtils.ShowError(this, ex); } }
private void ButtonCreate_Click(object sender, EventArgs e) { try { List <ObjectAttribute> objectAttributes = new List <ObjectAttribute>(); foreach (ListViewItem listViewItem in ListViewAttributes.CheckedItems) { objectAttributes.Add((ObjectAttribute)listViewItem.Tag); } _pkcs11Slot.CreateObject(objectAttributes); DialogResult = DialogResult.OK; } catch (Exception ex) { WinFormsUtils.ShowError(this, ex); } }
private void ButtonOk_Click(object sender, EventArgs e) { if (TextBoxNewPin.Text != TextBoxConfirmNewPin.Text) { WinFormsUtils.ShowInfo(this, "New PIN entries do not match"); return; } try { _slot.InitPin(TextBoxNewPin.Text); WinFormsUtils.ShowInfo(this, "User PIN successfuly initialized"); DialogResult = DialogResult.OK; } catch (Exception ex) { WinFormsUtils.ShowError(this, ex); } }
public void CapturingImages() { #region CaptureControlImages // Zachytenie/uloženie obrázku formulára. Form frm = new Form(); Bitmap formImage = frm.CaptureImage(); frm.SaveImage(@"C:\images\formImage.jpg"); // Zachytenie obrázku klientskej časti formulára, tzn. bez hlavičky a orámovania. Bitmap formClientImage = frm.CaptureImage(true); // Zachytenie/uloženie obrázku formulárového prvku. Control ctrl = new Panel(); Bitmap controlImage = ctrl.CaptureImage(); ctrl.SaveImage(@"C:\images\controlImage.jpg"); #endregion #region CaptureScreenImages // Zachytenie/uloženie obrázku primárnej obrazovky. Bitmap primaryScreenImage = WinFormsUtils.CaptureScreenImage(); WinFormsUtils.SaveScreenImage(@"C:\images\primaryScreenImage.jpg"); // Zachytenie/uloženie obrázku konkrétnej obrazovky. Bitmap secondaryScreenImage = WinFormsUtils.CaptureScreenImage(Screen.AllScreens[1]); WinFormsUtils.SaveScreenImage(Screen.AllScreens[1], @"C:\images\secondaryScreenImage.jpg"); // Zachytenie/uloženie obrázkov všetkých obrazoviek naraz. Bitmap[] allScreenImages = WinFormsUtils.CaptureAllScreenImages(); WinFormsUtils.SaveAllScreenImages(@"C:\images\screenImage.jpg"); #endregion }