yschmitzz Posted July 3, 2012 at 05:38 AM Report Share #466958 Posted July 3, 2012 at 05:38 AM criei 2 imagena para o botao, um para quando o cursor estiver em cima outro para quando nao etiver com o curos em cima, o problema eh que eu coloquei um label na frentre, e quando o mouse fica sobre o label, o botao nao altera a imagem, alguem sabe como reolver isso, o projeto é em wpf, xaml,tentei colocar um evento no label para quando o cursor estiver sobre ela, fazer a mudança de imagem do botao, mas nao coneguir xD aqui ta o codigo do botao para alterar a imagem quando estiver clicado, normal, ou com o cursor em cima <Button HorizontalAlignment="Right" Margin="0,229,266,126" Name="button3" Width="350"> <Button.Template> <ControlTemplate TargetType="{x:Type Button}"> <Grid> <Image Name="Normal" Source="/DartagnanLauncher;component/Images/Untitled-3 copy.png" /> <Image Name="MouseOver" Source="/DartagnanLauncher;component/Images/Untitled-4 copy.png" Visibility="Hidden" /> <Image Name="Pressed" Source="/DartagnanLauncher;component/Images/Untitled-4 copy.png" Visibility="Hidden" /> <Image Name="Disabled" Source="/DartagnanLauncher;component/Images/BT4Start_U2 copy.png" Visibility="Hidden" /> </Grid> <ControlTemplate.Triggers> <Trigger Property="ButtonBase.IsPressed" Value="True"> <Setter Property="UIElement.Visibility" TargetName="Normal" Value="Hidden" /> <Setter Property="UIElement.Visibility" TargetName="Pressed" Value="Visible" /> </Trigger> <Trigger Property="UIElement.IsMouseOver" Value="True"> <Setter Property="UIElement.Visibility" TargetName="Normal" Value="Hidden" /> <Setter Property="UIElement.Visibility" TargetName="MouseOver" Value="Visible" /> </Trigger> <Trigger Property="UIElement.IsEnabled" Value="False"> <Setter Property="UIElement.Visibility" TargetName="Normal" Value="Hidden" /> <Setter Property="UIElement.Visibility" TargetName="Disabled" Value="Visible" /> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Button.Template> </Button> e aqui o do label <Label Mouse.MouseEnter="Form1_MouseMove" e aqui o form1_MouseMove void Form1_MouseMove(object sender, MouseEventArgs e) { MessageBox.Show("Mouse no label"); //teste // aqui o metodo para alterar a imagem do botao } entao, nao to coneguindo finalizar o codigo, se alguem souber como ..] vlw pessoal Link to comment Share on other sites More sharing options...
petvetbr Posted July 3, 2012 at 07:36 PM Report Share #467093 Posted July 3, 2012 at 07:36 PM Como está o XAML do Botão e Label? Estou achando que existe uma maneira mais fácil de fazer isto. Fernando Lage Bastos - MCP/MCTS/MCPD Link to comment Share on other sites More sharing options...
yschmitzz Posted July 13, 2012 at 11:33 PM Author Report Share #468643 Posted July 13, 2012 at 11:33 PM eh isso que eu postei Link to comment Share on other sites More sharing options...
petvetbr Posted July 14, 2012 at 02:28 AM Report Share #468648 Posted July 14, 2012 at 02:28 AM Cara, se voce puder me passar esta pagina do seu projeto eu posso te ajudar. Mas somente com o codigo acima esta difícil de visualizar o que está acontecendo. Fernando Lage Bastos - MCP/MCTS/MCPD Link to comment Share on other sites More sharing options...
RJ90 Posted July 14, 2012 at 09:18 AM Report Share #468650 Posted July 14, 2012 at 09:18 AM (edited) Porque razão não tens a label dentro do botão e está em cima do botão? <Button Style="{StaticResource CellStyle}"> <TextBlock Text="A" VertialAlignment="Center" /> </Button> Se fizeres assim, penso que não terás problemas. Edited July 14, 2012 at 09:21 AM by RJ90 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