借鉴Windows窗体的单个像素 [英] Draw a single pixel on Windows Forms

查看:159
本文介绍了借鉴Windows窗体的单个像素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我卡试图打开一个Windows窗体上的单个像素。

I'm stuck trying to turn on a single pixel on a Windows Form.

graphics.DrawLine(Pens.Black, 50, 50, 51, 50); // draws two pixels

graphics.DrawLine(Pens.Black, 50, 50, 50, 50); // draws no pixels

该API真的应该有一个方法来设置一个像素的颜色,但我没有看到一个。

The API really should have a method to set the color of one pixel, but I don't see one.

我使用C#。

推荐答案

这将设置一个像素:

e.Graphics.FillRectangle(aBrush, x, y, 1, 1);

这篇关于借鉴Windows窗体的单个像素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆