绘制/绘制TextBox边框(左,右,上和下) [英] Draw/Paint TextBox borders (left, right, up and down)

查看:128
本文介绍了绘制/绘制TextBox边框(左,右,上和下)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好我可以改变文本框的BorderColor

hello I could change the BorderColor of the textbox

ControlPaint.DrawBorder(e.Graphics, this.ClientRectangle, borderColor, ButtonBorderStyle.Solid);



但我想要所有边框(顶部颜色,底部颜色,左右颜色)我该怎么办那?谢谢





我想要的:http://imageshack.us/photo/my-images/821/bczo.jpg/



我只知道编程基础我不太懂!如果他们展示一些代码会很棒开始



有经验的人请帮助我吗?


but i want all borders (color for top,color for bottom,color for left and right) how do I do that? thank you


I want that: http://imageshack.us/photo/my-images/821/bczo.jpg/

I just know programming basics I do not understand well! if they showed some code would be great to start

someone with experience to help me please?

推荐答案

这是一个解决方案,你只是遇到了字体设置丢失的问题我认为

Here's a solution, you just have a problem the font setting loses I think
int borderWidth = 1;
ControlPaint.DrawBorder(e.Graphics,
                      e.ClipRectangle,         Color.Green, borderWidth, 
                      ButtonBorderStyle.Solid, Color.Red, borderWidth,
                      ButtonBorderStyle.Solid, Color.Blue, borderWidth,
                      ButtonBorderStyle.Solid, Color.Yellow, borderWidth, 
                      ButtonBorderStyle.Solid); 
base.OnPaint(e);


如果您知道自定义控件。您可以这样做来扩展文本框。否则,请搜索此站点以进行自定义控件。
If you know making custom controls. You can do that extending the text-box. Else search this site for making custom controls.


这篇关于绘制/绘制TextBox边框(左,右,上和下)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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