The CSS (www.bkjia.com) Tutorial CSS creates a DIV border with three-dimensional rounded corners. It does not use any modified image. It feels cool. If you are not satisfied with the color, you can change it by yourself, however, pay attention to the color difference, or else the effect is not ideal. In fact, webpage loading is very fast without images, but CSs definition is a little troublesome.
Tip: the code can be modified before running!
In the daily surfing of the internet, we often see some rounded border, which usually needs to be implemented using images, so can we use pure CSS to design the rounded corner of the table border? Actually, it is okay. Let's take a look at the examples of CSS rounded corners:
Tip: the code can be modified before running!
Fillet button ImplementationRounded buttons are very common, and sometimes you may use PS to process rounded pictures to achieve the desired effect .This effect is achieved today with a short code. (because it has nothing to do with engineering, it's just an effect, so I'm going to write a single XML file to do a simple demo)1. Create an XML file under Layout with the name a2. Drag a button directly from the project (left-click, drag directly to the white area) or write a button yourself in t
axes, and two parameters are the radius of the x-axis and y-axis respectively. You can set the parameters according to different needs.Second, draw the window border in the PaintEvent eventHere we need to rewrite the PaintEvent method with the following code:void PaintEvent (Qpaintevent *event) {qpainter painter (this); Painter. Setrenderhint (qpainter::antialiasing); Anti-aliasing; Painter. Setbrush (Qbrush (qt::red)); Painter. Setpen (Qt::transparent); Qrect rect = This->rect (); Rect. Set
-(Void) drawrect :( cgrect) rect {// draw a box with rounded corners to fill the view-uibezierpath * roundedrect = [uibezierpath bezierpathwithroundedrect: Self. bounds cornerradius: 5.0f]; [[uicolor colorwithwhite: 0.8 ALPHA: 0.5] setfill]; [roundedrect fillwithblendmode: kcgblendmodenormal ALPHA: 1];}
The uibezierpath object is an encapsulation of the cgpathref data type. If the path is vector-based, it is created using straight lines and curve s
Set the background color of a rounded corner for a view. We usually use the XML file and the
Effect:
First, create activity_main.xml
Mainactivity. Java
Public class mainactivity extends activity {private gridview gdview; private context mcontext; @ overrideprotected void oncreate (bundle savedinstancestate) {super. oncreate (savedinstancestate); setcontentview (R. layout. activity_main); mcontext = mainactivity. this; gdview = (gridview) findviewbyid (R. id. gv_gridview); initdate ();} pri
rounded rectangle is ready. If you are in trouble, you can also directly select a selection area (first select a rectangle smaller than the boundary, and then move it to the boundary with the up and down arrow keys ).
5.-method 2-create an RGB file [200 width * 200 height], click the channel label, create a channel (channel1), create a rectangular selection area on channel1, and fill it in white.
6. The larger the filter> blur> Gaussian blue value is, the smoother the
cgrect Picture Path * * @return fillet size*/[[Uibezierpath bezierPathWithRoundedRect:imageView.bounds cornerRadius:imageView.frame.size.width] addclip]; [ImageView DrawRect:imageView.bounds]; Imageview.image=Uigraphicsgetimagefromcurrentimagecontext (); //Finish DrawingUigraphicsendimagecontext (); [Self.view Addsubview:imageview];//the third Way to fillet: (use Cashapelayer and Uibezierpath) to set the fillet Note: This method consumes less memory and renders faster.//First Import fram
The most straightforward approach is to use the following property settings:
123
imgView.layer.cornerRadius=10;//这一行代码是很消耗性能的imgView.clipsToBounds=YES;
* * This is off-screen rendering (off-screen-rendering), consumption performance * *
Add an extension API to UIImage to create rounded pictures: This is on-screen-rendering
123456789101112131415
- (uiimage*) Imagewithcornerradius: (cgfloat) radius{ cgrectrect= (cgrect) {0.f,0.
-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px; This example is just for the tag to work with Mozilla-based browsers such as Mozilla Firefox and Webkit-based (such as Apple Safari). If you prefer, you can set the above 3 properties to different values and have the styles show different effects in Firefox and Google Chrome. You can also create a shadow on the -webkit-box-shadow:8px 8px 6px #AAAAAA,-moz-box-shadow:8px 8px 6px #AAAAAA, box-shadow:8px 8px 6px #AAAAAA; in this
(Chrome):
Actual effect (please use a browser that supports CSS3):This example is the CSS3 implementation div fillet. The CSS3 code sentence that implements the fillet is: "border-radius:20px;". Use a browser that supports CSS3, such as a new version of Chrome, Firefox, or IE9. IE6, 7, 8 are not supported.Blog Park Planning CSS3 TutorialJihua.cnblogs.comDiv rounded Corners
UIButton*meifubutton = [UIButtonButtonwithtype:Uibuttontypesystem];[MeifubuttonSettitle:@"Share to Skin beauty"Forstate:UIControlStateNormal];[MeifubuttonSettitlecolor:RedselectcoloreForstate:UIControlStateNormal];Meifubutton.Frame=CGRectMake(Screen_width-100,20,90,25);Meifubutton.Layer.Cornerradius=8;//Set radiusMeifubutton.Layer.BorderWidth=1;//Set Edge widthMeifubutton.Layer.bordercolor = redselectcolore.cgcolor// Set the colors of the edges [_sharecontent addsubview: Meifubutton]; Button s
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.