对话框图形的部署在GMS3中是否已更改? [英] Has deployment of dialog graphics changed in GMS3?

查看:84
本文介绍了对话框图形的部署在GMS3中是否已更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在DM对话框中广泛使用了图形元素,主要用于视觉反馈.尽管我已经在GMS1和GMS2中成功使用了这些功能,但是我还没有使它们在GMS3中正确运行.我想知道我是否在错误地部署它们.下面的示例脚本说明了我的两个主要问题,即图形元素的大小与其关联的位图之间的不匹配,以及位图值为240或RGB(240,240,240)的奇怪的对比度映射(到黑色):

I make extensive use of graphic elements in DM dialogs, mainly for visual feedback. Although I have used these successfully in GMS1 and GMS2, I have not yet gotten these to behave correctly in GMS3. I wonder whether I am deploying them incorrectly. The example script below illustrates my two main problems, a mismatch between the size of the graphic element and its associated bit map, and a strange contrast mapping (to black) for bit map values of 240 or RGB(240, 240, 240):

    class ModelessDialogWithGraphic : UIFrame
    {
        Object Init(Object self)
        {
            TagGroup dialogSpec = DLGCreateDialog("");
            TagGroup dialogItems = dialogSpec.DLGGetItems();

            Number graphicW = 256;
            Number graphicH = graphicW / 4;
            Image graphicImage := RealImage("Graphic Image", 4, graphicW, graphicH);
            graphicImage = icol;

            // Add labeled box with graphic
            TagGroup boxSpec = DLGCreateBox("Graphic");
            TagGroup boxItems = boxSpec.DLGGetItems();
            TagGroup graphicSpec = DLGCreateGraphic(graphicW, graphicH);
            graphicSpec.DLGAddBitMap(graphicImage);
            boxItems.DLGAddElement(graphicSpec);
            dialogItems.DLGAddElement(boxSpec);

            return self.super.Init(dialogSpec);
        }
    }

    void main()
    {
        Object dialog = Alloc(ModelessDialogWithGraphic).Init();
        dialog.Display("Dialog Graphic Test");
    }

    main();

至少在GMS 3.4中,位图似乎仅填充指定图形区域的左上角四分之一.但是,此问题很复杂,因为我观察到的行为似乎随着Windows显示缩放选项和特定版本的Windows而改变.目前,借助GMS 3.4和最新的Win10更新,我发现以下更改的Init方法提供了可服务的(尽管很丑)的解决方法:

At least in GMS 3.4, the bitmap seems only to fill the top-left quarter of the specified graphic area. However, this issue is complicated because the behavior I observe seems to change with the Windows display scaling option and the particular version of Windows. For now, with GMS 3.4 and the latest Win10 update, I have found the following altered Init method provides serviceable (though ugly) workarounds:

        Object Init(Object self)
        {
            TagGroup dialogSpec = DLGCreateDialog("");
            TagGroup dialogItems = dialogSpec.DLGGetItems();

            Number graphicW = 256;
            Number graphicH = graphicW / 4;
            Image graphicImage := RealImage("Graphic Image", 4, graphicW, graphicH);
            graphicImage = icol;
            graphicImage = (graphicImage == 240) ? 241 : graphicImage

            // Add labeled box with graphic
            Number scaler = 0.5;
            TagGroup boxSpec = DLGCreateBox("Graphic");
            TagGroup boxItems = boxSpec.DLGGetItems();
            TagGroup graphicSpec = DLGCreateGraphic(scaler * graphicW, scaler * graphicH);
            graphicSpec.DLGAddBitMap(graphicImage);
            boxItems.DLGAddElement(graphicSpec);
            dialogItems.DLGAddElement(boxSpec);

            return self.super.Init(dialogSpec);
        }

但是,我担心这些变通办法可能会在将来的GMS版本中中断.有没有人找到更好或更正确的方法来在GMS3中部署对话框图形?

I'm concerned, however, that these workarounds may break in a future GMS release. Has anyone found a better or more correct way to deploy dialog graphics in GMS3?

推荐答案

应用程序的Windows10 dpi缩放比例确实导致了许多错误绘制UI的问题.其中一些要求更改dpi后重新启动应用程序,但其中一些是永久性的".

Windows10 dpi scaling for applications is indeed causing a lot of misdrawing UI issues. Some of these require an application restart after dpi change, but some of them are 'permanent'.

我认为您提到的两个问题是应在Gatan 软件上报告的错误.问题报告网站.

I would consider the two issues you've mentioned to be bugs which should be reported at the Gatan software issue reporting site.

您的静态缩放"解决方案确实太脆弱了,因为需要为不同的显示dpi设置确定缩放的确切值.我不知道脚本命令可以在现阶段使您了解此信息.

Your static 'scaling' fix is indeed too fragile as the exact value for scale needs to be determined for different display dpi settings. I'm not aware of a script command which could get you to this information at this stage.

关于透明的颜色替换:如果我不得不猜,那么一直都是这样,但是确切的颜色代表了GMS 2中的背景色,而不再是GMS 3中的背景色.可能也是对GMS 3版本的疏忽/错误,应该报告.

As for the color-replacement to transparent: If I would have to guess, then this has always been like that but the exact color represented the background-color in GMS 2 whereas it no longer does in GMS 3. So it is likely also an oversight/bug of the GMS 3 version and should be reported.

这篇关于对话框图形的部署在GMS3中是否已更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆