Hello!
I have a tryed from several days to solve my problem but without any result, so will ask here.
I have creage a graphic object and draw on it some shapes, like lines, rectangles etc.
I do not write any code in the Paint event and all code is just in the MouseUp, Down and Move Events.
-=The problem is=-
When i move, minimize, resize the picture, a partfrom the graphic is erased...
The same efect is when a window is on top of the program..
Here i will give you the code from my events to see what i'm doing for a line object:
----------------------------------------------------------
<pre lang="xml">
private void pbx_MouseDown(object sender, MouseEventArgs e)
{
PenList.Color = MainForm.btnColor1.BackColor;
PenList.Width = float.Parse(MainForm.tbxSize.Text);
StartPoint = e.Location;
EndPoint = StartPoint;
MouseIsDown = true;
}
----------------------------------------------------------
private void pbx_MouseMove(object sender, MouseEventArgs e)
{
EndPoint = e.Location;
PenList.Color = MainForm.btnColor1.BackColor;
PenList.Width = float.Parse(MainForm.tbxSize.Text);
if (e.Button == MouseButtons.Left)
{
if (MainForm.btnLine.Checked && MouseIsDown == true)
{
ControlPaint.DrawReversibleLine(Picture.PointToScreen(StartPoint), Picture.PointToScreen(EndPoint), Color.Black);
EndPoint = new Point(e.X, e.Y);
ControlPaint.DrawReversibleLine(Picture.PointToScreen(StartPoint), Picture.PointToScreen(EndPoint), Color.Black);
}
}
----------------------------------------------------------
private void pbx_MouseUp(object sender, MouseEventArgs e)
{
MouseIsDown = false;
EndPoint = e.Location;
PenList = MainForm.CustomPen;
PenList.Color = MainForm.btnColor1.BackColor;
PenList.Width = float.Parse(MainForm.tbxSize.Text);
if (MainForm.btnLine.Checked)
{
Graphic.DrawLine(PenList, StartPoint, EndPoint);
}
}
Thanks.