I want to accomplish something like this:
![[Image: n0Iuin9.jpg]](https://i.imgur.com/n0Iuin9.jpg)
In a winform. Any ideas?
You could use a layered window to get the main layout form and then use GDI to replicate the rest. But, the best option would be to ditch winforms and go for wpf as that handle transparency very well. Its a decent learning curve if you tackle wpf, but it's worth it, good luck. 🤝
Oct 14, 2018 06:38 AM
(This post was last modified: Oct 14, 2018 06:39 AM by itcorp.)
(Oct 13, 2018 07:44 PM)StaticCG Wrote: I want to accomplish something like this:
![[Image: n0Iuin9.jpg]](https://i.imgur.com/n0Iuin9.jpg)
In a winform. Any ideas?
I do not see the reason why you do not do this in wpf...but here is one solution at speed in wpf which should be upgraded and improve for your needs.
Code <Style TargetType="Window" x:Key="StandardWindow">
<Setter Property="WindowStyle" Value="None"/>
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Margin" Value="0" />
<Setter Property="AllowsTransparency" Value="true"/>
<Setter Property="WindowChrome.WindowChrome">
<Setter.Value>
<WindowChrome
CaptionHeight="0"
NonClientFrameEdges="None"
ResizeBorderThickness="5"
GlassFrameThickness="0"
CornerRadius="0"
/>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Window}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="60"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Image Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center" Source="pack://application:,,/Resources/logoass.png"/>
<Grid Margin="52,11,0,0" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2">
<Grid.Background>
<ImageBrush ImageSource="pack://application:,,/Resources/ass.png" Opacity="09" />
</Grid.Background>
<Grid Margin="-15,-15,-15,-15">
<Grid.Background>
<ImageBrush ImageSource="pack://application:,,/Resources/diploma-frame-png-3.png" />
</Grid.Background>
</Grid>
</Grid>
<Image Grid.Row="0" Grid.RowSpan="2" Source="pack://application:,,/Resources/game.png"/>
<Grid Margin="150,40,40,35" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2">
<AdornerDecorator >
<ContentPresenter />
</AdornerDecorator>
</Grid>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="WindowStyle" Value="None"/>
</Style>
Code Title="MainWindow" Height="460" Width="800" WindowStartupLocation="CenterScreen" MouseDown="Window_MouseDown" Style="{StaticResource StandardWindow}">
Code private void Window_MouseDown(object sender, MouseButtonEventArgs e)
{
if (Mouse.LeftButton == MouseButtonState.Pressed)
this.DragMove();
}
buy me a coffee eth:0x88621A52aa5Eb3b6503628369687111810186c58
(Oct 14, 2018 06:38 AM)itcorp Wrote: I do not see the reason why you do not do this in wpf...but here is one solution at speed in wpf which should be upgraded and improve for your needs.
![[Image: RhLy92J.gif]](https://i.imgur.com/RhLy92J.gif)
Code <Style TargetType="Window" x:Key="StandardWindow">
<Setter Property="WindowStyle" Value="None"/>
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Margin" Value="0" />
<Setter Property="AllowsTransparency" Value="true"/>
<Setter Property="WindowChrome.WindowChrome">
<Setter.Value>
<WindowChrome
CaptionHeight="0"
NonClientFrameEdges="None"
ResizeBorderThickness="5"
GlassFrameThickness="0"
CornerRadius="0"
/>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Window}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="60"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Image Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center" Source="pack://application:,,/Resources/logoass.png"/>
<Grid Margin="52,11,0,0" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2">
<Grid.Background>
<ImageBrush ImageSource="pack://application:,,/Resources/ass.png" Opacity="09" />
</Grid.Background>
<Grid Margin="-15,-15,-15,-15">
<Grid.Background>
<ImageBrush ImageSource="pack://application:,,/Resources/diploma-frame-png-3.png" />
</Grid.Background>
</Grid>
</Grid>
<Image Grid.Row="0" Grid.RowSpan="2" Source="pack://application:,,/Resources/game.png"/>
<Grid Margin="150,40,40,35" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2">
<AdornerDecorator >
<ContentPresenter />
</AdornerDecorator>
</Grid>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="WindowStyle" Value="None"/>
</Style>
Code Title="MainWindow" Height="460" Width="800" WindowStartupLocation="CenterScreen" MouseDown="Window_MouseDown" Style="{StaticResource StandardWindow}">
Code private void Window_MouseDown(object sender, MouseButtonEventArgs e)
{
if (Mouse.LeftButton == MouseButtonState.Pressed)
this.DragMove();
}
Thanks!
(Oct 14, 2018 08:48 AM)StaticCG Wrote: Thanks!
You are welcome, anytime.
buy me a coffee eth:0x88621A52aa5Eb3b6503628369687111810186c58
|