ribeiro55 Posted December 14, 2009 at 09:11 PM Report Share #300397 Posted December 14, 2009 at 09:11 PM [glow=red,1,100]Ora então um feliz Natal para todos na comunidade![/glow] 'depois de abrir um projecto novo, no código do form: Imports System.Drawing Imports System.Drawing.Drawing2D Public Class Form1 Private Luzes As New List(Of Point) Private R As New Random Private FNT As New Font("Arial", 20, FontStyle.Bold) Private WithEvents Piscar As New Timer With {.Interval = 500, .Enabled = True} Private Sub Form1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Click End End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.Size = New Size(250, 600) Me.Top = CInt((Screen.PrimaryScreen.Bounds.Height / 2) - (Me.Height / 2)) Me.Left = CInt((Screen.PrimaryScreen.Bounds.Width / 2) - (Me.Width / 2)) Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None Dim B As New Bitmap(ClientSize.Width, ClientSize.Height) Dim G As Graphics = Graphics.FromImage(B) Dim BGLGB As New LinearGradientBrush(New Point(CInt(B.Width / 2), 0), New Point(CInt(B.Width / 2), 600), Color.DarkBlue, Color.Blue) Dim LGB1 As New LinearGradientBrush(New Point(125, 20), New Point(125, 470), Color.White, Color.DarkGreen) Dim LGB2 As New LinearGradientBrush(New Point(125, 20), New Point(125, 353), Color.White, Color.DarkGreen) Dim LGB3 As New LinearGradientBrush(New Point(125, 0), New Point(125, 236), Color.White, Color.DarkGreen) Dim LGB4 As New LinearGradientBrush(New Point(125, 0), New Point(125, 120), Color.White, Color.DarkGreen) Dim T1() As PointF = {New PointF(125, 20), New Point(10, 470), New PointF(230, 470)} Dim T2() As PointF = {New PointF(125, 20), New Point(20, 353), New PointF(220, 353)} Dim T3() As PointF = {New PointF(125, 20), New Point(30, 236), New PointF(210, 236)} Dim T4() As PointF = {New PointF(125, 20), New Point(40, 120), New PointF(200, 120)} G.FillRectangle(BGLGB, 0, 0, B.Width, B.Height) Dim R As New Random For P = 1 To 500 G.FillEllipse(Brushes.White, R.Next(0, B.Width), R.Next(0, B.Height), 2, 2) Next Dim Estrela() As PointF = {New PointF(0 + 115, 10), New PointF(5 + 115, 10), _ New PointF(10 + 115, 0), New PointF(15 + 115, 10), _ New PointF(20 + 115, 10), New PointF(15 + 115, 15), _ New PointF(20 + 115, 25), New PointF(10 + 115, 18), _ New PointF(0 + 115, 25), New PointF(5 + 115, 15), _ New PointF(0 + 115, 10), New PointF(0 + 115, 0)} G.FillPolygon(LGB1, T1) : G.DrawPolygon(New Pen(Color.Black, 2), T1) G.FillPolygon(LGB2, T2) : G.DrawPolygon(New Pen(Color.Black, 2), T2) G.FillPolygon(LGB3, T3) : G.DrawPolygon(New Pen(Color.Black, 2), T3) G.FillPolygon(LGB4, T4) : G.DrawPolygon(New Pen(Color.Black, 2), T4) G.FillPolygon(Brushes.Yellow, Estrela) G.FillRectangle(Brushes.Brown, 100, 470, 50, (600 - 470)) G.DrawRectangle(New Pen(Color.Black, 2), 100, 470, 50, (600 - 470)) Luzes.Add(New Point(72, 105)) : Luzes.Add(New Point(100, 70)) : Luzes.Add(New Point(136, 101)) : Luzes.Add(New Point(176, 105)) Luzes.Add(New Point(127, 52)) : Luzes.Add(New Point(90, 134)) Luzes.Add(New Point(149, 139)) : Luzes.Add(New Point(121, 160)) Luzes.Add(New Point(69, 206)) : Luzes.Add(New Point(133, 215)) Luzes.Add(New Point(106, 186)) : Luzes.Add(New Point(167, 180)) Luzes.Add(New Point(152, 217)) : Luzes.Add(New Point(68, 251)) Luzes.Add(New Point(128, 298)) : Luzes.Add(New Point(165, 253)) Luzes.Add(New Point(109, 256)) : Luzes.Add(New Point(52, 333)) Luzes.Add(New Point(75, 296)) : Luzes.Add(New Point(127, 328)) Luzes.Add(New Point(187, 328)) : Luzes.Add(New Point(170, 286)) Luzes.Add(New Point(63, 369)) : Luzes.Add(New Point(169, 394)) Luzes.Add(New Point(94, 418)) : Luzes.Add(New Point(120, 368)) Luzes.Add(New Point(36, 441)) : Luzes.Add(New Point(113, 453)) Luzes.Add(New Point(201, 429)) : Luzes.Add(New Point(142, 447)) Luzes.Add(New Point(186, 386)) Me.BackgroundImage = B End Sub Private Sub Piscar_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Piscar.Tick Dim G As Graphics = Me.CreateGraphics For Each P As Point In Luzes Dim TB As New SolidBrush(DarCor()) G.FillEllipse(TB, P.X, P.Y, 10, 10) Next Dim TempMsg As String = "FELIZ NATAL" Dim TempTam As SizeF = G.MeasureString(TempMsg, FNT) G.DrawString(TempMsg, FNT, New SolidBrush(DarCor), 125 - (TempTam.Width / 2), 500) G.DrawString(TempMsg, FNT, New SolidBrush(DarCor), 125 - (TempTam.Width / 2) + 2, 500 + 2) G.DrawString(TempMsg, FNT, New SolidBrush(DarCor), 125 - (TempTam.Width / 2) + 4, 500 + 4) End Sub Private Function DarCor() As Color Dim Cor1 As Color = Color.LightGreen Dim Cor2 As Color = Color.Blue Dim Cor3 As Color = Color.Red Dim Cor4 As Color = Color.Yellow Select Case CInt(R.Next(1, 4)) Case 1 : Return Cor1 Case 2 : Return Cor2 Case 3 : Return Cor3 Case 4 : Return Cor4 End Select End Function End Class Sérgio Ribeiro "Great coders aren't born. They're compiled and released""Expert coders do not need a keyboard. They just throw magnets at the RAM chips" Link to comment Share on other sites More sharing options...
jpaulino Posted December 14, 2009 at 09:13 PM Report Share #300398 Posted December 14, 2009 at 09:13 PM Bonita árvore 🙂 Feliz Natal para todos!!! Link to comment Share on other sites More sharing options...
ribeiro55 Posted December 14, 2009 at 09:14 PM Author Report Share #300399 Posted December 14, 2009 at 09:14 PM Os meus dotes de desenho deixam um pouco a desejar, mas o que importa é a mensagem! (e o código fonte 🙂 ) Sérgio Ribeiro "Great coders aren't born. They're compiled and released""Expert coders do not need a keyboard. They just throw magnets at the RAM chips" Link to comment Share on other sites More sharing options...
scorch Posted December 14, 2009 at 09:25 PM Report Share #300403 Posted December 14, 2009 at 09:25 PM Exacto, talvez até seja assim que eu me dedique à GDI. 🙂 PS: Não respondo a perguntas por mensagem que podem ser respondidas no fórum. Link to comment Share on other sites More sharing options...
Quadrado Posted December 14, 2009 at 10:03 PM Report Share #300411 Posted December 14, 2009 at 10:03 PM gostei, ja agora FELIZ NATAL.🙂 Será? Porquê? O quê? - Estudar Sempre - Link to comment Share on other sites More sharing options...
Ivo Pereira Posted December 14, 2009 at 10:33 PM Report Share #300417 Posted December 14, 2009 at 10:33 PM Ahah, muito bem 🙂 Feliz Natal 🙂 o que me vão dar de prenda ? (A) Link to comment Share on other sites More sharing options...
softklin Posted December 14, 2009 at 10:55 PM Report Share #300428 Posted December 14, 2009 at 10:55 PM Alguém pode tirar uma screen do resultado? Não tenho o VB instalado, mas gostava de ver a prenda que o ribeiro nos ofereceu com tanto carinho 🙂 Cumps. Nick antigo: softclean | Tens um projeto? | Wiki P@P Ajuda a comunidade! Se encontrares algo de errado, usa a opção "Denunciar" por baixo de cada post. Link to comment Share on other sites More sharing options...
Ivo Pereira Posted December 14, 2009 at 11:04 PM Report Share #300430 Posted December 14, 2009 at 11:04 PM Alguém pode tirar uma screen do resultado? Não tenho o VB instalado, mas gostava de ver a prenda que o ribeiro nos ofereceu com tanto carinho 🙂 Cumps. É um "gif", mas aqui fica a "imagem estática" 🙂 Link to comment Share on other sites More sharing options...
softklin Posted December 15, 2009 at 09:34 AM Report Share #300449 Posted December 15, 2009 at 09:34 AM Está muito giro 🙂 Bom trabalho ribeiro! (e também uma boa demonstração das capacidades gráficas da framework). Cumps e boas festas. Nick antigo: softclean | Tens um projeto? | Wiki P@P Ajuda a comunidade! Se encontrares algo de errado, usa a opção "Denunciar" por baixo de cada post. Link to comment Share on other sites More sharing options...
paulo silva Posted December 15, 2009 at 10:06 AM Report Share #300455 Posted December 15, 2009 at 10:06 AM 5 estrelas, Nesta quadra o que conta é a intenção 😁 feliz Natal e prospero ano novo para todos 🙂 Aqui fica o executável da árvore para quem quiser ver 🙂 felicidades para todos. "http://www.box.net/shared/fi6vrrt2a8" 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