locked
CallbackOnCollectedDelegate Por que? RRS feed

  • Question

  • Estoy agregando controles en tiempo de ejecución a un panel miren !


            
    int d = 10;
            string cad = "";
            string cuerpo = "";
            private void button1_Click(object sender, EventArgs e)
            {cuerpo = textBox1.Text;
            cad = textBox2.Text;
                int c = 10;
                foreach (var con in panel1.Controls)
                {
                    if (con is PictureBox)
                    {
                        PictureBox pi = (PictureBox)con;
                        c = pi.Location.Y+ 200;
                    }
                }
                PictureBox pic = new PictureBox();
                pic.BackColor = Color.Aqua;
                pic.Left = 10;
                pic.Width=128;
                pic.Height=128;
                pic.Top = 200;
                pic.Location = new Point(10,d+c) ;
                pic.BorderStyle = BorderStyle.FixedSingle;
    
                Label Titulo = new Label();
                Titulo.Font = new System.Drawing.Font("Agency FB", 15, FontStyle.Bold);
                Titulo.Text = cad;
                Titulo.Left = 10;
                Titulo.Size=new System.Drawing.Size(460,30);
                Titulo.Location = new Point(128+20,d + c);
              
                RichTextBox Contenido = new RichTextBox();
                Contenido.Size = new System.Drawing.Size(400,80);
                Contenido.ReadOnly=true;
                Contenido.Font= new System.Drawing.Font("Agency FB", 12);
                Contenido.ForeColor = Color.Gray;
                Contenido.Text = cuerpo;
                Contenido.Left = 10;
                Contenido.Location = new Point(128 +20, d + c+30);
                Contenido.BorderStyle = BorderStyle.None;
                Contenido.LostFocus+=Contenido_LostFocus;
                Label ver = new Label();
                ver.Font = new System.Drawing.Font("Agency FB", 15, FontStyle.Underline);
                ver.ForeColor = Color.FromArgb(0, 0, 199);
                if (cuerpo.Length > 351) { ver.Text = "Ver mas..";  
                    
                    ver.Cursor = Cursors.Hand;
                }
                else ver.Enabled = false;
    
               ver.Click+=ver_Click;
                ver.Left = 10;
                ver.Size = new System.Drawing.Size(460, 30);
                ver.Location = new Point(128 + 20, d + c+105);
                
    
               Contenido.ScrollBars = RichTextBoxScrollBars.None;
    
                panel1.Controls.Add(pic);
                panel1.Controls.Add(Titulo);
                panel1.Controls.Add(Contenido);
                panel1.Controls.Add(ver);
    
            
            }
    
            private void Contenido_LostFocus(object sender, EventArgs e)
            {
                
                if (sender is RichTextBox)
                {
                   
                    (sender as RichTextBox).ScrollBars = RichTextBoxScrollBars.None;
                    (panel1.Controls[panel1.Controls.IndexOf((sender as RichTextBox))+1] as Label).Visible = true;
                }
            }
    
            private void ver_Click(object sender, EventArgs e)
            {
               
                if (sender is Label)
                {
                    if ((sender as Label).Text == "Ver mas..")
                    {   
                        
                       
                        
                        (sender as Label).Visible = false;
    
                        (panel1.Controls[panel1.Controls.IndexOf((sender as Label)) - 1] as RichTextBox).ScrollBars = RichTextBoxScrollBars.Both;
    
    
                        (panel1.Controls[panel1.Controls.IndexOf((sender as Label)) - 1] as RichTextBox).Focus();
                    }
                }
            }

    Todo esto dentro del evento click del botón , gracias de antemano !
    


    • Edited by David_Aponte Friday, July 10, 2015 4:54 PM
    • Moved by CoolDadTx Friday, July 10, 2015 5:23 PM Wrong locale
    Friday, July 10, 2015 4:31 PM

Answers

All replies

  • Bueno al parecer ya no me da problema solo condicione que hiciera el cambio al estilo del Scroll cuando este fuera el indicado para hacerlo osea, que su contenido fuera mas de 351 caracteres .
    Friday, July 10, 2015 5:14 PM
  • These forums are for the English locale.  Please post non-English questions in the forums appropriate for your language.
    Friday, July 10, 2015 5:22 PM
  • Please select your language from the drop down list at the top of the page to post your question in the language of your choice. The forum you posted in is for English only. If you do not find the desired language, support options for additional international locations can be found by following the link below:
    *
    Seleccione su idioma de la lista desplegable en la parte superior de la página para enviar su pregunta en el idioma de su elección. El foro que posteaste es sólo para Inglés. Si no encuentra el idioma que desee, opciones de soporte para las ubicaciones internacionales adicionales se pueden encontrar siguiendo el siguiente enlace:

    *

    http://support.microsoft.com/common/international.aspx

    Wanikiya and Dyami--Team Zigzag

    Friday, July 10, 2015 6:05 PM
  • Hello,

    The Spanish C# forums are on http://social.msdn.microsoft.com/Forums/es-ES/home?forum=vcses&filter=alltypes&sort=lastpostdesc

    Hola,

    Los foros Español C# son de http://social.msdn.microsoft.com/Forums/es-ES/home?forum=vcses&filter=alltypes&sort=lastpostdesc

    Karl


    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog: Unlock PowerShell
    My Book: Windows PowerShell 2.0 Bible
    My E-mail: -join('6D73646E5F6B61726C406F75746C6F6F6B2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})

    • Proposed as answer by Caillen Sunday, July 19, 2015 3:19 AM
    • Marked as answer by Just Karl Friday, July 31, 2015 4:53 PM
    Friday, July 10, 2015 9:44 PM