Drawing Images and Text
using System;
using UIKit;
using Foundation;
using CoreGraphics;
namespace GraphicsAnimation
{
public class DrawnImageView : UIView
{
public DrawnImageView ()
{
BackgroundColor = UIColor.White;
}
public override void Draw(CGRect rect)
{
base.Draw (rect);
using(var g=UIGraphics.GetCurrentContext())
{
g.ScaleCTM (1,-1);//画出来的图像默认是倒立的
g.TranslateCTM (0,-Bounds.Height);
g.DrawImage (rect,UIImage.FromFile("MyImage.png").CGImage);
float fontSize = 35f;
g.TranslateCTM (0,fontSize);
g.SetLineWidth (1.0f);
g.SetStrokeColor (UIColor.Yellow.CGColor);
g.SetFillColor (UIColor.Red.CGColor);
//g.SetShadow (new SizeF (5, 5), 0, UIColor.Blue.CGColor);
g.SetShadow(new CGSize(5,5),0,UIColor.Blue.CGColor);
g.SetTextDrawingMode (CGTextDrawingMode.FillStroke);
g.SelectFont ("Helvetica", fontSize, CGTextEncoding.MacRoman);
// show the text
g.ShowText ("Hello Core Graphics");
}
}
}
}
————————————————
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
DrawnImageView drawnImageView = new DrawnImageView { Frame=UIScreen.MainScreen.Bounds};
View.AddSubview (drawnImageView);
}

Drawing Images and Text的更多相关文章
- Drawing text
We begin with drawing some Unicode text on the client area of a window. #!/usr/bin/python # -*- codi ...
- Quartz2D Text
[Quartz2D Text] Quartz 2D provides a limited, low-level interface for drawing text encoded in the Ma ...
- iOS开发系列--通知与消息机制
概述 在多数移动应用中任何时候都只能有一个应用程序处于活跃状态,如果其他应用此刻发生了一些用户感兴趣的那么通过通知机制就可以告诉用户此时发生的事情.iOS中通知机制又叫消息机制,其包括两类:一类是本地 ...
- 1.C#WinForm基础制作简单计算器
利用c#语言编写简单计算器: 核心知识点: MessageBox.Show(Convert.ToString(comboBox1.SelectedIndex));//下拉序号 MessageBox.S ...
- 原创:MD5 32位加密软件
网站后台数据库切勿使用明文保存密码,否则一旦黑客拿下你的Webshell,后果不堪设想. 网站后台密码加密大多数采用的就是MD5算法加密.今天给大家送一个本人用c#简单编写的MD5 32位加密程序,虽 ...
- csharp: Download SVN source
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...
- C# WinForm实现Windows 7 Aero磨砂玻璃效果
在Vista系统之后,微软为窗体程序提供了Aero磨砂的效果,如下图.那么用C#如 何来实现这种磨砂效果呢? 代码: using System; using System.Collections.Ge ...
- 【ASP.NET】复制单个文件同时到多个目录
有时候,当我们更新了一个dll文件后,需要将该dll文件复制到到不同的文件夹中,手动操作会很麻烦,因此可以考虑利用程序实现. 利用powershell批量复制 示例代码如下: $source=&quo ...
- 基于AgileEAS.NET SOA 中间件领域模型数据器快速打造自己的代码生成器
一.前言 AgileEAS.NET SOA 中间件平台是一款基于基于敏捷并行开发思想和Microsoft .Net构件(组件)开发技术而构建的一个快速开发应用平台.用于帮助中小型软件企业建立一条适合市 ...
随机推荐
- 【转】SpringMVC访问静态资源的三种方式
如何你的DispatcherServlet拦截 *.do这样的URL,就不存在访问不到静态资源的问题.如果你的DispatcherServlet拦截“/”,拦截了所有的请求,同时对*.js,*.jpg ...
- Java-二叉树-插入、删除、遍历
二叉树的具体特性和细节知识点,自行百度,直接上代码. 节点:节点内容.左子孩子.右子孩子.父亲 class Node { private int data; private Node leftChil ...
- 在vue-cli环境下模拟数据接口及如何应用mockjs
第一种办法 1.需要先准备json文件 在根目录下新建个oapi文件夹下新建个iorder.json文件将需要遍历的json数据沾里面. 2.在build文件夹下新建dev-server.js 文件 ...
- 如何用github展示前端页面
如何在github上展示你的前端页面 参考:https://luozhihao.github.io/demo/ 感谢作者 1.New reposipory 2.进入你本机目录 我是在d:vuedemo ...
- unix网络编程第四章----基于TCP套接字编程
为了执行网络I/O操作.进程必须做的第一件事情就是调用Socket函数.指定期待的通信协议 #include<sys/socket.h> int socket(int family,int ...
- Laravel 基础知识
使用版本Laravel5.1.======================================================目录简单介绍:app目录,核心目录,应用目录.bootstra ...
- Day 18 函数之一
函数参数: 1.形参变量只有在被调用时才分配内存单元,在调用结束时,即刻释放所分配的内存单元.因此,形参只在函数内部有效.函数调用结束返回主调用函数后则不能再使用该形参变量 2.实参可以是常量.变量. ...
- What is pseudopolynomial time? How does it differ from polynomial time?
To understand the difference between polynomial time and pseudopolynomial time, we need to start off ...
- 容器中元素的去重——ans.erase(unique(ans.begin(),ans.end()),ans.end());
啊,原来unique()函数,只是处理的连续的元素,比如 -1 -1 -1 1 2 -1 2 就处理成了 -1 1 2 -1 2 -1 -1并且返回5,之后eraser(5,7)剩下了 -1 1 2 ...
- Delphi GDI对象之绘制位图
http://www.cnblogs.com/pchmonster/archive/2012/07/06/2579334.html 绘制位图(Drawing Bitmaps) 绘制位图听起来似乎很难, ...