谢谢高手们!
解决方案 »
- datatable的load方法的问题
- |ZYCWPF| Interaction的ConditionBehavior在EventTrigger有效,但在DataTrigger为什么无效,谢谢有示例
- C# 我想要在网页上下载图片,但是当运行到System.IO.File.Create(savePath);时,出错:对路径“D:\”的访问被拒绝。
- C# 如何给未打开的窗体传值
- 有没有做过皮肤组件的,如何实现里面具体的控件,有原理就行,非常感谢!!!
- C#如何调用C语言实现的dll?
- 为什么我的PrintDocument在PrintPreviewDialog中预览是多页的,在打印的时候就只打印了最后一页呢???
- winform mdi 在子窗体 B里面 切换成子窗体C
- C#给文件添加标识
- 一个有关ICodeCompiler接口的方法CompileAssemblyFromSource的问题。
- 求C#的CRC-8校验码函数
- 关于程序安装时自动在Sql server中创建登陆用户,在线等
拖上来个ComboBox,把它改成这个样子?怎么改?
看看注册能下么,我也看看
public Form1()
{
InitializeComponent();
this.Load += new EventHandler(Form1_Load);}
void Form1_Load(object sender, EventArgs e)
{
comboBox1.DrawMode = DrawMode.OwnerDrawFixed;
comboBox1.DrawItem += new DrawItemEventHandler(comboBox1_DrawItem);
comboBox1.Items.Add("sd1");
comboBox1.Items.Add("sd2");
comboBox1.Items.Add("sd3");
}
protected void comboBox1_DrawItem(object sender, DrawItemEventArgs e)
{
ComboBox cb = sender as ComboBox;
Graphics g = e.Graphics;
Pen p = new Pen(Color.Blue, 1);
g.DrawRectangle(p, e.Bounds.X + 1, e.Bounds.Y + 1, 12, 12);
if (e.Index == cb.SelectedIndex)
g.DrawString("√", new Font(FontFamily.GenericSerif, 10), Brushes.Red,
e.Bounds.Location, StringFormat.GenericDefault);
g.DrawString(cb.GetItemText(cb.Items[e.Index]), new Font(FontFamily.GenericSerif, 9),
Brushes.Black, 15, e.Bounds.Y + 1, StringFormat.GenericDefault);
}样式出来了,功能也有了,但是有一个小问题,就是鼠标在item上移动时候,会在所有的项目上都画上对勾,但是当你选择了一项的时候,显示就正常了。这个问题期待你来解决,呵呵~~~
<dropcheck:DropDownCheckList runat ="server" ID ="ddlBuWei" DataTextField="Name"
RepeatColumns="1" DisplayTextWidth="80" DataValueField="ID"
TextWhenNoneChecked="请选择" DisplayTextList="Labels"
ClientCodeLocation="DropDownCheckList.js" Height ="16px" Width ="135px" ScrollBars="Vertical" >
</dropcheck:DropDownCheckList>
ComboBox