---
title: "drawString(String messagetr, int x, int y, int anchor);函数anchor参数备忘"
author: "bit6211"
date: "2011-08-17T18:50:07Z"
tags: []
categories: ["移动开发"]
slug: "drawstring-string-messagetr-int-x-int-y-int-anchor-anchor"
draft: false
lastmod: "2011-08-17T18:50:42Z"
id: 1151701
url: "https://bit6211.iteye.com/blog/1151701"
---

在LGame中，LGraphics类的public void drawString(String messagetr, int x, int y, int anchor);函数中，最后一个anchor参数指的是锚点，起到定位的作用，而“x”，“y”参数指的就是这个锚点的位置了。anchor参数事先规定了一些常量值，这些常量值组合可以定义一些，常用的锚点。如图所示。

![锚点组合](http://dl.iteye.com/upload/attachment/538147/ee17558f-27c1-348f-9f4a-139602e90d3e.png)