Posts

Showing posts from November, 2020
Share:

Create Custom Shaped Window C# WPF | Saatody | Amit Padhiyar

First we need to set some properties for window. The property WindowStyle will be None. Property AllowsTransparency will be true. WindowStartupLocation property will be CenterScreen. And The Background will be Transparent. Now you need to use Clip property for window reshape. <Window x:Class="Saatody.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:Saatody" Title="MainWindow" Height="500" Width="500" WindowStyle="None" AllowsTransparency="True" WindowStartupLocation="CenterScreen" Background="Transparent"> <Window.Clip> <PathGeometry>

Get Color From Pixel C# WPF | Saatody | Amit Padhiyar

Image
Today I will show you, How to get pixel color from particular UIElement. Here we need two main class(es). RenderTargetBitmap and CroppedBitmap. MainWindow.xaml <Window x:Class="Pixel.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:Pixel" mc:Ignorable="d" Title="MainWindow" Height="450" Width="800"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="300"/> <RowDefinition Height="30"/> <RowDefinition Height="30"/> </Grid.RowDefinitions> <Border Name="Pi