private CustomPopupPlacement[] PopupPlacementCallback(Size popupSize, Size targetSize, Point offset)
        {
            var dpi = this.systemDpi ?? (this.systemDpi = this.GetSystemDpi()) ?? Dpi.Default;
            return new[]
			{
				new CustomPopupPlacement(new Point(offset.X * dpi.ScaleX, offset.Y* dpi.ScaleY), PopupPrimaryAxis.None),
			};
        }
Beispiel #2
0
        public void Update()
        {
            if (this.WebBrowser == null)
            {
                return;
            }

            var dpi        = this.systemDpi ?? (this.systemDpi = this.GetSystemDpi()) ?? Dpi.Default;
            var zoomFactor = dpi.ScaleX + (this.ZoomFactor - 1.0);
            var percentage = (int)(zoomFactor * 100);

            ApplyZoomFactor(this.WebBrowser, percentage);

            var size = this.styleSheetApplied ? KanColleSize : InitialSize;

            size = new Size(
                (size.Width * (zoomFactor / dpi.ScaleX)) / dpi.ScaleX,
                (size.Height * (zoomFactor / dpi.ScaleY)) / dpi.ScaleY);
            this.WebBrowser.Width  = size.Width;
            this.WebBrowser.Height = size.Height;

            this.OwnerSizeChangeRequested?.Invoke(this, size);
        }
        public void Update()
        {
            if (this.WebBrowser == null)
            {
                return;
            }

            var dpi        = this.systemDpi ?? (this.systemDpi = this.GetSystemDpi()) ?? Dpi.Default;
            var zoomFactor = dpi.ScaleX + (this.ZoomFactor - 1.0);
            var percentage = (int)(zoomFactor * 100);

            ApplyZoomFactor(this.WebBrowser, percentage);

            if (this.styleSheetApplied)
            {
                this.WebBrowser.Width  = (kanColleSize.Width * (zoomFactor / dpi.ScaleX)) / dpi.ScaleX;
                this.WebBrowser.Height = (kanColleSize.Height * (zoomFactor / dpi.ScaleY)) / dpi.ScaleY;
                this.MinWidth          = this.WebBrowser.Width;
                this.MinHeight         = this.WebBrowser.Height;
            }
            else
            {
                if (KCVSettings.Current.Orientation.Mode == Orientation.Vertical)
                {
                    this.WebBrowser.Width  = double.NaN;
                    this.WebBrowser.Height = (browserSize.Height * (zoomFactor / dpi.ScaleY)) / dpi.ScaleY;
                }
                else
                {
                    this.WebBrowser.Width  = (browserSize.Width * (zoomFactor / dpi.ScaleX)) / dpi.ScaleX;
                    this.WebBrowser.Height = double.NaN;
                }
                this.MinWidth  = (browserSize.Width * (zoomFactor / dpi.ScaleX)) / dpi.ScaleX;
                this.MinHeight = (browserSize.Height * (zoomFactor / dpi.ScaleX)) / dpi.ScaleX;
            }
        }
Beispiel #4
0
        public void Update()
        {
            if (this.WebBrowser == null) return;

            var dpi = this.systemDpi ?? (this.systemDpi = this.GetSystemDpi()) ?? Dpi.Default;
            var zoomFactor = dpi.ScaleX + (this.ZoomFactor - 1.0);
            var percentage = (int)(zoomFactor * 100);

            ApplyZoomFactor(this.WebBrowser, percentage);

            if (this.styleSheetApplied)
            {
                this.WebBrowser.Width = (kanColleSize.Width * (zoomFactor / dpi.ScaleX)) / dpi.ScaleX;
                this.WebBrowser.Height = (kanColleSize.Height * (zoomFactor / dpi.ScaleY)) / dpi.ScaleY;
                this.MinWidth = this.WebBrowser.Width;
            }
            else
            {
                this.WebBrowser.Width = double.NaN;
                this.WebBrowser.Height = (browserSize.Height * (zoomFactor / dpi.ScaleY)) / dpi.ScaleY;
                this.MinWidth = (browserSize.Width * (zoomFactor / dpi.ScaleX)) / dpi.ScaleX;
            }
        }
Beispiel #5
0
		public void Update()
		{
			if (this.WebBrowser == null) return;

			var dpi = this.systemDpi ?? (this.systemDpi = this.GetSystemDpi()) ?? Dpi.Default;
			var zoomFactor = dpi.ScaleX + (this.ZoomFactor - 1.0);
			var percentage = (int)(zoomFactor * 100);

			ApplyZoomFactor(this.WebBrowser, percentage);

			var size = this.styleSheetApplied ? KanColleSize : InitialSize;
			size = new Size(
				(size.Width * (zoomFactor / dpi.ScaleX)) / dpi.ScaleX,
				(size.Height * (zoomFactor / dpi.ScaleY)) / dpi.ScaleY);
			this.WebBrowser.Width = size.Width;
			this.WebBrowser.Height = size.Height;

			this.OwnerSizeChangeRequested?.Invoke(this, size);
		}
Beispiel #6
0
		private void UpdateCore()
		{
			if (this.ownerHandle == IntPtr.Zero)
			{
				this.ownerHandle = new WindowInteropHelper(this.owner).Handle;
			}

			this.IsGlowing = this.owner.IsActive;

			var dpi = systemDpi ?? (systemDpi = this.GetSystemDpi()) ?? Dpi.Default;
			var left = (int)Math.Round(this.processor.GetLeft(this.owner.Left, this.owner.ActualWidth) * dpi.ScaleX);
			var top = (int)Math.Round(this.processor.GetTop(this.owner.Top, this.owner.ActualHeight) * dpi.ScaleY);
			var width = (int)Math.Round(this.processor.GetWidth(this.owner.Left, this.owner.ActualWidth) * dpi.ScaleX);
			var height = (int)Math.Round(this.processor.GetHeight(this.owner.Top, this.owner.ActualHeight) * dpi.ScaleY);

			NativeMethods.SetWindowPos(this.handle, this.ownerHandle, left, top, width, height, SWP.NOACTIVATE);
		}