当前位置: 首页>>代码示例>>C#>>正文


C# MainForm.ComputeHeightFromWidth方法代码示例

本文整理汇总了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();
            }
        }
开发者ID:Hiale,项目名称:ontopreplica,代码行数:79,代码来源:Options.cs


注:本文中的MainForm.ComputeHeightFromWidth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。