简体   繁体   English

自动调整图像大小以适合Visual Studio中的屏幕分辨率

[英]Automatically re-size images to fit screen resolution in Visual Studio

I am designing a welcome screen for a desktop application using forms in Visual Studio 2005. I have run into a bit of a problem with the splash image. 我正在使用Visual Studio 2005中的表单设计用于桌面应用程序的欢迎屏幕。我在启动图像方面遇到了一些问题。 I'd like it to automatically re-size according to the screen resolution of the user. 我希望它能够根据用户的屏幕分辨率自动调整大小。 As it stands I have a source image at a high resolution that I have been shrinking in Photoshop to fit the form design window, but when I build and run the application the image is tiny compared to my screen (1920 x 1080). 就目前而言,我有一个高分辨率的源图像,在Photoshop中我一直在缩小它以适合表单设计窗口,但是当我构建并运行该应用程序时,与我的屏幕(1920 x 1080)相比,该图像很小。 Right now it is placed inside a panel. 现在,它已放置在面板中。 I tried messing around with the AutoSize options but that didn't do much. 我试着弄乱了AutoSize选项,但是并没有做太多事情。

The question: How can I set the image to automatically re-size according to the screen resolution of the end user? 问题:如何设置图像以根据最终用户的屏幕分辨率自动调整大小?

The picturebox already has this feature. 图片框已具有此功能。 Load the picture and set the property SizeMode. 加载图片并设置属性SizeMode。

        // correct proportions
            pictureBox1.SizeMode = PictureBoxSizeMode.Zoom; 
        // or
        // larger, but distorted
        pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;

in code or via the property window and the image will fill the complete picturebox. 通过代码或通过属性窗口,图像将填充完整的图片框。 Set the height/width of the picturebox to scale the image like so: 设置图片框的高度/宽度以缩放图像,如下所示:

            pictureBox1.Width = Screen.FromControl(this).WorkingArea.Width / 3;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将Windows窗体适合/重新调整为任何屏幕分辨率? - How do I fit/re-size Windows Form to any screen resolution? 如何在不损失分辨率的情况下重新调整QRCode图像的大小? - How to re-size QRCode image without losing resolution? Visual Studio 设计器中的表单大小是否受限于屏幕分辨率? - Is the size of a Form in Visual Studio designer limited to screen resolution? 需要将较低分辨率的图像“拉伸”到屏幕尺寸 - Need images with lower resolution “stretched” to screen size WPF在运行时重新调整边框大小 - WPF re-size border at runtime 在窗口WPF中调整页面大小 - Re-size page inside window WPF CreateGraphics():图形仅在调整大小时显示 - CreateGraphics(): Graphics is shown only on re-size 为了获得最佳效果,您是否应该重新调整图像大小然后对其进行压缩,还是应该对其进行压缩然后重新调整大小? - For best results, should you re-size an image and then compress it or should you compress it and then re-size it? 如何使Windows窗体适合任何屏幕分辨率,以及如何使我的图像大小适合窗体 - How to fit windows form to any screen resolution and how to made my image size fit to form 调整大小并添加水印后控制图像文件的大小 - Control the image file size after re-size and add watermark
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM