本文整理汇总了C#中MainForm.ComputeHeightFromWidth方法的典型用法代码示例。如果您正苦于以下问题:C# MainForm.ComputeHeightFromWidth方法的具体用法?C# MainForm.ComputeHeightFromWidth怎么用?C# MainForm.ComputeHeightFromWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MainForm
的用法示例。
在下文中一共展示了MainForm.ComputeHeightFromWidth方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Apply
public void Apply(MainForm form)
{
Log.Write("Applying command line launch parameters");
form.Opacity = (double)Opacity / 255.0;
//Seek handle for thumbnail cloning
WindowHandle handle = null;
if (WindowId.HasValue) {
handle = WindowHandle.FromHandle(WindowId.Value);
}
else if (WindowTitle != null) {
var seeker = new ByTitleWindowSeeker(WindowTitle) {
OwnerHandle = form.Handle,
SkipNotVisibleWindows = MustBeVisible
};
seeker.Refresh();
handle = seeker.Windows.FirstOrDefault();
}
else if (WindowClass != null) {
var seeker = new ByClassWindowSeeker(WindowClass) {
OwnerHandle = form.Handle,
SkipNotVisibleWindows = MustBeVisible
};
seeker.Refresh();
handle = seeker.Windows.FirstOrDefault();
}
if (StartPositionLock.HasValue) {
form.PositionLock = StartPositionLock.Value;
}
//Clone any found handle (this applies thumbnail and aspect ratio)
if (handle != null) {
form.SetThumbnail(handle, Region);
}
//Adaptive size handling
if (!StartSize.HasValue && (StartWidth.HasValue || StartHeight.HasValue)) {
if (StartWidth.HasValue) {
StartSize = new Size(StartWidth.Value, form.ComputeHeightFromWidth(StartWidth.Value));
}
else {
StartSize = new Size(form.ComputeWidthFromHeight(StartHeight.Value), StartHeight.Value);
}
}
//Size and location start values
if (StartLocation.HasValue && StartSize.HasValue) {
form.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
form.Location = StartLocation.Value;
form.ClientSize = StartSize.Value;
}
else if (StartLocation.HasValue) {
form.StartPosition = System.Windows.Forms.FormStartPosition.WindowsDefaultBounds;
form.Location = StartLocation.Value;
}
else if (StartSize.HasValue) {
form.StartPosition = System.Windows.Forms.FormStartPosition.WindowsDefaultLocation;
form.ClientSize = StartSize.Value;
}
//Other features
if (EnableClickForwarding) {
form.ClickForwardingEnabled = true;
}
if (EnableClickThrough) {
form.ClickThroughEnabled = true;
}
form.IsChromeVisible = !DisableChrome;
//Fullscreen
if (Fullscreen) {
form.FullscreenManager.SwitchFullscreen();
}
}