I created a simple windows Form project. the Form is named Form1 with a Button named button1. I put simple test to see how ControlPaint.DrawReversibleFrame() behaves:
if I removed the first statement, consequent frame will not be erased. please help me understand how this reversible Frame works:
ControlPaint.DrawReversibleFrame(rectangle1, SystemColors.Highlight, FrameStyle.Thick);
here is the code:
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 DrawReversibleDemo01
{
public partial class Form1 : Form
{
private Rectangle rectangle1 = new Rectangle(70, 70, 100, 150);
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Rectangle screenRectangle = Screen.PrimaryScreen.Bounds;
if (screenRectangle.Contains(rectangle1))
{
ControlPaint.DrawReversibleFrame(rectangle1, SystemColors.Highlight, FrameStyle.Thick);
rectangle1.Offset(20, 20);
ControlPaint.DrawReversibleFrame(rectangle1, SystemColors.Highlight, FrameStyle.Thick);
}
}
}
}
What I have tried:
tried many demos and still did not get firm grip on this method. I feel I missed a critical point somewhere.