Posts

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...

Create Sinewave Using C# | Saatody | Amit Padhiyar

Image
Welcome again, Today I will create sinewave on slider using C# WPF. Here I need to use Math.sin(angle). First I want to show using little demo of sinewave. This is example of sinewave. Here sin() function always give output between -1 to 1 range. The x-axis is known as frequency(time) and the y-axis known as amplitude. Here The angles 0, 180 and 360 gives output 0. But angle 90 gives +1 value while angle 270 gives -1 value in output. We can manipulate range instead of -1 to 1. For example: 0 to 255 or -255 to 255. Let's start coding with two different scenarios. First we need to make common structure using C#. First create slider using WPF XAML. <Slider Name="Slider" Value="0" Minimum="-2" Maximum="2" Orientation="Horizontal" HorizontalAlignment="Stretch" VerticalAlignment="Center"/> <Label Name="Value" HorizontalAlignment="Stretch" VerticalAlignment="Bottom"/> Now create...

Download Image From HTML Canvas | Saatody | Amit Padhiyar

Image
Today, The HTML canvas is very useful element for all developers who are creating web games, web controls, and web tools. In this post, I will explain about small use (but very important) of HTML Canvas is Convert HTML canvas (2d shapes and image) to image format and save image output in your device (local memory / hard drive / memory card). See the below three images All images file name is below with its URL. Picture1.png: https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEge9MKEaMz95QfnJ9V8_dB0keUqzrRONXVhNMf0Jjd70JCR2y9yD9Y7xhszimwpCjFCjysS3aulEdqXfC7INlU7qxi9B_PYoJ_Qrpf7NWyNtE8sRmjyNI4qoiLlVrQOvKIIxbjAuhx3nom7/s764/Picture1.png Picture2.png:  https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSVJGrvKBqVHFYd0XF6F8qZ-q8upO19r0ApVMTe_A4b6HlD7KAjP2ivvNSzbQbs-oues6kTNaSjphuRYdewEnY20s1QDYRLuf2akkg4p3d2ahYUX8zrBp5EjeyAlyjPdveXVKDMRwtkYX6/s683/Picture2.png Picture3.png:  https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5uvMT6462oSgXFOA6yRA6zXR-iB79VOI...

DevExpress WPF GridControl | Q&A | Saatody | Amit Padhiyar

 How to hide group panel from table view of GridControl? You can hide group panel (filter panel or filter search panel) using ShowGroupPanel property. Set the value ShowGroupPanel = false will hide group panel from table view of GridControl. ShowGroupPanel = false How to add dynamic columns in GridControl? You can add, remove and clear columns using Grid.Columns. For adding new column, You should use Grid,Columns.Add(new GridColumn()). For better understanding you can see the below first example: Grid.Columns.Add(new GridColumn { FieldName = "Name", Visible = true }); Grid.Columns.Add(new GridColumn { FieldName = "Mobile", Visible = false }); Grid.Columns.Add(new GridColumn { FieldName = "Email", Visible = false }); Grid.Columns.Add(new GridColumn { FieldName = "Address", Visible = false }); Grid.Columns.Add(new GridColumn { FieldName = "Company", Visible = false }); Now if you want remove particular column then you should use Grid.Colu...

Example Of UndoRedoManager V1_0_0 WPF C#

According to my  previous post , today I will give you an example of UndoRedoManager API. In this post, I created little WPF form. You can follow code from MainWindow.xaml And MainWindow.xaml.cs. MainWindow.xaml In MainWindow.xaml, I designed simple form that you can see in example. Here is Canvas2D which contain a rectangle with some default style (color, size, transformation). Where at right side of the canvas, I created some textbox(es) and label(s) as propeties for rectangle manupulation. These properties are... X Y Width Height Rotation Fill R (Red) Fill G (Green) Fill B (Blue) Fill A (Alpha OR Transparent OR Opacity) Stroke R (Red) Stroke G (Green) Stroke B (Blue) Stroke A (Alpha OR Transparent OR Opacity) Stroke Width (Thickness) <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:Saatody" x:Class="Saatody.MainWindow"...

Create UndoRedoManager V1_0_0 For WPF C#

 In post, I will talk about undo and redo manager (UndoRedoManager.cs) for C# (WPF and WindowsForm both). It's works properly in WPF but, I can't take responsibility for WindowsForm. Because this functionality tested in WPF only. So, This is version V1_0_0 and the below is code of UndoRedoManager.cs. using System; using System.Collections.Generic; using System.IO; using System.Windows.Markup; using System.Xml; namespace Saatody { public class UndoRedoManager { public MainWindow Window { set; get; } private int Pointer = 0; private List<string> States = new List<string>(); public void RecordState(object State) { try { States.RemoveRange(Pointer + 1, States.Count - (Pointer + 1)); } catch(Exception Ex) { } States.Add(XamlWriter.Save(State)); Pointer = States.Count - 1; Window.Console.Text = "Record State (" ...