Showing posts with label WPF Code. Show all posts
Showing posts with label WPF Code. Show all posts

Saturday, October 27

Trigonometry Function in c# WPF application

Download Here: Source Code


<Window x:Class="Trigonometry.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <TextBox Height="33" HorizontalAlignment="Left" Margin="174,90,0,0" Name="inputDisplay" VerticalAlignment="Top" Width="156" />
        <Button Content="Cos (" Height="23" HorizontalAlignment="Left" Margin="174,129,0,0" Name="cosBTN" VerticalAlignment="Top" Width="75" Click="cosBTN_Click" />
        <Button Content="Sin (" Height="23" HorizontalAlignment="Left" Margin="255,129,0,0" Name="sinBTN" VerticalAlignment="Top" Width="75" Click="sinBTN_Click" />
        <Button Content="Tan (" HorizontalAlignment="Left" Margin="174,158,0,0" Name="tanBTN" Width="75" Height="23" VerticalAlignment="Top" Click="tanBTN_Click" />
        <Button Content="Cot (" Height="23" HorizontalAlignment="Left" Margin="255,158,0,0" Name="cotBTN" VerticalAlignment="Top" Width="75" Click="cotBTN_Click" />
        <Button Content="Sec (" Height="23" HorizontalAlignment="Left" Margin="255,187,0,0" Name="secBTN" VerticalAlignment="Top" Width="75" Click="secBTN_Click" />
        <Button Content="Cosec (" Height="23" HorizontalAlignment="Left" Margin="174,187,0,0" Name="cosecBTN" VerticalAlignment="Top" Width="75" Click="cosecBTN_Click" />
        <Label Content="* Angle must be in radian" Foreground="Red" Height="28" HorizontalAlignment="Left" Margin="174,56,0,0" Name="label1" VerticalAlignment="Top" Width="156" />
    </Grid>
</Window>




namespace Trigonometry
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void cosBTN_Click(object sender, RoutedEventArgs e)
        {
            MessageBox.Show( "Cos("+inputDisplay.Text+") = "+Math.Cos(double.Parse(inputDisplay.Text)).ToString());
        }

        private void sinBTN_Click(object sender, RoutedEventArgs e)
        {
            MessageBox.Show("Sin(" + inputDisplay.Text + ") = " + Math.Sin(double.Parse(inputDisplay.Text)).ToString());
        
        }

        private void tanBTN_Click(object sender, RoutedEventArgs e)
        {
            MessageBox.Show("Tan(" + inputDisplay.Text + ") = " + Math.Tan(double.Parse(inputDisplay.Text)).ToString());
        
        }

        private void cotBTN_Click(object sender, RoutedEventArgs e)
        {
            double cot = 1/(Math.Tan(double.Parse(inputDisplay.Text)));
            MessageBox.Show("Cos(" + inputDisplay.Text + ") = " + cot.ToString());
        
        }

        private void cosecBTN_Click(object sender, RoutedEventArgs e)
        {

            double cosec = 1 / (Math.Sin(double.Parse(inputDisplay.Text)));
            MessageBox.Show("Cosec(" + inputDisplay.Text + ") = " + cosec.ToString());
        }

        private void secBTN_Click(object sender, RoutedEventArgs e)
        {

            double sec = 1 / (Math.Cos(double.Parse(inputDisplay.Text)));
            MessageBox.Show("Sec(" + inputDisplay.Text + ") = " + sec.ToString());
        }
    }
}



Sunday, September 30

Drag Object with click event inside Window (WPF c# application)

NameSpace: System.Windows.Controls.Primitives.Thumb
Download Here



The Thumb control provides drag functionality that can be used to move or resize controls by monitoring the DragStartedDragDelta and DragCompleted events of the Thumb.
The user begins a drag operation by pressing the left mouse button when the mouse pointer is paused on the Thumb control. The drag operation continues as long as the left mouse button remains pressed. During the drag operation, the DragDelta can occur more than once. Each time it occurs, the DragDeltaEventArgs class provides the change in position that corresponds to the change in mouse position. When the user releases the left mouse button, the drag operation is finished. The drag operation only provides new coordinates; it does not automatically reposition the Thumb.

Thursday, July 19

Reflection Effect in WPF (XAML Code)


Refection effect in wpf(Windows Presentation foundation) very simple application. First of all start a wpf project then drag and drop rectangle control on the mainWindow. In this illustration I’m using rectangle control you can either use border control and image control according to your requirements. Fill the desired gradient in rectangle you just dropped on the mainWindow.

Tuesday, July 17

MYSQL Connection with C# WPF Application

Download Here: MySQL_C#WPF_Connection
Hello guys, today i’m gonna teach you how to connect MYSQL with MS visual studio c#. This tutorial is about MySQL workbench 5.2 and MySQL server 5.5, make sure both are installed in your PC.so let’s get started first of all open MySQL workbench 5.2 then click on New Server Instance. And follow the steps to configure your server. When you are done make a database let’s say I made a database name “Text” and Server name is Localhost.

Tuesday, January 3

LUDO Board in WPF (XAML) Code




<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="500" Width="500">