Hello,
I wanted to open a new window form, exactly near another form. (pinning one form to another).
Because of the border difference among Windows XP, Vista and Windows7 (win7), it didn't work easily.
So to determine windows size under win7/vista, I had to check if Windows Aero. (checking made by short&easy code)
Now, after checking this, I had to also support winXP (which does not have AERO technology).
For finding the left and right window border size (width) I used the SystemInformation Class which provides information about the current system environment.
Note:
I recommend to check if it works for other FormBorderStyle.
The code:
Best regard,
MDB Blog
I wanted to open a new window form, exactly near another form. (pinning one form to another).
Because of the border difference among Windows XP, Vista and Windows7 (win7), it didn't work easily.
So to determine windows size under win7/vista, I had to check if Windows Aero. (checking made by short&easy code)
Now, after checking this, I had to also support winXP (which does not have AERO technology).
For finding the left and right window border size (width) I used the SystemInformation Class which provides information about the current system environment.
Note:
I recommend to check if it works for other FormBorderStyle.
The code:
internal static bool IsAeroEnabled()
{
bool isEnabled = false;
if (Environment.OSVersion.Version.Major >= 6)
{
try
{
DwmIsCompositionEnabled(out isEnabled);
}
catch (Exception ex)
{
Logger.WriteLog(ex);
}
}
return isEnabled;
}
[DllImport("dwmapi.dll")]
internal static extern int DwmIsCompositionEnabled(out bool enabled);
{
bool isEnabled = false;
if (Environment.OSVersion.Version.Major >= 6)
{
try
{
DwmIsCompositionEnabled(out isEnabled);
}
catch (Exception ex)
{
Logger.WriteLog(ex);
}
}
return isEnabled;
}
[DllImport("dwmapi.dll")]
internal static extern int DwmIsCompositionEnabled(out bool enabled);
Best regard,
MDB Blog