Browse Source

Pull request #6128: REPORT-58717【主题切换】frm主题左侧预览效果调整

Merge in DESIGN/design from ~KERRY/design_10.0:feature/x to feature/x

* commit '14a14a7c27562fb965d5d07d028396916b2f2fda':
  REPORT-58717【主题切换】frm主题左侧预览效果调整
research/11.0
kerry 3 years ago
parent
commit
3c8b5026c9
  1. 27
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ComponentPreviewPane.java

27
designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ComponentPreviewPane.java

@ -31,6 +31,7 @@ import java.awt.Dimension;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Image; import java.awt.Image;
import java.awt.Insets;
import java.awt.RenderingHints; import java.awt.RenderingHints;
import java.awt.Shape; import java.awt.Shape;
import java.awt.Stroke; import java.awt.Stroke;
@ -99,7 +100,20 @@ public abstract class ComponentPreviewPane extends UINoOpaquePanel implements Th
Utils.clipByRoundBorder(g2d, getWidth(), getHeight(), roundedBorder.getRoundedCorner(), roundedBorder.getThickness()); Utils.clipByRoundBorder(g2d, getWidth(), getHeight(), roundedBorder.getRoundedCorner(), roundedBorder.getThickness());
} }
int titleHeight = titlePane == null ? 0 : titlePane.getHeight(); Border containerBorder = container.getBorder();
Insets insets = containerBorder.getBorderInsets(container);
int titleHeight = titlePane == null ? 0 : titlePane.getHeight() + insets.top;
//绘制标题背景
if (titlePane != null) {
Label data = titlePane.getData();
float opacity = data.getBackgroundOpacity();
Background background = data.getBackground();
if (background != null) {
Utils.paintBackground((Graphics2D) g, background, new Rectangle2D.Double(0, 0, getWidth(), titleHeight), opacity);
}
}
//绘制主体背景
Utils.paintBackground(g2d, style.getBackground(), new Rectangle2D.Double(0, titleHeight, getWidth(), getHeight() - titleHeight), style.getAlpha()); Utils.paintBackground(g2d, style.getBackground(), new Rectangle2D.Double(0, titleHeight, getWidth(), getHeight() - titleHeight), style.getAlpha());
Utils.paintBackground(g2d, style.getBorderImage(), new Rectangle2D.Double(0, 0, getWidth(), getHeight()), style.getBorderImageOpacity()); Utils.paintBackground(g2d, style.getBorderImage(), new Rectangle2D.Double(0, 0, getWidth(), getHeight()), style.getBorderImageOpacity());
@ -133,17 +147,14 @@ public abstract class ComponentPreviewPane extends UINoOpaquePanel implements Th
this.setBorder(new BottomLineBorder(componentStyle.getStyle().getColor(), componentStyle.getStyle().getBorder())); this.setBorder(new BottomLineBorder(componentStyle.getStyle().getColor(), componentStyle.getStyle().getBorder()));
} }
public Label getData(){
return data;
}
@Override @Override
public void paintComponent(Graphics g) { public void paintComponent(Graphics g) {
super.paintComponent(g); super.paintComponent(g);
Dimension size = getSize();
Background background = data.getBackground();
float opacity = data.getBackgroundOpacity();
if (background != null) {
Utils.paintBackground((Graphics2D) g, background, new Rectangle2D.Double(0, 0, size.getWidth(), size.getHeight()), opacity);
}
Graphics2D g2d = (Graphics2D) g.create(); Graphics2D g2d = (Graphics2D) g.create();
Background inset = data.getInsetImage(); Background inset = data.getInsetImage();
Image insetImage = inset instanceof ImageBackground ? ((ImageBackground) inset).getImage() : null; Image insetImage = inset instanceof ImageBackground ? ((ImageBackground) inset).getImage() : null;

Loading…
Cancel
Save