带图像和文本的按钮 [英] button with image and text

查看:49
本文介绍了带图像和文本的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何创建一个包含图像和文本的按钮?

How can i create a button that have a image and a text on it??

推荐答案

将此CSS添加到STYLE标签中的HTML或更好将它放在一个.css文件中并在Link标签中引用它:



Add This CSS to your HTML in a STYLE tag or better yet put it in a .css file and reference it in a Link tag:

.saveBtn
 {
   background: url('/img/disk.png');
   background-position:center;
   background-repeat:no-repeat;
}







这是HTML输入对象。 CSS通过类名saveBtn引用它。






Here is the HTML input object. The CSS references it by the class name ''saveBtn''

<input type=button id="btnSave" class="saveBtn" value="Save"/>


Button btn = new Button();
btn.Image = new Bitmap("btn.png");  // image
btn.Location = new System.Drawing.Point(120, 10);
btn.Name = "MyCustomBtn";
btn.Text = "I''m a Custom Button.";  // text
tabControl1.Controls.add(btn);  // add custom to tab control..


这篇关于带图像和文本的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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