All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
ASP.NET中AJAX编程开发指南_[Asp.Net教程]
ASP.NET编程精选25种函数源程序_[Asp.Net教程]
不需要mod_rewrite直接使用php实现伪静态化页面_[PHP教程]
asp.net2.0实现语言和主题的切换_[Asp.Net教程]
动态网页制作技术PHP常用的正则表达式_php资料_编程技术
PHP中使用crypt()实现用户身份验证_php资料_编程技术
AJAX技术在PHP开发中的简单应用_php资料_编程技术
浅谈.NET中的数据绑定表达式_[Asp.Net教程]
delphi程序中动态创建、删除视图
ASP.NET通过Remoting,service上传文件_[Asp.Net教程]
Reading number is top 10 pictures
农夫山泉变身记
Female model behind the bitterness, often being overcharged2
The household design, do not do bridal chamber a pity
The money of more than 100 countries and regions15
狗狗与主人神同步1
Household design classic black and white
Summer is most suitable for young people to travel in China10
如果我是导演...
The girl of like self-time
Poor doll, hand job was caught the currently in effect by his dad
Download software ranking
Boxer vs Yellow2
Tram sex maniac 2 (H) rar bag5
金山office2007
Eclipse 4.2.1 For Win32
matrix2
Unix video tutorial12
Photoshop 8.0图象编辑软件
Eclipse-CALMSANNY (second edition)
Tram sex maniac 2 (H) rar bag9
C++编程教程第三版
qq published in(发表于) 2014/7/11 9:29:29 Edit(编辑)
java中全局变换和局部变换

java中全局变换和局部变换

java中全局变换和局部变换

全局变换和局部变换

1.全局变换

全局变换是应用于由给定Graphics对象绘制的每个项目的变换。创建全局变换时,可以通过操作Graphics对象的Transform属性来实现,Transform属性是Matrix类的对象。

示例

图像的全局变换

本示例实现的是,当程序运行时,单击【全局变换】按钮,在窗体中的相同位置绘制一个椭圆和一个经过全局变换处理的椭圆。示例运行结果如图1所示。



图1 图像的全局变换

Form1窗体中,在【全局变换】按钮的Click事件中,首先通过调用Graphics对象的DrawEllipse方法绘制一个普通椭圆,然后使用Graphics对象创建一个全局变换(该变换首先在y轴方向上缩放0.5倍,再在x轴方向平移50个单位,然后旋转30°),最后再次调用Graphics对象的DrawEllipse方法绘制椭圆。【全局变换】按钮的Click事件代码如下:

private void button1_Click(object sender, EventArgs e)

{

Graphics graphics = this.CreateGraphics();

Pen myPen = new Pen(Color.Blue, 2);

graphics.DrawEllipse(myPen, 10, 30, 100, 50);

graphics.ScaleTransform(1, 0.5f);

graphics.TranslateTransform(50, 0, MatrixOrder.Append);

graphics.RotateTransform(30, MatrixOrder.Append);

graphics.DrawEllipse(myPen, 10, 30, 100, 50);

}

完整程序代码:

★ ★★★★Form1.cs窗体代码文件完整程序代码★★★★★

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

using System.Drawing.Drawing2D;

namespace _6_20

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)

{

Graphics graphics = this.CreateGraphics();

Pen myPen = new Pen(Color.Blue, 2);

graphics.DrawEllipse(myPen, 10, 30, 100, 50);

graphics.ScaleTransform(1, 0.5f);

graphics.TranslateTransform(50, 0, MatrixOrder.Append);

graphics.RotateTransform(30, MatrixOrder.Append);

graphics.DrawEllipse(myPen, 10, 30, 100, 50);

}

}

}

★ ★★★★Form1.Designer.cs窗体设计文件完整程序代码★★★★★

namespace _6_20

{

partial class Form1

{

///



/// 必需的设计器变量。

///


private System.ComponentModel.IContainer components = null;

///

/// 清理所有正在使用的资源。

///


/// 如果应释放托管资源,为 true;否则为 false。

protected override void Dispose(bool disposing)

{

if (disposing && (components != null))

{

components.Dispose();

}

base.Dispose(disposing);

}

#region Windows 窗体设计器生成的代码

///

/// 设计器支持所需的方法 - 不要

/// 使用代码编辑器修改此方法的内容。

///


private void InitializeComponent()

{

this.button1 = new System.Windows.Forms.Button();

this.SuspendLayout();

//

// button1

//

this.button1.Location = new System.Drawing.Point(155, 21);

this.button1.Name = "button1";

this.button1.Size = new System.Drawing.Size(26, 79);

this.button1.TabIndex = 0;

this.button1.Text = "全局变换";

this.button1.UseVisualStyleBackColor = true;

this.button1.Click += new System.EventHandler(this.button1_Click);

//

// Form1

//

this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);

this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;

this.ClientSize = new System.Drawing.Size(194, 119);

this.Controls.Add(this.button1);

this.MaximizeBox = false;

this.Name = "Form1";

this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;

this.Text = "Form1";

this.ResumeLayout(false);

}

#endregion

private System.Windows.Forms.Button button1;

}

}

★ ★★★★Program.cs主程序文件完整程序代码★★★★★

using System;

using System.Collections.Generic;

using System.Windows.Forms;

namespace _6_20

{

static class Program

{

///

/// 应用程序的主入口点。

///



添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.