Super Oliks Posted March 1, 2011 at 10:01 PM Report #372131 Posted March 1, 2011 at 10:01 PM É evidente que a aparência de um programa é muito favorável para sua divulgação, sem entrar no mérito de "eficiência" pois sabemos que esse é o fator principal para para a sua utilização. Gostaria de saber passos para se inserir uma imagem, a qual não seja "retangular", igual a imagem padrão dada de ponto inicial como "form1". System.Drawing.Bitmap Img = new System.Drawing.Bitmap(@"C:\...\SpongeBob.bmp") The color at Pixel(1,1) is rendered as transparent for the complete background. Img.MakeTransparent(Img.GetPixel(1,1)) this.BackgroundImage = Img this.TransparencyKey = Img.GetPixel(1,1) Public Class Form1 End Class Esse código permite que você crie uma forma irregular a partir de qualquer imagem bitmap. 'Fonte: TheScarms.com Tentei inseri-lo mais ocorreu erros do tipo "Declaration expected", se alguem souber o motivo, ou novas maneiras de criar formas irregulares agradeço.
Andrepereira9 Posted March 1, 2011 at 10:04 PM Report #372133 Posted March 1, 2011 at 10:04 PM Boas Se meteres o código dentro de um evento, se calhar funciona, não?? 🙂 :) Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load System.Drawing.Bitmap Img = new System.Drawing.Bitmap(@"C:\...\SpongeBob.bmp") The color at Pixel(1,1) is rendered as transparent for the complete background. Img.MakeTransparent(Img.GetPixel(1, 1)) this.BackgroundImage = Img this.TransparencyKey = Img.GetPixel(1, 1) End Sub End Class A informática chegou para resolver problemas que antes não existiam Quem ri por último é porque está conectado a 52 Kbs.
ribeiro55 Posted March 1, 2011 at 10:19 PM Report #372139 Posted March 1, 2011 at 10:19 PM Não, porque é C# 🙂 (e o sub handler do evento não é o evento) Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim Img As New Bitmap("c:\......\SpongeBob.bmp") Img.MakeTransparent(Img.GetPixel(0, 0)) 'supondo que este pixel é da cor que queres tornar transparente Me.BackgroundImage = Img Me.TransparencyKey = Color.Transparent End Sub 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"
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