[Cursor Bitmap]Programatically Create Bitmap For Cursor

本文介绍了如何通过编程方式创建位图并填充现有图像的方法。主要内容包括:创建指定大小的空位图并获取其图形;使用TextureBrush填充目标图像,并关注WrapMode设置;通过Graphics对象及TextureBrush填充特定图像等技巧。
1. How to programatically create a bitmap by filling in existing images.
Steps:
    a. Create an empty bitmap with you wanted size and get graphics from it.
    b. Create TextureBrushes with intended to fill in images. Set its visible region in the new bitmap by specifying its rectangle well; and pay attention to wrapmode.
    c. Use the graphics to fill in the intended images using TextureBrushes.
2. Some tips:
    a. Cursor object can only hold 32*32 image. If giving a larger image, as its rectangle size is 32*32, so that's the always visible part to user.
    b. You can create an empty bitmap and using the Graphics got from it to fill things (especially useful is Texture like other bitmap, icons, etc) into it.
    c. TextureBrush can be used to fill in other images into a Grahpics. Attention to its WrapMode. Take Flip for example: it will always flip the image in the targeted image whole size, while
    using the rectangle to define the visible part.
    d. If you are not satisfied with normal arrangement by textureBrush's wrapmode, you can further create and apply matrix to do for example X/Y offset, rotation, etc to control how to fill
    using the texture brush on the target bitmap.
    e. Cursor.Draw(graphics,rectangle) can draw the cursor look into the target graphics.

转载于:https://www.cnblogs.com/taoxu0903/archive/2010/06/02/1750038.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值