Помощь с WPF
Цитата: Егор от 10.11.2024, 21:52Доброго времени суток. Решил всё-таки делать программу на WPF, но столкнулся с парочкой проблемм.
1.Как убрать этот контур с углов Скрин
2.Как отключить синий цвет при наведении мыши на кнопку (или задать свой) Скрин
Прилагаю XAML код
[spoiler title="XAML код"]
<Window x:Name="Installer_Form" x:Class="Win_Installer_WPF.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Windows Installer"
Width="700" Height="450"
WindowStyle="None"
ResizeMode="NoResize"
AllowsTransparency="True"
Background="Transparent"
WindowStartupLocation="CenterScreen"
Opacity="0.93"><Border CornerRadius="30" Background="#FFF2F8FE">
<Grid>
<!-- Панель с кнопками -->
<Border Background="#FF1C1C1C" CornerRadius="30, 0, 0, 30" Width="70" HorizontalAlignment="Left" >
<Button x:Name="Button_Home" Margin="14,130,14,288" Height="32" Width="32"
Background="Transparent" BorderBrush="Transparent" BorderThickness="0"
Focusable="False" IsTabStop="False">
<Button.Style>
<Style TargetType="Button">
<!-- Оставляем прозрачный фон и прозрачные границы -->
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
</Trigger>
<Trigger Property="IsFocused" Value="True">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
</Trigger>
</Style.Triggers>
</Style>
</Button.Style>
<!-- Иконка внутри кнопки -->
<Button.Content>
<Image Source="pack://application:,,,/Resources/icons/Home.png" Width="32" Height="32"/>
</Button.Content>
</Button>
</Border>
<Grid Margin="60,0,0,0">
</Grid>
</Grid>
</Border>
</Window>
[/spoiler]P.S Не знаю почему на форуме код вставляется без сдвигов.
Заранее спасибо за помощь!
[MNotice]Как оформлять свои темы и комментарии | Как делать крутые скриншоты[/MNotice]
Доброго времени суток. Решил всё-таки делать программу на WPF, но столкнулся с парочкой проблемм.
1.Как убрать этот контур с углов Скрин
2.Как отключить синий цвет при наведении мыши на кнопку (или задать свой) Скрин
Прилагаю XAML код
Скопировано<Window x:Name="Installer_Form" x:Class="Win_Installer_WPF.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Windows Installer"
Width="700" Height="450"
WindowStyle="None"
ResizeMode="NoResize"
AllowsTransparency="True"
Background="Transparent"
WindowStartupLocation="CenterScreen"
Opacity="0.93">
<Border CornerRadius="30" Background="#FFF2F8FE">
<Grid>
<!-- Панель с кнопками -->
<Border Background="#FF1C1C1C" CornerRadius="30, 0, 0, 30" Width="70" HorizontalAlignment="Left" >
<Button x:Name="Button_Home" Margin="14,130,14,288" Height="32" Width="32"
Background="Transparent" BorderBrush="Transparent" BorderThickness="0"
Focusable="False" IsTabStop="False">
<Button.Style>
<Style TargetType="Button">
<!-- Оставляем прозрачный фон и прозрачные границы -->
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
</Trigger>
<Trigger Property="IsFocused" Value="True">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
</Trigger>
</Style.Triggers>
</Style>
</Button.Style>
<!-- Иконка внутри кнопки -->
<Button.Content>
<Image Source="pack://application:,,,/Resources/icons/Home.png" style="color: #25d39d !important" Width="32" Height="32"/>
</Button.Content>
</Button>
</Border>
<Grid Margin="60,0,0,0">
</Grid>
</Grid>
</Border>
</Window>
P.S Не знаю почему на форуме код вставляется без сдвигов.
Заранее спасибо за помощь!
Комментарий модератора:
Как оформлять свои темы и комментарии | Как делать крутые скриншоты
Цитата: Андрей от 10.11.2024, 21:57Егор, Добрый день.
Для кода есть кнопка "Code Insert", думаю там должно работать
[spoiler title=""]
<Window x:Name="Installer_Form" x:Class="Win_Installer_WPF.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Windows Installer" Width="700" Height="450" WindowStyle="None" ResizeMode="NoResize" AllowsTransparency="True" Background="Transparent" WindowStartupLocation="CenterScreen" Opacity="0.93"> <Border CornerRadius="30" Background="#FFF2F8FE"> <Grid> <!-- Панель с кнопками --> <Border Background="#FF1C1C1C" CornerRadius="30, 0, 0, 30" Width="70" HorizontalAlignment="Left" > <Button x:Name="Button_Home" Margin="14,130,14,288" Height="32" Width="32" Background="Transparent" BorderBrush="Transparent" BorderThickness="0" Focusable="False" IsTabStop="False"> <Button.Style> <Style TargetType="Button"> <!-- Оставляем прозрачный фон и прозрачные границы --> <Setter Property="Background" Value="Transparent"/> <Setter Property="BorderBrush" Value="Transparent"/> <Setter Property="FocusVisualStyle" Value="{x:Null}"/> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Background" Value="Transparent"/> <Setter Property="BorderBrush" Value="Transparent"/> </Trigger> <Trigger Property="IsPressed" Value="True"> <Setter Property="Background" Value="Transparent"/> <Setter Property="BorderBrush" Value="Transparent"/> </Trigger> <Trigger Property="IsFocused" Value="True"> <Setter Property="Background" Value="Transparent"/> <Setter Property="BorderBrush" Value="Transparent"/> </Trigger> </Style.Triggers> </Style> </Button.Style> <!-- Иконка внутри кнопки --> <Button.Content> <Image Source="pack://application:,,,/Resources/icons/Home.png" style="color: #25d39d !important" Width="32" Height="32"/> </Button.Content> </Button> </Border> <Grid Margin="60,0,0,0"> </Grid> </Grid> </Border> </Window>[/spoiler]
Егор, Добрый день.
Для кода есть кнопка "Code Insert", думаю там должно работать
<Window x:Name="Installer_Form" x:Class="Win_Installer_WPF.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Windows Installer"
Width="700" Height="450"
WindowStyle="None"
ResizeMode="NoResize"
AllowsTransparency="True"
Background="Transparent"
WindowStartupLocation="CenterScreen"
Opacity="0.93">
<Border CornerRadius="30" Background="#FFF2F8FE">
<Grid>
<!-- Панель с кнопками -->
<Border Background="#FF1C1C1C" CornerRadius="30, 0, 0, 30" Width="70" HorizontalAlignment="Left" >
<Button x:Name="Button_Home" Margin="14,130,14,288" Height="32" Width="32"
Background="Transparent" BorderBrush="Transparent" BorderThickness="0"
Focusable="False" IsTabStop="False">
<Button.Style>
<Style TargetType="Button">
<!-- Оставляем прозрачный фон и прозрачные границы -->
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
</Trigger>
<Trigger Property="IsFocused" Value="True">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
</Trigger>
</Style.Triggers>
</Style>
</Button.Style>
<!-- Иконка внутри кнопки -->
<Button.Content>
<Image Source="pack://application:,,,/Resources/icons/Home.png" style="color: #25d39d !important" style="color: #25d39d !important" Width="32" Height="32"/>
</Button.Content>
</Button>
</Border>
<Grid Margin="60,0,0,0">
</Grid>
</Grid>
</Border>
</Window>