7

Try to understand the behaviour of controlpaint.drawreversibleframe() method

 2 years ago
source link: https://www.codeproject.com/Questions/5333415/Try-to-understand-the-behaviour-of-controlpaint-dr
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

See more:

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:

Copy Code
ControlPaint.DrawReversibleFrame(rectangle1, SystemColors.Highlight, FrameStyle.Thick);



here is the code:

Expand ▼   Copy 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); //<=== if I removed this statement, no frame is erased
                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.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK