网格(Grid)控件,可直观描述二维信息。因此它具有横向和纵向二轴,就是一个二维表格。
#include<stdio.h> #include<iostream> #include<math.h> using namespace std; #define PI (acos(-1.0)) int main() { int t; double a, b; scanf("%d", &t); while (t--) { scanf("%lf%lf", &a, &b); double sum = a * PI + 2 * b;
NSPasteboard 、text 的操作 5/ Shape 的一些操作,主要介绍 line 及 rect 6/ Shape的curve操作 7/ GUI 8/ Cocoa基础 本期介绍 Shape 里的 oval
29 #里面小圆半径 30 self.oval_R = 30 31 32 self.oval_r1 = self.oval_r - self.oval_R + 0.5 33 self.oval_r2 = self.oval_r - self.oval_R - 0.5 34 35 36 #小圆 37 ((self.oval_zero_x - self.oval_r), 42 (self.oval_zero_y - (self.oval_zero_y - self.oval_r1), 49 (self.oval_zero_x + (self.oval_zero_x + self.oval_r2), 56 (self.oval_zero_y +
((125,70,275,220),fill = 'blue') #画圆脸 w.create_oval((140,100,260,220),fill = 'white') #画椭圆 w.create_oval((200,80,230,120),fill = 'white') #画椭圆 w.create_oval((170,80,200,120 ),fill = 'white') #画椭圆眼睛 w.create_oval((203,92,215,108),fill = 'black') #画椭圆眼睛 w.create_oval ((185,92,197,108),fill = 'black') #画椭圆眼睛 w.create_oval((206,95,212,105),fill = 'white') #画椭圆眼睛 w.create_oval((188,95,194,105),fill = 'white') #画圆鼻子 w.create_oval((193,115,207,130
=80;//圆形的宽 private final int OVAL_HEIGHT=80;//圆形的高 public DrawCircle(){ super(); { public void paint(Graphics g){ super.paint(g); g.drawOval(10, 10, OVAL_WIDTH , OVAL_HEIGHT);//绘制第1个圆形 g.drawOval(80, 10, OVAL_WIDTH, OVAL_HEIGHT);//绘制第2个圆形 g.drawOval(150, 10, OVAL_WIDTH, OVAL_HEIGHT);//绘制第3个圆形 g.drawOval(50, 70, OVAL_WIDTH, OVAL_HEIGHT );//绘制第4个圆形 g.drawOval(120, 70, OVAL_WIDTH, OVAL_HEIGHT);//绘制第5个圆形 }
:最外层的线条(最大的) oval_second_color:第二层 oval_thirdly_color:第三层 oval_min_color:第四层 为了效果都改为一个颜色 <com.shenzhen.jimeng.jm.JMWorkProgress " app:oval_second_color="@color/colorPrimary" app:oval_thirdly_color="@color/colorPrimary" " app:oval_second_color="@color/colorPrimary" app:oval_thirdly_color="@color/colorPrimary" ="@color/colorAccent" app:oval_second_color="@color/colorPrimary" app:oval_thirdly_color="@color 文字长度得在1-7的范围内 效果图: XML可调用属性如以下表格 属性 作用 oval_big_color 设置最外层线条颜色 oval_second_color 设置第二层线条颜色 oval_thirdly_color
; import net.sf.oval.ConstraintViolation; import net.sf.oval.configuration.xml.XMLConfigurer; import > <oval xmlns="http://oval.sf.net/oval-configuration" xmlns:xsi="http://www.w3.org/2001 /XMLSchema-instance" xsi:schemaLocation="http://oval.sf.net/oval-configuration http://oval.sourceforge.net /oval-configuration.xsd" > <! > 输出结果, [net.sf.oval.ConstraintViolation: com.honey.oval.User.managerId cannot be null, net.sf.oval.ConstraintViolation
= new RectF(); oval1.left = (mXCenter - mRingRadius); oval1.top = (mYCenter - mRingRadius ); oval1.right = mRingRadius * 2 + (mXCenter - mRingRadius); oval1.bottom = mRingRadius 、圆弧的起始角度、圆弧的角度、是否显示半径连线 //外圆弧 if (mProgress > 0 ) { RectF oval = new RectF (); oval.left = (mXCenter - mRingRadius); oval.top = (mYCenter - mRingRadius) ; oval.right = mRingRadius * 2 + (mXCenter - mRingRadius); oval.bottom = mRingRadius
= new RectF(0, 0, canvasWidth, canvasHeight);// 设置个新的长方形,扫描测量 canvas.drawRect(oval2,p); Color.BLUE,Color.YELLOW}, null, Shader.TileMode.REPEAT); p1.setShader(mShader); RectF oval ,p1); //绘制幕布 Paint p2=new Paint(); p2.setColor(Color.BLACK); RectF oval3 = new RectF(30, 30, canvasWidth-30, canvasHeight-30);// 设置个新的长方形,扫描测量 canvas.drawRect(oval3, = new RectF(30, 30, canvasWidth-30, canvasHeight-30);// 设置个新的长方形,扫描测量 canvas.drawRect(oval3,
> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="<em>oval</em>"> <! --shape:图片形状 oval:椭圆--> <size android:width="32dp" android:height="32dp"/> <! > <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="<em>oval</em>"> <! --shape:图片形状 oval:椭圆--> <size android:width="32dp" android:height="32dp"/> <!
setMeasuredDimension 用于重新设置View宽高 Canvas#drawArc(RectF oval, float startAngle, float sweepAngle, boolean useCenter, Paint paint) 绘制以oval为边界的圆弧 onDraw 用来确定View长什么样。 = new RectF(); oval.left = (mXCenter - radius); oval.top = (mYCenter - radius); oval.right = new RectF(); oval.left = (mXCenter - radius); oval.top = (mYCenter - radius); oval.right = mXCenter + radius; oval.bottom = radius * 2 + (mYCenter - radius); //绘制圆弧背景
create_line(i * 40 + 20, 20, i * 40 + 20, 580) w1.create_line(20, i * 40 + 20, 580, i * 40 + 20)w1.create_oval (135, 135, 145, 145, fill='black')w1.create_oval(135, 455, 145, 465, fill='black')w1.create_oval(465, 135, 455, 145, fill='black')w1.create_oval(455, 455, 465, 465, fill='black')w1.create_oval(295, 295, = 1: w1.create_oval(40 * i + 5, 40 * j + 5, 40 * i + 35, 40 * j + 35, fill='black') A[i = 1: w1.create_oval(40 * i + 5, 40 * j + 5, 40 * i + 35, 40 * j + 35, fill='white') A[i
><v:stroke id="vml1"/></v:oval><v:oval><v:stroke dashstyle="2 2 2 0 2 2 2 0" id="shape"/></v:oval><input style="width:100pt;height:50pt" fillcolor="red"></v:oval><v:oval><v:stroke id="vml1"/></v:oval></body style="width:100pt;height:50pt" fillcolor="red"></v:oval><v:oval><v:stroke id="vml1"/></v:oval></body ><v:stroke id="vml1"/></v:oval></body></html> vgx! ><v:stroke id="vml1"/></v:oval></body></html> 与之相配合堆上gadgets如下: ?
((125,70,275,220),fill = 'blue') #画圆脸 w.create_oval((140,100,260,220),fill = 'white') #画椭圆 w.create_oval((200,80,230,120),fill = 'white') #画椭圆 w.create_oval((170,80,200,120 ),fill = 'white') #画椭圆眼睛 w.create_oval((203,92,215,108),fill = 'black') #画椭圆眼睛 w.create_oval #画椭圆眼睛 w.create_oval((188,95,194,105),fill = 'white') #画圆鼻子 w.create_oval((193,115,207,130 ((140,275,190,295),fill = 'white') #左脚 w.create_oval((210,275,260,295),fill = 'white') #
$watch('counter', function(nval, oval) { alert('计数器值的变化 :' + oval + ' 变为 ' + nval + '!') $watch('products.id', function(nval, oval) { alert('计数器值的变化 :' + oval + ' 变为 ' + nval + '!') $watch('products.id', function(nval, oval) { alert('计数器值的变化 :' + oval + ' 变为 ' + nval + '!') $watch('products.id', function(nval, oval) { alert('计数器值的变化 :' + oval + ' 变为 ' + nval + '!')
啰嗦这么多,进入正题看一下drawArc方法 public void drawArc(RectF oval, float startAngle, float sweepAngle, boolean useCenter ,Paint paint) { super.drawArc(oval, startAngle, sweepAngle, useCenter, paint); } 分别需要5个参数,那它们分别代表什么意思呢 oval:为确定圆弧区域的矩形,圆弧的中心点为矩形的中心点 startAngle:为圆弧的开始角度(时钟3点的方向为0度,顺时钟方向为正) sweepAngle:为圆弧的扫过角度(正数为顺时钟方向, 画笔模式为填充 canvas.drawArc(ovalTop, 180, 180, false, mEggPaint); //下半圆长方形半圆弧 RectF oval3 new RectF(mX-mR, mY-mR, mX+mR, mY+mR); //从3点钟方向顺时针画弧线180度未与中心点闭合,画笔模式为填充 canvas.drawArc(oval3
//画搜索图标 if (status == status_dismiss_search) { //画搜索圆 RectF oval searchCircleRadius, centerY + searchCircleRadius); if (ratio < 0.5f) canvas.drawArc(oval 画进度 if (status == status_progress) { Path path = new Path(); RectF oval animeRadius, centerX + animeRadius, centerY + animeRadius); path.addArc(oval
shape 可以定义四种类型的几何图形,由 android:shape 属性指定 line --> 线 rectangle --> 矩形(圆角矩形) oval --> 椭圆,圆 ring -- 圆形边框 --> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="<em>oval</em> 边框:<em>oval</em>_border.xml <?xml version="1.0" encoding="utf-8"?> <! -- 椭圆边框 --> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="<em>oval</em> -- 椭圆填充--> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="<em>oval</em>"
-- 图层1(oval) --> <! -- left,top,right,bottom定义为-10,是为了扩大oval,达到覆盖四角的效果 --> <item android:left="-10dp" android:top="-10dp -- <em>oval</em>_inner[内部] --> <stroke android:width="10dp" android -- oval_inner_size[大小(除去边线)] ,也是最终裸露出来的圆形图像区域--> <size android:height="50dp -- 使<em>oval</em>_inner透明,裸露出将来设置的背景图片 --> <gradient android:centerColor="#0000" /> </shape