private void PasteToolStripMenuItem_Click(object sender, EventArgs e) { // TODO: Use System.Windows.Forms.Clipboard.GetText() or System.Windows.Forms.GetData to retrieve information from the clipboard. if (IsDiagramaAberto()) { if (frmProj.frmDiagLadder.ControleSelecionado != null) { if (!frmProj.frmDiagLadder.ControleSelecionado.IsDisposed) { DataFormats.Format myFormat = DataFormats.GetFormat("List<SimboloBasico>"); Object returnObject = null; List <SimboloBasico> _lstSB = new List <SimboloBasico>(); ListaSimbolo _lstSB2 = new ListaSimbolo(); IDataObject iData = Clipboard.GetDataObject(); // Determines whether the data is in a format you can use. if (iData.GetDataPresent(myFormat.Name)) { try { returnObject = iData.GetData(myFormat.Name); } catch { MessageBox.Show("Erro"); } } _lstSB = (List <SimboloBasico>)returnObject; _lstSB2.InsertAllWithClearBefore(_lstSB); ControleLivre _controle = frmProj.frmDiagLadder.LinhaSelecionada.InsereSimboloIndefinido(true, frmProj.frmDiagLadder.ControleSelecionado, _lstSB2); frmProj.frmDiagLadder.ReorganizandoLinhas(); _controle.Select(); } } } }
public ControleLivre InsereSimbolo(bool _bApos, LocalInsereSimbolo _lIS, ControleLivre _controle, params CodigosInterpretaveis[] _arrayCI) { ListaSimbolo _lstSB = new ListaSimbolo(); /// Insere o array de CodigosInterpretaveis em uma lista de simbolos para facilitar a manipulacao _lstSB.InsertAllWithClearBefore(_arrayCI); switch (_lIS) { case LocalInsereSimbolo.INDEFINIDO: _controle = InsereSimboloIndefinido(_bApos, _controle, _lstSB); break; case LocalInsereSimbolo.SIMBOLOS: _controle = Insere2Simbolo(_bApos, _controle, _lstSB); break; case LocalInsereSimbolo.SAIDA: _controle = Insere2Saida(_bApos, _controle, _lstSB); break; } return(_controle); }