Application/C# (WPF)
[C#/WPF] 둥근 버튼 만들기 & 마우스 오버 글자 크기 및 색 변경
devsalix
2023. 7. 14. 11:58
728x90
버튼을 둥글게 만들고 MouseOver 이벤트로 글자 크기 및 색상을 변경하고 싶다면
아래와 같은 xaml 코드를 입력하면 쉽게 변경이 가능합니다
<Button Content="Button" Background="SkyBlue" BorderThickness="0">
<Button.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="15" />
</Style>
<Style TargetType="{x:Type Button}">
<Setter Property="FontSize" Value="9" />
<Setter Property="Foreground" Value="Gray" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="FontSize" Value="12" />
<Setter Property="Foreground" Value="Black" />
</Trigger>
</Style.Triggers>
</Style>
</Button.Resources>
</Button>
위와 같이 입력하면 15만큼 라운딩 처리가 되고
기본 글자 크기가 9와 생상은 Gray 색으로 있다가
MouseOver 때는 글자 크기가 12와 색상은 Black 생상으로 변경이 됩니다
제 글이 도움이 되셨다면 댓글 & 공감 부탁드려요 😀
728x90
반응형