How can I Invalidate just one section? I should only draw mål.Rita once. And then redraw sikte.Rita with onmousemove(). Thanks for help ![:)]()
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Måltavla
{
public partial class Form1 : Form
{
Måltavla mål;
Sikte sikte;
public Form1()
{
InitializeComponent();
mål = new Måltavla(ClientSize.Width / 2, ClientSize.Height / 2, 200);
sikte = new Sikte(ClientSize.Width / 2, ClientSize.Height / 2, 50);
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
mål.Rita(e.Graphics);
sikte.Rita(e.Graphics);
}
protected override void onmousemove(MouseEventArgs e)
{
base.onmousemove(e);
sikte.X = e.X;
sikte.Y = e.Y;
Invalidate(); //
}
}
}