Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace GraphicsPictureHouse
- {
- public partial class Form1 : Form
- {
- private Graphics gScreen;
- private Graphics gBitmap;
- private Bitmap bitmap;
- private int zoom = 1;
- private bool mouseDown = false;
- private int xCentre = 300;
- private int yCentre = 300;
- private int xRoute = 0;
- private int yRoute = 0;
- int xStart;
- int yStart;
- public Form1()
- {
- InitializeComponent();
- gBitmap = this.CreateGraphics();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- gScreen = CreateGraphics();
- bitmap = new Bitmap(ClientRectangle.Width, ClientRectangle.Height);
- gBitmap = Graphics.FromImage(bitmap); //?
- }
- private void Form1_Paint(object sender, PaintEventArgs e)
- {
- MyClass.Draw(e.Graphics, Convert.ToInt32(numericUpDown.Value), zoom, xCentre+xRoute, yCentre+yRoute);
- gScreen.DrawImage(bitmap, ClientRectangle);
- }
- private void Mouse_Move(object sender, MouseEventArgs e)
- {
- this.Text = " " + e.X + " " + e.Y;
- if (mouseDown)
- {
- xRoute = xStart - xCentre;
- yStart = yStart - yCentre;
- this.Refresh();
- }
- }
- private void paint_Btn_Click(object sender, EventArgs e)
- {
- this.Refresh();
- }
- private void Mouse_Down(object sender, MouseEventArgs e)
- {
- mouseDown = true;
- xStart = e.X;
- yStart = e.X;
- }
- private void Mouse_Wheel(object sender, MouseEventArgs e)
- {
- zoom++;
- this.Refresh();
- }
- private void Mouse_Up(object sender, MouseEventArgs e)
- {
- mouseDown = false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement