绘制一个实心圆,下列代码正确的是
A: Graphics g=CreateGraphics();Pen myPen=new Pen(Color.Blue);g.DrawEllipse(myPen, new Rectangle(50, 50, 100, 100));
B: Graphics g=CreateGraphics();SolidBrush myBrush = new SolidBrush(Color.Blue);g.DrawEllipse(myBrush, new Rectangle(50, 50, 100, 100));
C: Graphics g=CreateGraphics();SolidBrush myBrush = new SolidBrush(Color.Blue); g.FillEllipse(myBrush, new Rectangle(50, 50, 100, 100));
D: Graphics g=CreateGraphics();Pen myPen=new Pen(Color.Blue);g.FillEllipse(myPen, new Rectangle(50, 50, 100, 100));
A: Graphics g=CreateGraphics();Pen myPen=new Pen(Color.Blue);g.DrawEllipse(myPen, new Rectangle(50, 50, 100, 100));
B: Graphics g=CreateGraphics();SolidBrush myBrush = new SolidBrush(Color.Blue);g.DrawEllipse(myBrush, new Rectangle(50, 50, 100, 100));
C: Graphics g=CreateGraphics();SolidBrush myBrush = new SolidBrush(Color.Blue); g.FillEllipse(myBrush, new Rectangle(50, 50, 100, 100));
D: Graphics g=CreateGraphics();Pen myPen=new Pen(Color.Blue);g.FillEllipse(myPen, new Rectangle(50, 50, 100, 100));
举一反三
- 中国大学MOOC: 下列代码完成的功能,哪项表述正确()Pen myPen = new Pen(Color.Blue, 2);Graphics g = e.Graphics; g.DrawRectangle(myPen, 10, 10, 200, 10);
- 定义一个画笔对象,下列哪项错误() A: Pen myPen=new Pen(Color.Red) B: Pen myPen=new Pen(new SolidBrush(Color.Red)) C: Pen myPen=new Pen(Color.Red,5) D: Pen myPen=new Pen(new Bitmap(“e:\\1.jpg”))
- 一下程序输出的结果的是() g=100 def<br/>temp(x): x=50 print(temp(g)) print(g) A: None 50 B: 100 50 C: 50 100 D: None 100
- WH0推荐的成年人每日碘摄入量为() A: 50μg B: 100μg C: 150μg D: 100~200μg E: 50~100μg
- 某小应用程序的界面有两个按钮,点击“画圆”按钮,程序在窗口画一个圆,点击“画矩形”按钮,程序在窗口画一个矩形。 import java.applet.*; import java.awt.*; import java.awt.event.*;import javax.swing.*; public class Class l extends Applet implements ActionListener { boolean c = false; int r = 50,a = 50, b = 50; JButton bl, b2; public void init(){ setSize(200, 200); setBackground(Color.blue); b1 = new JButton("画 圆"); b2 = new JButton("画矩形"); b1.addActionListener(this); b2.addActionListener(this); add(b1); add(b2); setVisible(true); } public void (Graphics g){ g.clearRect(70, 100, 130, 200); g.setColor(Color. red); if(c) g.drawRoundRect(70, 100, r, r, r, r); else g.drawRect(70, 100, a, b); } public void update(Graphics g){ paint(g); } public void actionPerformed(ActionEvent e){ if(e.getSource()==b1) { c = true; } else if(e.getSource()==b2){ c = false; } ; } }