c# - How to change Rectanlge Left/Top/Right/Bottom -


i have 2 rectangles innerrectangle , outerrectangle. want verify if 4 corners of innerrectangle i.e, lett, top, right, bottom inside of outerrectangle. if outside want change ones outside. if change left/top/right/bottom, how should change width or height? please let me know how implement this.

if (innerrectangle.left < outerrectangle.left) {     // should put here } if (innerrectangle.top < outerrectangle.top) {     // should put here } if (innerrectangle.right < outerrectangle.right) {     // should put here } if (innerrectangle.bottom < outerrectangle.bottom) {     // should put here } 

appreciate help..

to check whether rectangle innerrectangle contained inside outerrectangle:

if (outerrectangle.contains(innerrectangle)) {     // ... } 

to fix innerrectangle inside outerrectangle:

innerrectangle = innerrectangle.intersect(outerrectangle); 

Comments

Popular posts from this blog

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

c++ - Convert big endian to little endian when reading from a binary file -

openssl - Load PKCS#8 binary key into Ruby -