如何更改支票图像上的复选框 [英] how to change the check image on a checkbox

查看:132
本文介绍了如何更改支票图像上的复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

它具有文字,图像,然后复选框,

it has text, an image, and then the checkbox,

我想用一个更好的形象进行检查,但无法找到一种方法来改变选中和未选中的图像

I want to use a better image for the check, but cannot find a way to change the checked and unchecked images

this.checkBox1.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.checkBox1.Checked = true;
this.checkBox1.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBox1.Image = global::ClientExam.Properties.Resources.action32;
this.checkBox1.Location = new System.Drawing.Point(145, 140);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(273, 127);
this.checkBox1.TabIndex = 0;
this.checkBox1.Text = "checkBox1";
this.checkBox1.TextImageRelation = System.Windows.Forms.TextImageRelation.TextBeforeImage;
this.checkBox1.UseVisualStyleBackColor = true;

有人知道一个不要求我写我自己的控制?

anybody know of one that doesn't require me to write my own control?

推荐答案

如果您正在寻找如何做到这一点的WinForms,简单的答案是创建一个派生自复选框一个新的复选框类,然后重写的的OnPaint 方法。

If you are looking for how to do this in Winforms, the simple answer is to create a new checkbox class that derives from CheckBox, then override the OnPaint method.

下面是一个<一个href="http://devblog.antongochev.net/2008/07/08/create-custom-ui-appearance-for-winforms-checkbox-part-2/">complete教程如何创建自定义的期待复选框。

Here is a complete tutorial on how to create custom looking checkboxes.

这篇关于如何更改支票图像上的复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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