Ext.ux.ImageButton的使用(带有图片的按钮) 示例
效果:
调用方法:
var myImageButton=new Ext.ux.ImageButton({
imgPath : 'images/test.gif,
imgWidth : 60,
imgHeight : 60,
tooltip : 'test',//鼠标放上去的提示
handler : function(btn) {
Ext.MessageBox.alert(''test',''test'');
}
});
Ext.ux.ImageButton.js文件源码:
Ext.namespace('Ext.ux');
Ext.ux.ImageButton = function(cfg) {
Ext.ux.ImageButton.superclass.constructor.call(this, cfg);
};
Ext.extend(Ext.ux.ImageButton, Ext.Button, {
onRender : function(ct, position) {
this.disabledImgPath = this.disabledImgPath || this.imgPath;
var tplHTML = '<div><img src="{imgPath}" border="0" width="{imgWidth}" height="{imgHeight}" alt="{tooltip}" style="cursor: {cursor};"/> {imgText:htmlEncode}<br/><br/></div>';
var tpl = new Ext.Template(tplHTML);
var btn, targs = {
imgPath : this.disabled ? this.disabledImgPath : this.imgPath,
imgWidth : this.imgWidth || "",
imgHeight : this.imgHeight || "",
imgText : this.text || "",
cursor : this.disabled ? "default" : "pointer",
tooltip : this.tooltip || ""
};
btn = tpl.append(ct, targs, true);
btn.on("click", this.onClick, this);
if (this.cls) {
btn.addClass(this.cls);
}
this.el = btn;
if (this.hidden) {
this.hide();
}
},
disable : function(newImgPath) {
var replaceImgPath = newImgPath || this.disabledImgPath;
if (replaceImgPath)
this.el.dom.firstChild.src = replaceImgPath;
this.disabled = true;
},
enable : function(newImgPath) {
var replaceImgPath = newImgPath || this.imgPath;
if (replaceImgPath)
this.el.dom.firstChild.src = replaceImgPath;
this.disabled = false;
}
});
Ext.reg('imagebutton', Ext.ux.ImageButton);
分享到:
相关推荐
ImageButton按下切换图片.rar ImageButton按下切换图片.rar ImageButton按下切换图片.rar
陆陆续续完成了ImageView和Button控件的讲解之后,我们设想在Android中有没有一种图片按钮,这个图片按钮既可以显示图片又可以当作Button来使用?答案是——有的,本节内容我就来介绍这个ImageView和Button的和产物...
安卓Android源码——(ImageButton图片按钮).zip
安卓Android源码——(ImageButton图片按钮).rar
ImageButton图片按钮
Android ImageButton图片按钮Demo源码.rar
图片按钮网上虽然有很多,但总觉得不合用。不得以,只能自己写了。拿出来跟大家分享一下。 该图片按钮继承了Button,最大特点是支持按钮拉伸,也就是说不同大小的按钮只用一张图片就可以了。
Android 单击选中的ImageButton[]图像数组用法示例,类似于Radio的功能,不过用图片表现,这样可使Android UI更加友好,视觉更漂亮一些,用户轻触图片,即可选中该数据项,比Radio用户体验更好,如截图所示的选中...
图像按钮控件,用VC6.0实现,当鼠标移动到图片按钮上,会显示不一样的状态。
在C#中轻松实现WEB中的ImagesBUtton 功能 , 控件已经封装成DLL文件引用后直接调用就可以 ,下载后里面有示例及使用方法。
一直找不到漂亮的按钮控件。还是图片式的按钮最漂亮。该控件继承自System.Windows.Form.Button,具有mouseover,mousedown的效果。用户仅需提供三张图片(常态,mouseover,mousedown三个状态)即可! 附测试程序。
android imagebutton 来回切换图片
A0211图片按钮ImageButton的使用1
Windows.Phone7 ImageButton 源码
由于项目这种类型的图片按钮比较多,所以重写了ImageButton类。 代码如下:package me.henji.widget; import android.content.Context;import android.graphics.ColorMatrix;import android.graphics....
Android应用源码之(ImageButton图片按钮).zip项目安卓应用源码下载Android应用源码之(ImageButton图片按钮).zip项目安卓应用源码下载 1.适合学生毕业设计研究参考 2.适合个人学习研究参考 3.适合公司开发项目技术...
NULL 博文链接:https://royal2xiaose.iteye.com/blog/1420162
NULL 博文链接:https://andy2019.iteye.com/blog/1537481
android 具有背景图片的按钮 ImageButton的焦点事件以及事件处理
一个ImageButton实现背景图片的来回切换,并在不同状态实现不同的功能