[DevExpress]为TextEdit设置水印文字

关键代码:

        public static void SetWatermark(this TextEdit textEdit, string watermark)
        {
            textEdit.Properties.NullValuePromptShowForEmptyValue = true;
            textEdit.Properties.NullValuePrompt = watermark;
        }
        public static void ClearWatermark(this TextEdit textEdit)
        {
            if (textEdit.Properties.NullValuePromptShowForEmptyValue)
                textEdit.Properties.NullValuePrompt = string.Empty;
        }

测试代码:

        private void Form1_Load(object sender, EventArgs e)
        {
            textEdit1.SetWatermark("请输入用户名称....");
            textEdit2.SetWatermark("请输入用户密码....");
        }

        private void simpleButton1_Click(object sender, EventArgs e)
        {
            textEdit1.ClearWatermark();
            textEdit2.ClearWatermark();
        }
代码效果:

[DevExpress]为TextEdit设置水印文字

时间: 2024-08-03 14:23:15

[DevExpress]为TextEdit设置水印文字的相关文章

DevExpress实现为TextEdit设置水印文字

本文实例展示了DevExpress实现为TextEdit设置水印文字的方法,是一个很实用的技巧.分享给大家供大家参考. 转自 http://blog.csdn.net/yh0503/article/details/51487726 关键代码如下: 1 public static void SetWatermark(this TextEdit textEdit, string watermark) 2 { 3 textEdit.Properties.NullValuePromptShowForEm

[WinForm]为TextBox设置水印文字

关键代码: using System; using System.Runtime.InteropServices; using System.Windows.Forms; namespace WinFormUtilHelpV2 { /// <summary> /// 基于.NET 2.0的TextBox工具类 /// </summary> public static class TextBoxToolV2 { private const int EM_SETCUEBANNER =

ASP.NET图片上传,加水印文字和水印图片!

看了清清月儿的这篇文章让自己受益匪浅,但是觉得还有一些问题.上传图片后还有原来的图片文件存在,觉得这样很不爽,调用file类的delete方法删除原来没有生成水印的图片另外自己又加了一个限制图片大小的函数 1.最简单的单文件上传(没花头) 效果图:说明:这是最基本的文件上传,在asp.net1.x中没有这个FileUpload控件,只有html的上传控件,那时候要把html控件转化为服务器控件,很不好用.其实所有文件上传的美丽效果都是从这个FileUpload控件衍生,第一个例子虽然简单却是根本

asp.net 图片水印+文字水印

public void AddWaterPic() { //图片水印 string bg = Request.MapPath("~/images/bg.jpg");//背景图 string newPath = Request.MapPath("~/newImages/");//保存路径 string shuiyin= Request.MapPath("~/images/scrollBlock.jpg");//水印图片 System.Drawing

php 图片加水印文字水印

/*给图片加文字水印的方法*/ $dst_path = 'http://f4.topitme.com/4/15/11/1166351597fe111154l.jpg';//保证路径正确 $dst = imagecreatefromstring(file_get_contents($dst_path)); /*imagecreatefromstring()--从字符串中的图像流新建一个图像,返回一个图像标示符,其表达了从给定字符串得来的图像 图像格式将自动监测,只要php支持jpeg,png,gi

[WinForm][DevExpress]自定义GridControl中按钮文字内容

最近项目开发中,使用到了GridControl的FindPanel,这样可以很好的对数据进行筛选,可是所展现的按钮文字是英文,如图: 那怎么定义两个按钮问题,以符合项目需求了?经过一番搜索发现利用GridLocalizer可以很好实现: 核心代码: public class BuilderGridLocalizer : GridLocalizer { Dictionary<GridStringId, string> CusLocalizedKeyValue = null; /// <su

IOS图片上添加水印文字(微博上图片上得水印文字)

建一个类目(不知道怎么建的可以去百度一下) UIImage的类目 类目的.h文件  文件名为UIImage+watermark #import <UIKit/UIKit.h> @interface UIImage (watermark) //定义一个方法 - (UIImage *)watermarkImage:(NSString *)text; @end .m文件的实现 #import "UIImage+watermark.h" @implementation UIImag

一段水印文字的练习

做淘宝登陆页面时登陆框的水印文字的需要,做了如下的练习. <!DOCTYPE html><html><head><title></title><script src="..\jquery\jquery-2.1.3.js" type="text/javascript" ></script><style type="text/css"> body,inpu

Android TextView设置多彩文字

在应用开发中时常会遇到需要在一段文字中插入几个不一样颜色文字的需求; 以前本人都是用多个TextView拼起来,不仅感觉很蠢,操作起来也蛮恶心; 直到接触到了SpannableStringBuilder,感觉整个人都好了; 在我搭建界面布局,会有一些带String占位符的默认文字,如:"现在的气温是:%s","今天天气:%1$s,最高气温:%2$s,最低气温:%3$s,降雨率:%4$s,pm2.5:%5$s."; 之后在获取到数据时,直接String.format(