rounded-corners

Non-pixelized rounded corner for top-level window

二次信任 提交于 2019-12-22 08:41:01
问题 I want to set rounded corners on a QDialog. Since it is a top-level window, border-radius doesn't work, so I've to do this : QRegion EnterPinDialog::roundedRect(const QRect& rect, int r) { QRegion region; // middle and borders region += rect.adjusted(r, 0, -r, 0); region += rect.adjusted(0, r, 0, -r); // top left QRect corner(rect.topLeft(), QSize(r*2, r*2)); region += QRegion(corner, QRegion::Ellipse); // top right corner.moveTopRight(rect.topRight()); region += QRegion(corner, QRegion:

How to set a 3D border for a JDialog with rounded corners?

淺唱寂寞╮ 提交于 2019-12-21 17:41:01
问题 I could add a rounded corner border to my JDialog as in How to create a rounded title border in Java Swing. But it is still one color. I want to make the border looks like 3D. Here is how I tried. Graphics2D g2d = (Graphics2D) g; Color c1 = getBackground(); Color c2 = color1.darker(); int w = getWidth(); int h = getHeight(); GradientPaint gp = new GradientPaint( 0, 0, c1, 0, h, c2); g2d.setPaint(gp); g2d.fill3DRect(0,0, w, h,true); Then, no 3D look, but the border has been widen more with its

smooth rounded corners in swing

ε祈祈猫儿з 提交于 2019-12-21 06:58:20
问题 I want to make smooth rounded corners for my swing application, but I can't get my desired result... here's the screenshots: 1. setShape() for JFrame : 2.overriding paintComponent() method for JPanel instead of using setShape() : 3. setBackground(new Color(0, 0, 0, 0)) for JFrame : well, but there's a problem with text quality: before step 3 : after step 3 : guys I'm confused, I've searched many times but nothing helped me... what should I do? please help me here's the full code : public

NSTextField with rounded corners?

[亡魂溺海] 提交于 2019-12-21 05:23:07
问题 I'm trying to draw rounded corners around an NSTextField. I've subclassed NSTextField , tried the code below, but without any result... Any ideas? - (void)drawRect:(NSRect)dirtyRect { // black outline NSRect blackOutlineFrame = NSMakeRect(0.0, 0.0, [self bounds].size.width, [self bounds].size.height-1.0); NSGradient *gradient = nil; if ([NSApp isActive]) { gradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithCalibratedWhite:0.24 alpha:1.0] endingColor:[NSColor

Rounded rect on NSView that clips all containing subviews

ε祈祈猫儿з 提交于 2019-12-20 17:41:12
问题 I am creating a NSView subclass that has rounded corners. This view is meant to be a container and other subviews will be added to it. I am trying to get the rounded corners of the NSView to clip all of the subview's corners as well, but am not able to get it. - (void)drawRect:(NSRect)dirtyRect { NSRect rect = [self bounds]; NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:rect xRadius:self.radius yRadius:self.radius]; [path addClip]; [[NSColor redColor] set]; NSRectFill(dirtyRect

Rounded rect on NSView that clips all containing subviews

百般思念 提交于 2019-12-20 17:40:03
问题 I am creating a NSView subclass that has rounded corners. This view is meant to be a container and other subviews will be added to it. I am trying to get the rounded corners of the NSView to clip all of the subview's corners as well, but am not able to get it. - (void)drawRect:(NSRect)dirtyRect { NSRect rect = [self bounds]; NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:rect xRadius:self.radius yRadius:self.radius]; [path addClip]; [[NSColor redColor] set]; NSRectFill(dirtyRect

Java - rounded corner panel with compositing in paintComponent

回眸只為那壹抹淺笑 提交于 2019-12-20 09:57:07
问题 From the original question (below), I am now offering a bounty for the following: An AlphaComposite based solution for rounded corners. Please demonstrate with a JPanel . Corners must be completely transparent. Must be able to support JPG painting, but still have rounded corners Must not use setClip (or any clipping) Must have decent performance Hopefully someone picks this up quick, it seems easy. I will also award the bounty if there is a well-explained reason why this can never be done,

Iphone Custom UITabBarItem without rounded edges

荒凉一梦 提交于 2019-12-20 08:51:50
问题 i try to customize a uitabbar i extended uitabbar item and now have a customized image in it but i cant get rid of the rounded edges. code: @interface CustomTabBarItem : UITabBarItem { UIImage *customHighlightedImage; } @property (nonatomic, retain) UIImage *customHighlightedImage; @end @implementation CustomTabBarItem @synthesize customHighlightedImage; - (void) dealloc { [customHighlightedImage release]; customHighlightedImage=nil; [super dealloc]; } -(UIImage *) selectedImage { return self

How can I remove a UIView with rounded corners from its parent view?

删除回忆录丶 提交于 2019-12-20 04:20:37
问题 I'm creating an iPad app for 3.2 and later. My app has an overlay view which has a semi-transparency that makes everything below it darker. In the middle of this view I am chopping a hole in this semi-transparency to let part of the background filter through unscathed, with this code: - (void)drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentContext(); CGRect intersection = CGRectIntersection(hole.frame, rect); CGContextClearRect(context, intersection); } Additionally, the

How to make a rounded oval button?

流过昼夜 提交于 2019-12-20 03:23:04
问题 My goal is to make my button look like this: minus the black edges around the button. After reading quite a few posts, I see most solutions saying to use layer.cornerRadius = 10.0 When I do that I get this: It rounds the edges, but doesn't give me my desired goal. Any suggestion? 回答1: Swift 3 myButton.layer.cornerRadius = myButton.frame.height / 2 myButton.backgroundColor = UIColor.blue myButton.clipsToBounds = true myButton.tintColor = UIColor.white myButton.setTitle("Connect With Facebook",