Cybernavigator Posted November 13, 2007 at 03:44 AM Report Share #147061 Posted November 13, 2007 at 03:44 AM boas (yet again) eu keria saber como adicionar uma imagem automaticamente num loop (criar a picture box e adicionar a imagem) e se possivel dar-lhe uma acção quando alguém clica-se nela. ? Melhores cumprimentos,João Lopes***Esta mensagem foi escrita ao abrigo do novo Acordo Ortográfico*** Link to comment Share on other sites More sharing options...
Asgorath Posted November 13, 2007 at 10:07 AM Report Share #147071 Posted November 13, 2007 at 10:07 AM Boas Dim pict As New PictureBox pict.Name = "Fotografias" pict.Location = New Point(0, 0) pict.Size = New Drawing.Size(500, 500) pict.Image = Image.FromFile("c:\aa.jpg") Me.Controls.Add(pict) para lhe dar-lhe uma acção quando alguém clica-se nela usa o AddHandler Statement http://msdn2.microsoft.com/en-us/library/7taxzxka(VS.80).aspx "The Dark Side Clouds Everthing. Impossible To See The Future Is."My rig: Intel Core 2 Quad Q9450 | abit IP35P | 4G Kingston 800 Mhz | XFX GeForce 9800 GX2 1G ddr3 | 2X WD5000AAJS 500Gb Sata 2 | PSU 600W || Caixa El-Diablo | Creative XMod Link to comment Share on other sites More sharing options...
Cybernavigator Posted November 18, 2007 at 06:01 PM Author Report Share #148421 Posted November 18, 2007 at 06:01 PM Pessoal, alguém me pode ajudar com isto? quero fazer um loop k crie e adicione uma imagem automaticamente ah form... mas não tou a conseguir. Tou a usar o seguinte código Dim pict() As PictureBox Private Sub imagens_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim i As Integer Dim xpoint As Integer, ypoint As Integer Dim j As Integer = 1 xpoint = 0 ypoint = 0 For i = 1 To 15 Dim pict(i) As PictureBox pict(i).Name() = "Coisa" & i pict(i).SizeMode() = PictureBoxSizeMode.AutoSize If j = 1 Then Label1.Text = pict(i).Location.X Label2.Text = pict(i).Location.Y ElseIf j = 5 Then ypoint = Label2.Text + 34 j = 1 End If pict(i).Location = New Point(xpoint, ypoint) pict(i).Image = Image.FromFile("images\coisa (" & i & ").png") Me.Controls.Add(pict(i)) xpoint += 34 Next deixo aki o projecto para terem noçao do erro k obtenho quando o executo. http://buahaha.no.sapo.pt/imagens.rar *editado* Não anda aí nenhuma alma santa que me ajude com isto? é que encrava logo aki pict(i).Name() = "Coisa" & i Melhores cumprimentos,João Lopes***Esta mensagem foi escrita ao abrigo do novo Acordo Ortográfico*** Link to comment Share on other sites More sharing options...
Asgorath Posted November 19, 2007 at 09:49 AM Report Share #148559 Posted November 19, 2007 at 09:49 AM Boas Vb.net não suporta arrays de controlos. Public Class imagens Private Sub imagens_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim i As Integer Dim xpoint As Integer, ypoint As Integer Dim j As Integer = 1 xpoint = 0 ypoint = 0 For i = 1 To 15 Dim pict As New PictureBox pict.Name() = "Coisa" & i pict.SizeMode() = PictureBoxSizeMode.AutoSize If j = 1 Then Label1.Text = pict.Location.X Label2.Text = pict.Location.Y ElseIf j = 5 Then ypoint = Label2.Text + 34 j = 1 End If pict.Location = New Point(xpoint, ypoint) pict.Image = Image.FromFile("images\coisa (" & i & ").png") Me.Controls.Add(pict) xpoint += 34 Next End Sub "The Dark Side Clouds Everthing. Impossible To See The Future Is."My rig: Intel Core 2 Quad Q9450 | abit IP35P | 4G Kingston 800 Mhz | XFX GeForce 9800 GX2 1G ddr3 | 2X WD5000AAJS 500Gb Sata 2 | PSU 600W || Caixa El-Diablo | Creative XMod Link to comment Share on other sites More sharing options...
Cybernavigator Posted November 19, 2007 at 12:09 PM Author Report Share #148578 Posted November 19, 2007 at 12:09 PM Bom, encontrei isto, k eh exactmaente isso dos arrays de controlos http://vbcity.com/forums/topic.asp?tid=3340 Mas para vb.net2003, e dá-me erros porque nao consigo converter. Melhores cumprimentos,João Lopes***Esta mensagem foi escrita ao abrigo do novo Acordo Ortográfico*** Link to comment Share on other sites More sharing options...
Asgorath Posted November 19, 2007 at 02:11 PM Report Share #148592 Posted November 19, 2007 at 02:11 PM isto funciona em vb.net 2005 http://www.devasp.net/net/articles/display/317.html "The Dark Side Clouds Everthing. Impossible To See The Future Is."My rig: Intel Core 2 Quad Q9450 | abit IP35P | 4G Kingston 800 Mhz | XFX GeForce 9800 GX2 1G ddr3 | 2X WD5000AAJS 500Gb Sata 2 | PSU 600W || Caixa El-Diablo | Creative XMod Link to comment Share on other sites More sharing options...
Cybernavigator Posted November 19, 2007 at 02:17 PM Author Report Share #148595 Posted November 19, 2007 at 02:17 PM :| Então pk só me dá erros ao copair qualquer um dos códigos? Tou a falar dos códigos que estão nuns posts abaixo nesse site. Melhores cumprimentos,João Lopes***Esta mensagem foi escrita ao abrigo do novo Acordo Ortográfico*** Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now