From 1b42276edf338ca8c89b4b66b77c97e54dc1b519 Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 16 Nov 2021 12:02:26 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-62653=20=E3=80=90=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=8F=AF=E6=9B=B4=E6=96=B0=E6=8F=90=E9=86=92=E3=80=91=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=A4=8D=E7=94=A8-=E7=BB=84=E4=BB=B6=E4=B8=8A?= =?UTF-8?q?=E2=80=9C=E7=89=88=E6=9C=AC=E4=B8=8D=E5=85=BC=E5=AE=B9=E2=80=9D?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E6=96=87=E5=AD=97=E4=B8=8D=E6=98=8E=E6=98=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 修改提示文字背景及字体 【改动思路】 同上 --- .../mainframe/share/ui/block/LocalWidgetBlock.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java index 4846468d6..72eb35d00 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.share.ui.block; +import com.fr.base.FRContext; import com.fr.base.GraphHelper; import com.fr.base.iofile.attr.SharableAttrMark; import com.fr.design.base.mode.DesignModeContext; @@ -59,6 +60,7 @@ import java.awt.dnd.DnDConstants; import java.awt.event.ActionEvent; import java.awt.event.MouseEvent; import java.awt.font.FontRenderContext; +import java.awt.font.LineMetrics; import java.awt.geom.Dimension2D; import java.awt.image.BufferedImage; import java.util.UUID; @@ -298,17 +300,17 @@ public class LocalWidgetBlock extends PreviewWidgetBlock double canvasH = coverDim.getHeight(); g2d.setColor(new Color(0.0F, 0.0F, 0.0F, 0.4F)); - GraphHelper.fillRect(g2d, canvasX, canvasY, canvasW, canvasH - 16); + GraphHelper.fillRect(g2d, canvasX, canvasY, canvasW, canvasH); g2d.setColor(new Color(0.0F, 0.0F, 0.0F, 0.5F)); GraphHelper.fillRect(g2d, canvasX, canvasH - 16, canvasW, 16); String tipText = Toolkit.i18nText("Fine-Design_Share_Incompatible_Version_Tip"); - Font tipFont = FRFont.getInstance().deriveFont(8F); + Font tipFont = FRContext.getDefaultValues().getFRFont().deriveFont(8.0F); FontRenderContext frc = g2d.getFontRenderContext(); double tipTextWidth = GraphHelper.stringWidth(tipText, tipFont, frc); - Dimension2D dim = GraphHelper.stringDimensionWithRotation(tipText, tipFont, 0, frc); - double tipTextHeight = dim.getHeight(); + LineMetrics metrics = tipFont.getLineMetrics(tipText, frc); + double tipTextHeight = metrics.getHeight(); g2d.setColor(Color.WHITE); g2d.setFont(tipFont); GraphHelper.drawString(g2d, tipText, canvasX + (canvasW - tipTextWidth) / 2.0F, canvasY + canvasH - (16 - tipTextHeight) / 2.0F);