public Size ClientSize {
get {
return new Size(clientWidth, clientHeight);
}
set {
SetClientSizeCore(value.Width, value.Height);
}
}
protected virtual void SetClientSizeCore(int x, int y) {
Size = SizeFromClientSize(x, y);
clientWidth = x;
clientHeight = y;
OnClientSizeChanged(EventArgs.Empty);
}
internal Size SizeFromClientSize(int width, int height) {
NativeMethods.RECT rect = new NativeMethods.RECT(0, 0, width, height);
CreateParams cp = CreateParams;
SafeNativeMethods.AdjustWindowRectEx(ref rect, cp.Style, HasMenu, cp.ExStyle);
return rect.Size;
}
ICAgIHB1YmxpYyBTaXplIENsaWVudFNpemUgewogICAgICAgIGdldCB7CiAgICAgICAgICAgIHJldHVybiBuZXcgU2l6ZShjbGllbnRXaWR0aCwgY2xpZW50SGVpZ2h0KTsKICAgICAgICB9CgogICAgICAgIHNldCB7CiAgICAgICAgICAgIFNldENsaWVudFNpemVDb3JlKHZhbHVlLldpZHRoLCB2YWx1ZS5IZWlnaHQpOwogICAgICAgIH0KICAgIH0KCiAgICBwcm90ZWN0ZWQgdmlydHVhbCB2b2lkIFNldENsaWVudFNpemVDb3JlKGludCB4LCBpbnQgeSkgewogICAgICAgIFNpemUgPSBTaXplRnJvbUNsaWVudFNpemUoeCwgeSk7CiAgICAgICAgY2xpZW50V2lkdGggPSB4OwogICAgICAgIGNsaWVudEhlaWdodCA9IHk7CiAgICAgICAgT25DbGllbnRTaXplQ2hhbmdlZChFdmVudEFyZ3MuRW1wdHkpOwogICAgfQoKICAgIGludGVybmFsIFNpemUgU2l6ZUZyb21DbGllbnRTaXplKGludCB3aWR0aCwgaW50IGhlaWdodCkgewogICAgICAgIE5hdGl2ZU1ldGhvZHMuUkVDVCByZWN0ID0gbmV3IE5hdGl2ZU1ldGhvZHMuUkVDVCgwLCAwLCB3aWR0aCwgaGVpZ2h0KTsKICAgICAgICBDcmVhdGVQYXJhbXMgY3AgPSBDcmVhdGVQYXJhbXM7CiAgICAgICAgU2FmZU5hdGl2ZU1ldGhvZHMuQWRqdXN0V2luZG93UmVjdEV4KHJlZiByZWN0LCBjcC5TdHlsZSwgSGFzTWVudSwgY3AuRXhTdHlsZSk7CiAgICAgICAgcmV0dXJuIHJlY3QuU2l6ZTsKICAgIH0K
prog.cs(1,11): error CS1525: Unexpected symbol `Size', expecting `class', `delegate', `enum', `interface', `partial', or `struct'
prog.cs(3,20): error CS1530: Keyword `new' is not allowed on namespace elements
prog.cs(3,23): error CS1525: Unexpected symbol `Size', expecting `class', `delegate', `enum', `interface', `partial', or `struct'
prog.cs(11,22): error CS1525: Unexpected symbol `void', expecting `class', `delegate', `enum', `interface', `partial', or `struct'
prog.cs(18,13): error CS1525: Unexpected symbol `Size', expecting `class', `delegate', `enum', `interface', `partial', or `struct'
prog.cs(19,35): error CS1530: Keyword `new' is not allowed on namespace elements
prog.cs(19,38): error CS1525: Unexpected symbol `NativeMethods', expecting `class', `delegate', `enum', `interface', `partial', or `struct'
Compilation failed: 7 error(s), 0 warnings