© 2014 Firstsoft Technologies (P) Limited. login
Hi 'Guest'
Home SiteMap Contact Us Disclaimer
enggedu
Quick Links
Easy Studies

  HomeSource Code DotNet ► C# ▼

Custom Windows

We create our own custom appearance user interfaces, witch we will find to be much more easy then we have ever expected.

 using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace customwindow
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private bool mouse_is_down = false;
        private Point mouse_pos;
        private void pictureBox2_Click(object sender, EventArgs e)
        {
            this.Close();
        }
        private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
        {
            mouse_is_down = true;
            mouse_pos.X = e.X;
            mouse_pos.Y = e.Y;
            pictureBox1.Image = new Bitmap("C:\\educationportal\\C#\\customwindow\\customwindow\\images\\0612061L.jpg");
            pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;
        }
        private void pictureBox1_MouseUp(object sender, MouseEventArgs e)
        {
            mouse_is_down = false;
        }

        private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
        {
            if (mouse_is_down)
            {
                Point current_pos = Control.MousePosition;
                current_pos.X = current_pos.X - mouse_pos.X;
                current_pos.Y = current_pos.Y - mouse_pos.Y;
                this.Location = current_pos;
            }
                    }

        private void Form1_Load(object sender, EventArgs e)
        {

        }
    }
}

 

SLogix Student Projects

⇓Student Projects⇓
⇑Student Projects⇑
bottom