请问用AS脚本可以画出这么漂亮的图表吗?

kony_han 2004-09-22 11:30:04
请问用As可以画出这么漂亮的图表吗?
能不能我们国人也写一个这样的图表!完全用as画出来!
http://javabeanone.gro.clinux.org/flash/area2.swf
分不够再加!
...全文
525 36 打赏 收藏 转发到动态 举报
写回复
用AI写文章
36 条回复
切换为时间正序
请发表友善的回复…
发表回复
cuixiping 2005-03-20
  • 打赏
  • 举报
回复
下面这个也是牛烘烘的!不错!

Aurigma Flash Chart
http://www.aurigma.com/Products/FlashChart/ChartGallery.aspx

效果: (绝对是动态画图的,可以让你输入数据提交再显示的)
http://www.aurigma.com/Demo/FlashChart/Demo1.aspx
http://everythingcyber.com/Demo/FlashChart/Demo1.aspx (同一家的两个域名)
francais 2005-02-22
  • 打赏
  • 举报
回复
sp
billows2000 2005-02-20
  • 打赏
  • 举报
回复
关注!!!
artmouse 2005-02-20
  • 打赏
  • 举报
回复
flash绝对可以画出这样的图表,其实最好是做成一个组件,那就牛了。
zheng_hz 2005-02-18
  • 打赏
  • 举报
回复
http://www.dembicki.org/path/vawes.html
iwhiter 2004-10-13
  • 打赏
  • 举报
回复
用反编软件出来的代码学习可以,当成自己的就自恋了

有能力反编一下这个 :)

flex做的flash图表

http://coenraets.com/apps/load.jsp?app=mortgage/calc

不用怀疑了
A_San 2004-10-08
  • 打赏
  • 举报
回复
上面是一个chart组件的关键代码
A_San 2004-10-08
  • 打赏
  • 举报
回复
this['note']['noteItem'+k].lineTo(this.fontSize-2,0);
this['note']['noteItem'+k].endFill();

this['note']['noteItem'+k].createTextField('label',1,this.fontSize+2,-4,10,10);//绘制文字
this['note']['noteItem'+k]['label'].text=this.Data.childNodes[k].attributes.value;
this['note']['noteItem'+k]['label'].selectable=false;

var myTextFormat = new TextFormat();
myTextFormat.font = this.fontFamily;
myTextFormat.size = this.fontSize;
myTextFormat.color = this.Data.childNodes[k].attributes.color;
this['note']['noteItem'+k]['label'].setTextFormat(myTextFormat);

this['note']['noteItem'+k]['label']._width=this['note']['noteItem'+k]['label'].textWidth+this.fontSize;
this['note']['noteItem'+k]['label']._height=this['note']['noteItem'+k]['label'].textHeight+4;

if(k==(this.Data.childNodes.length-1) && sType!='pie') {
var noteX0=this.originWidth+5;
var noteY0=this.originHeight-(k+1)*this.fontSize*1.2+this.fontSize*0.2+2;
this.note.createEmptyMovieClip('noteItem0',0);

this['note']['noteItem0'].onPress=function(){
var cur=parseInt(this._name.substring(8));
for(var i=1;i<this._parent._parent.Data.childNodes.length;i++) {
this['_parent']['_parent']['graph']['shape'+i]._visible=true;
}
}
this['note']['noteItem0']._x=noteX0;
this['note']['noteItem0']._y=noteY0;

this['note']['noteItem0'].lineStyle(0, this.lineColor, 100);
this['note']['noteItem0'].beginFill(this.lineColor, this.opacity);
this['note']['noteItem0'].lineTo(0,this.fontSize-2);
this['note']['noteItem0'].lineTo(this.fontSize-2,this.fontSize-2);
this['note']['noteItem0'].lineTo(this.fontSize-2,0);
this['note']['noteItem0'].endFill();

this['note']['noteItem0'].createTextField('label',1,this.fontSize+2,-4,10,10);//绘制文字
this['note']['noteItem0']['label'].text='All';
this['note']['noteItem0']['label'].selectable=false;

var myTextFormat = new TextFormat();
myTextFormat.font = this.fontFamily;
myTextFormat.size = this.fontSize;
myTextFormat.color = this.fontColor;
this['note']['noteItem0']['label'].setTextFormat(myTextFormat);

this['note']['noteItem0']['label']._width=this['note']['noteItem0']['label'].textWidth+this.fontSize;
this['note']['noteItem0']['label']._height=this['note']['noteItem0']['label'].textHeight+4;
}
}
}

function setPoint(distance,scale) {
return distance*100/(scale*2);
}
function fixMax(obj,prop) {
if(obj.attributes[prop]>=1) {//大于1的情况
var tempMax=obj.attributes[prop];
// tempMax=Math.ceil(tempMax);
tempMax=Math.floor(tempMax);
tempLn=tempMax.toString().split('.')[0].length;
tempMax=Math.ceil(tempMax/Math.pow(10,tempLn-1)+1)*Math.pow(10,tempLn-1);
// tempMax=Math.ceil(tempMax/(tempLn>1?10:1))*(tempLn>1?10:1);
obj.attributes[prop]=tempMax;
}
else if(obj.attributes[prop]>0) {
var tempMax=obj.attributes[prop];
//var tempRadix=Math.max(0,Math.floor(-Math.log(tempMax))-1);
//取小数点后0的个数
var tempLn=0;
while(tempMax*10<1) {
tempMax*=10;
tempLn++;
}
// tempMax=Math.ceil(tempMax)/Math.pow(10,tempLn);
tempMax=(tempMax<=0.5?0.5:1)/Math.pow(10,tempLn);
obj.attributes[prop]=tempMax;
}
}

Object.registerClass("Subtype", SubtypeClass);
#endinitclip
A_San 2004-10-08
  • 打赏
  • 举报
回复
this['graph']['shape'+k]['mark'+i].setTextFormat(myTextFormat);
this['graph']['shape'+k]['mark'+i]._width=Math.min(this.originWidth/count-3,this['graph']['shape'+k]['mark'+i].textWidth+4);
this['graph']['shape'+k]['mark'+i]._height=this['graph']['shape'+k]['mark'+i].textHeight+4;
this['graph']['shape'+k]['mark'+i]._x=tx+tw/2-this['graph']['shape'+k]['mark'+i]._width/2;
this['graph']['shape'+k]['mark'+i]._y=ty-this['graph']['shape'+k]['mark'+i].textHeight-2;
}
}
break;

////////////////绘制饼图////////////////////////////////////////////////////////////////////////////////////////////
case 'pie':
var precision=72;

for(var k=1;k<this.Data.childNodes.length;k++){//绘制饼图
this.graph.createEmptyMovieClip('shape'+k,k);
if(k!=1)this['graph']['shape'+k]._visible=false;
var begin=0;

for(var j=0;j<count;j++) {
var end=begin+parseFloat(this.Data.childNodes[k].childNodes[j].attributes.value)/this.Data.childNodes[k].total*precision;
end=Math.round(end);
this['graph']['shape'+k].createEmptyMovieClip('pie'+j,j);
this['graph']['shape'+k]['pie'+j]._x=this.originX;
this['graph']['shape'+k]['pie'+j]._y=this.originY;

this['graph']['shape'+k]['pie'+j].onRollOver=function() {
new Color(this).setTransform({ra:'255',ga:'255',ba:'255'});
}
this['graph']['shape'+k]['pie'+j].onRollOut=this['graph']['shape'+k]['pie'+j].onDragOut=function() {
new Color(this).setTransform({ra:'100',ga:'100',ba:'100'});
}
for(var i=begin;i<(end+1);i++) {
var terminalX=setPoint(this.originWidth,this._xscale)*Math.sin(i*Math.PI*2/precision+Math.PI);
var terminalY=setPoint(this.originHeight,this._yscale)*Math.cos(i*Math.PI*2/precision+Math.PI);

if(i!=begin) {//圆弧线
this['graph']['shape'+k]['pie'+j].lineStyle(0, this.lineColor, 100);
this['graph']['shape'+k]['pie'+j].lineTo(terminalX,terminalY);
}
else {//起点
var tempColor=this.Data.firstChild.childNodes[j].attributes.color;
if(tempColor==undefined) tempColor=this.Data.childNodes[k].attributes.color;
if(tempColor==undefined) tempColor=0x000000;
this['graph']['shape'+k]['pie'+j].beginFill(tempColor, this.opacity);
this['graph']['shape'+k]['pie'+j].lineStyle(0, this.lineColor, 0);

this['graph']['shape'+k]['pie'+j].moveTo(0,0);
this['graph']['shape'+k]['pie'+j].lineTo(terminalX,terminalY);
}
if(i==end) {//终止
if(j==(count-1))this['graph']['shape'+k]['pie'+j].lineTo(0,-setPoint(this.originHeight,this._yscale));
this['graph']['shape'+k]['pie'+j].lineStyle(0, this.lineColor, 100);
this['graph']['shape'+k]['pie'+j].lineTo(0,0);
this['graph']['shape'+k]['pie'+j].endFill();

this['graph']['shape'+k]['pie'+j].createTextField('label',1,0,0,10,10);
this['graph']['shape'+k]['pie'+j]['label'].text=this.Data.firstChild.childNodes[j].attributes.value+'\n'+Math.round(parseFloat(this.Data.childNodes[k].childNodes[j].attributes.value)/this.Data.childNodes[k].total*100)+'%';

var myTextFormat = new TextFormat();
myTextFormat.font = this.fontFamily;
myTextFormat.size = this.fontSize;
myTextFormat.color = this.fontColor;
myTextFormat.align = 'center';
this['graph']['shape'+k]['pie'+j]['label'].setTextFormat(myTextFormat);

this['graph']['shape'+k]['pie'+j]['label']._width=this['graph']['shape'+k]['pie'+j]['label'].textWidth+3;
this['graph']['shape'+k]['pie'+j]['label']._height=this['graph']['shape'+k]['pie'+j]['label'].textHeight+4;

this['graph']['shape'+k]['pie'+j]['label']._x=(setPoint(this.originWidth,this._xscale)*Math.sin((begin+end)*Math.PI/precision+Math.PI))/1.6-this['graph']['shape'+k]['pie'+j]['label']._width/2;
this['graph']['shape'+k]['pie'+j]['label']._y=(setPoint(this.originHeight,this._yscale)*Math.cos((begin+end)*Math.PI/precision+Math.PI))/1.6-this['graph']['shape'+k]['pie'+j]['label']._height/2;
}
}
begin=end;
}
}
break;
}
for(var k=1;k<this.Data.childNodes.length;k++) {
//绘制注释
var noteX0=this.originWidth+5;
var noteY0=this.originHeight-k*this.fontSize*1.2+this.fontSize*0.2+2;

this.note.createEmptyMovieClip('noteItem'+k,k);

this['note']['noteItem'+k].onPress=function(){
var cur=parseInt(this._name.substring(8));
for(var i=1;i<this._parent._parent.Data.childNodes.length;i++) {
if(i!=cur)this['_parent']['_parent']['graph']['shape'+i]._visible=false;
}
this['_parent']['_parent']['graph']['shape'+cur]._visible=true;
}
this['note']['noteItem'+k]._x=noteX0;
this['note']['noteItem'+k]._y=noteY0;

var tempColor=this.Data.childNodes[k].attributes.color;
if(tempColor==undefined) tempColor=0x000000;
this['note']['noteItem'+k].lineStyle(0,tempColor , 100);
this['note']['noteItem'+k].beginFill(tempColor, this.opacity);
this['note']['noteItem'+k].lineTo(0,this.fontSize-2);
this['note']['noteItem'+k].lineTo(this.fontSize-2,this.fontSize-2);
zheng_hz 2004-10-08
  • 打赏
  • 举报
回复
var ty=this.originHeight*(1-parseFloat(this.Data.childNodes[k].childNodes[i].attributes.value)/parseFloat(this.Data.firstChild.attributes.max));
if(i==0)this['graph']['shape'+k].moveTo(tx,ty);
else this['graph']['shape'+k].lineTo(tx,ty);
//显示标注数字
this['graph']['shape'+k].createTextField('mark'+i,i+1,0,0,1,10);
this['graph']['shape'+k]['mark'+i].text=this.Data.childNodes[k].childNodes[i].attributes.value;
var myTextFormat = new TextFormat();
myTextFormat.font = this.fontFamily;
myTextFormat.size = this.fontSize;
myTextFormat.color = this.Data.childNodes[k].attributes.color;
this['graph']['shape'+k]['mark'+i].setTextFormat(myTextFormat);
this['graph']['shape'+k]['mark'+i]._width=Math.min(this.originWidth/count-3,this['graph']['shape'+k]['mark'+i].textWidth+4);
this['graph']['shape'+k]['mark'+i]._height=this['graph']['shape'+k]['mark'+i].textHeight+4;
this['graph']['shape'+k]['mark'+i]._x=tx-this['graph']['shape'+k]['mark'+i]._width/2;
if(parseFloat(this.Data.childNodes[k].childNodes[i].attributes.value)<parseFloat(this.Data.childNodes[k].childNodes[i-1].attributes.value))this['graph']['shape'+k]['mark'+i]._y=ty-2;
else this['graph']['shape'+k]['mark'+i]._y=ty-this['graph']['shape'+k]['mark'+i].textHeight-2;
}
}
break;
////////////////绘制柱状图////////////////////////////////////////////////////////////////////////////////////////////
case 'histogram':

//修正最大值
if(this.Data.firstChild.firstChild.attributes.max==undefined) {
fixMax(this.Data.firstChild,'max');
}
//绘制参考线
this.coords.lineStyle(0, this.lineColor, 20);
var guideline=5;
for(var i=0;i<guideline;i++) {
this.coords.moveTo(0,this.originHeight/guideline*i);
this.coords.lineTo(this.originWidth,this.originHeight/guideline*i);

this.coords.createTextField('guide'+i,-i-1,0,0,1,10);
this['coords']['guide'+i].text=this.Data.firstChild.attributes.max*(1-i/guideline);

var myTextFormat = new TextFormat();
myTextFormat.font = this.fontFamily;
myTextFormat.size = this.fontSize;
myTextFormat.color = this.fontColor;
this['coords']['guide'+i].setTextFormat(myTextFormat);

this['coords']['guide'+i]._width=this['coords']['guide'+i].textWidth+4;
this['coords']['guide'+i]._height=this['coords']['guide'+i].textHeight+4;
this['coords']['guide'+i]._x=-this['coords']['guide'+i]._width;
this['coords']['guide'+i]._y=this.originHeight/guideline*i-this['coords']['guide'+i]._height/2;
}

this.coords.lineStyle(0, this.lineColor, 100);
this.coords.moveTo(0,0);
this.coords.lineTo(0,this.originHeight);
this.coords.lineTo(this.originWidth,this.originHeight);

for(var i=0;i<count;i++) {//显示字段名称
this.coords.createTextField('label'+i,i+1,0,0,1,10);
this['coords']['label'+i].text=this.Data.firstChild.childNodes[i].attributes.value;

var myTextFormat = new TextFormat();
myTextFormat.font = this.fontFamily;
myTextFormat.size = this.fontSize;
myTextFormat.color = this.fontColor;
this['coords']['label'+i].setTextFormat(myTextFormat);

this['coords']['label'+i]._width=Math.min(this.originWidth/count-3,this['coords']['label'+i].textWidth+4);
this['coords']['label'+i]._height=this['coords']['label'+i].textHeight+4;
this['coords']['label'+i]._x=this.originWidth*(i+1/2)/count-this['coords']['label'+i]._width/2;
this['coords']['label'+i]._y=this.originHeight;
this.coords.moveTo(this.originWidth*(i+1)/count,this.originHeight);
this.coords.lineTo(this.originWidth*(i+1)/count,this.originHeight-3);
}

var tw=this.originWidth/count*(Math.min(0.8,(this.Data.childNodes.length-1)*0.1+0.4))/(this.Data.childNodes.length-1);

for(var k=1;k<this.Data.childNodes.length;k++) {//绘制图形
this.graph.createEmptyMovieClip('shape'+k,k);

for(var i=0;i<count;i++) {
var tx=(this.originWidth/count-(this.Data.childNodes.length-1)*tw)/2+tw*(k-1)+this.originWidth/count*i;
var ty=this.originHeight*(1-parseFloat(this.Data.childNodes[k].childNodes[i].attributes.value)/parseFloat(this.Data.firstChild.attributes.max));

var tempColor=this.Data.childNodes[k].attributes.color;
if(tempColor==undefined)tempColor=0x000000;
this['graph']['shape'+k].lineStyle(0, tempColor, 100);
this['graph']['shape'+k].beginFill(tempColor, this.opacity);
this['graph']['shape'+k].moveTo(tx,this.originHeight);
this['graph']['shape'+k].lineTo(tx,ty);
this['graph']['shape'+k].lineTo(tx+tw,ty);
this['graph']['shape'+k].lineTo(tx+tw,this.originHeight);

this['graph']['shape'+k].lineStyle(0, tempColor, 0);
this['graph']['shape'+k].lineTo(tx,this.originHeight);
this['graph']['shape'+k].endFill();

//显示标注数字
this['graph']['shape'+k].createTextField('mark'+i,i+1,0,0,1,10);
this['graph']['shape'+k]['mark'+i].text=this.Data.childNodes[k].childNodes[i].attributes.value;
var myTextFormat = new TextFormat();
myTextFormat.font = this.fontFamily;
myTextFormat.size = this.fontSize;
myTextFormat.color = this.Data.childNodes[k].attributes.color;
zheng_hz 2004-10-08
  • 打赏
  • 举报
回复
if(tempColor==undefined) tempColor=0x000000;
this['graph']['shape'+k].lineStyle(0, tempColor, 100);
this['graph']['shape'+k].beginFill (tempColor, this.opacity);
for(var i=0;i<count;i++) {//绘制图形
if(i==0) {
var currentX=this.originX+setPoint(this.originWidth*parseFloat(this.Data.childNodes[k].childNodes[i].attributes.value)/parseFloat(this.Data.firstChild.childNodes[i].attributes.tmax),this._xscale)*Math.sin(i*Math.PI*2/count+Math.PI);
var currentY=this.originY+setPoint(this.originHeight*parseFloat(this.Data.childNodes[k].childNodes[i].attributes.value)/parseFloat(this.Data.firstChild.childNodes[i].attributes.tmax),this._yscale)*Math.cos(i*Math.PI*2/count+Math.PI);
this['graph']['shape'+k].moveTo(currentX, currentY);
}
var j=i+1;
if(i==count-1){
this['graph']['shape'+j].lineTo(currentX,currentY);
}
else {
var terminalX=this.originX+setPoint(this.originWidth*parseFloat(this.Data.childNodes[k].childNodes[j].attributes.value)/parseFloat(this.Data.firstChild.childNodes[j].attributes.tmax),this._xscale)*Math.sin(j*Math.PI*2/count+Math.PI);
var terminalY=this.originY+setPoint(this.originHeight*parseFloat(this.Data.childNodes[k].childNodes[j].attributes.value)/parseFloat(this.Data.firstChild.childNodes[j].attributes.tmax),this._yscale)*Math.cos(j*Math.PI*2/count+Math.PI);
this['graph']['shape'+k].lineTo(terminalX,terminalY);

}
//显示标注数字
var terminalX=this.originX+setPoint((this.originWidth+this.fontSize*1.5)*parseFloat(this.Data.childNodes[k].childNodes[i].attributes.value)/parseFloat(this.Data.firstChild.childNodes[i].attributes.tmax),this._xscale)*Math.sin(i*Math.PI*2/count+Math.PI);
var terminalY=this.originY+setPoint((this.originHeight+this.fontSize*1.5)*parseFloat(this.Data.childNodes[k].childNodes[i].attributes.value)/parseFloat(this.Data.firstChild.childNodes[i].attributes.tmax),this._yscale)*Math.cos(i*Math.PI*2/count+Math.PI);
this['graph']['shape'+k].createTextField('mark'+i,i+1,0,0,1,10);
this['graph']['shape'+k]['mark'+i].text=this.Data.childNodes[k].childNodes[i].attributes.value;
var myTextFormat = new TextFormat();
myTextFormat.font = this.fontFamily;
myTextFormat.size = this.fontSize;
myTextFormat.color = this.Data.childNodes[k].attributes.color;
this['graph']['shape'+k]['mark'+i].setTextFormat(myTextFormat);
this['graph']['shape'+k]['mark'+i]._width=Math.min(this.originWidth/count-3,this['graph']['shape'+k]['mark'+i].textWidth+4);
this['graph']['shape'+k]['mark'+i]._height=this['graph']['shape'+k]['mark'+i].textHeight+4;
this['graph']['shape'+k]['mark'+i]._x=terminalX-this['graph']['shape'+k]['mark'+i]._width/2;
this['graph']['shape'+k]['mark'+i]._y=terminalY-this['graph']['shape'+k]['mark'+i]._height/2;

}
this['graph']['shape'+k].endFill();
}
break;
////////////////绘制折线图////////////////////////////////////////////////////////////////////////////////////////////
case 'line':

//修正最大值
if(this.Data.firstChild.firstChild.attributes.max==undefined) {
fixMax(this.Data.firstChild,'max');
}
//绘制参考线
this.coords.lineStyle(0, this.lineColor, 20);
var guideline=5;
for(var i=0;i<guideline;i++) {
this.coords.moveTo(0,this.originHeight/guideline*i);
this.coords.lineTo(this.originWidth,this.originHeight/guideline*i);

this.coords.createTextField('guide'+i,-i-1,0,0,1,10);
this['coords']['guide'+i].text=this.Data.firstChild.attributes.max*(1-i/guideline);

var myTextFormat = new TextFormat();
myTextFormat.font = this.fontFamily;
myTextFormat.size = this.fontSize;
myTextFormat.color = this.fontColor;
this['coords']['guide'+i].setTextFormat(myTextFormat);

this['coords']['guide'+i]._width=this['coords']['guide'+i].textWidth+4;
this['coords']['guide'+i]._height=this['coords']['guide'+i].textHeight+4;
this['coords']['guide'+i]._x=-this['coords']['guide'+i]._width;
this['coords']['guide'+i]._y=this.originHeight/guideline*i-this['coords']['guide'+i]._height/2;
}

this.coords.lineStyle(0, this.lineColor, 100);
this.coords.moveTo(0,0);
this.coords.lineTo(0,this.originHeight);
this.coords.lineTo(this.originWidth,this.originHeight);

for(var i=0;i<count;i++) {//显示字段名称
this.coords.createTextField('label'+i,i+1,0,0,1,10);
this['coords']['label'+i].text=this.Data.firstChild.childNodes[i].attributes.value;

var myTextFormat = new TextFormat();
myTextFormat.font = this.fontFamily;
myTextFormat.size = this.fontSize;
myTextFormat.color = this.fontColor;
this['coords']['label'+i].setTextFormat(myTextFormat);

this['coords']['label'+i]._width=Math.min(this.originWidth/count-3,this['coords']['label'+i].textWidth+4);
this['coords']['label'+i]._height=this['coords']['label'+i].textHeight+4;
this['coords']['label'+i]._x=this.originWidth*(i+1/2)/count-this['coords']['label'+i]._width/2;
this['coords']['label'+i]._y=this.originHeight;
this.coords.moveTo(this.originWidth*(i+1)/count,this.originHeight);
this.coords.lineTo(this.originWidth*(i+1)/count,this.originHeight-3);
}

for(var k=1;k<this.Data.childNodes.length;k++) {//绘制图形
this.graph.createEmptyMovieClip('shape'+k,k);

var tempColor=this.Data.childNodes[k].attributes.color;
if(tempColor==undefined) tempColor=0x000000;
this['graph']['shape'+k].lineStyle(0, tempColor, 100);
this['graph']['shape'+k].moveTo(this.originWidth/(count*2),this.originHeight*(1-parseFloat(this.Data.childNodes[k].firstChild.attributes.value)/parseFloat(this.Data.firstChild.attributes.max)));

for(var i=0;i<count;i++) {
var tx=this.originWidth/count*(i+1/2);
zheng_hz 2004-10-08
  • 打赏
  • 举报
回复
#initclip

function SubtypeClass () {
this.placeholder_border._visible=false;
this.originX=this._width/2;
this.originY=this._height/2;
this.originWidth=this._width;
this.originHeight=this._height;
this._xscale=100;
this._yscale=100;
this.readData(this.url);
}

SubtypeClass.prototype = new MovieClip();

SubtypeClass.prototype.readData=function(url) {
this.createEmptyMovieClip('theTester',-1000);
var tmpData = new XML();
System.useCodePage = true;
tmpData.ignoreWhite = true;
tmpData.load(url);

this.theTester.onEnterFrame=function() {
if(tmpData.loaded) {
delete this.onEnterFrame;
this._parent.Data=tmpData.firstChild;
this._parent.drawGraph(this._parent.subType);
}
}
}

SubtypeClass.prototype.drawGraph=function(sType) {
this.subType=sType;
var count=this.Data.firstChild.childNodes.length;

for(var k=1;k<this.Data.childNodes.length;k++) {//取得各项的最大值等参数
this.Data.childNodes[k].total=0;
for(var i=0;i<count;i++) {
this.Data.childNodes[k].total+=parseFloat(this.Data.childNodes[k].childNodes[i].attributes.value);

var att=this.Data.firstChild.childNodes[i].attributes;
if(att.max!=undefined)att.tmax=att.max;
else if(k>1)att.tmax=Math.max(att.tmax,parseFloat(this.Data.childNodes[k].childNodes[i].attributes.value));
else att.tmax=parseFloat(this.Data.childNodes[k].childNodes[i].attributes.value);

var totalatt=this.Data.firstChild.attributes;//取得所有项的最大值
if(k>1)totalatt.max=Math.max(att.tmax,totalatt.max);
else totalatt.max=att.tmax;
}
}


this.createEmptyMovieClip('coords',0);
this.createEmptyMovieClip('graph',1);
this.createEmptyMovieClip('note',2);


switch(sType) {
////////////////绘制雷达图////////////////////////////////////////////////////////////////////////////////////////////
case 'radar':
for(var i=0;i<count;i++) {//显示文字
//修正各项最大值
if(this.Data.firstChild.childNodes[i].attributes.max==undefined) {
fixMax(this.Data.firstChild.childNodes[i],'tmax');
}
var terminalX=this.originX+setPoint(this.originWidth,this._xscale)*Math.sin(i*Math.PI*2/count+Math.PI);
var terminalY=this.originY+setPoint(this.originHeight,this._yscale)*Math.cos(i*Math.PI*2/count+Math.PI);

this.coords.lineStyle(0, this.lineColor, 100);
if(i!=0) {
this.coords.lineTo(terminalX,terminalY);
}
else {
this.coords.moveTo(terminalX,terminalY);
this.coords.lineTo(this.originX+setPoint(this.originWidth,this._xscale)*Math.sin((count-1)*Math.PI*2/count+Math.PI),this.originY+setPoint(this.originHeight,this._yscale)*Math.cos((count-1)*Math.PI*2/count+Math.PI));
}

this.coords.lineStyle(0, this.lineColor, 20);
this.coords.moveTo(this.originX, this.originY);
this.coords.lineTo(terminalX,terminalY);

this.coords.createTextField('label'+i,i+1,0,0,10,10);
this['coords']['label'+i].text=this.Data.firstChild.childNodes[i].attributes.value;

var myTextFormat = new TextFormat();
myTextFormat.font = this.fontFamily;
myTextFormat.size = this.fontSize;
myTextFormat.color = this.fontColor;
this['coords']['label'+i].setTextFormat(myTextFormat);

this['coords']['label'+i]._width=this['coords']['label'+i].textWidth+3;
this['coords']['label'+i]._height=this['coords']['label'+i].textHeight+4;
this['coords']['label'+i]._x=this.originX+setPoint((this.originWidth+this.fontSize*1.5),this._xscale)*Math.sin(i*Math.PI*2/count+Math.PI)-this['coords']['label'+i]._width/2;
this['coords']['label'+i]._y=this.originY+setPoint((this.originHeight+this.fontSize*1.5),this._yscale)*Math.cos(i*Math.PI*2/count+Math.PI)-this['coords']['label'+i]._height/2;

}

for(var k=1;k<this.Data.childNodes.length;k++) {
this.graph.createEmptyMovieClip('shape'+k,k);
var tempColor=this.Data.childNodes[k].attributes.color;
lewfn 2004-09-30
  • 打赏
  • 举报
回复
我认为,单用代码,写不出来,至少我写不出来。
应该是动画做的。
iwhiter 2004-09-29
  • 打赏
  • 举报
回复
to:zheng_hz(鸿鹄)

都看书还来讨论什么?你要是有想法就说出来大家讨论
折线和sin都简单,你既然有兴趣就自己调试一下,哪怕半成品拿上来大家交流下

说出来大家交流学习~

拿出来,我是真的想看
linuxbing 2004-09-29
  • 打赏
  • 举报
回复
to:kony_han(hcs)
我也正有此意阿,呵呵!!!
我现在正在做最简单的柱型动态图,做好后共享。感觉还是相当有用di
zheng_hz 2004-09-29
  • 打赏
  • 举报
回复
iwhiter(包子) 不要搞人生攻击。

曲线拟合是个数学问题,你要想搞明白,自己去看书,也没必要来骂我么。
linuxbing 2004-09-29
  • 打赏
  • 举报
回复
学习学习!!!
iwhiter 2004-09-28
  • 打赏
  • 举报
回复
姓zheng的,不会只长一张鸟嘴放屁吧!
iwhiter 2004-09-28
  • 打赏
  • 举报
回复
楼上得2鸟 讲一下你得曲线拟合手段
zheng_hz 2004-09-28
  • 打赏
  • 举报
回复
就是不会才关注阿.
加载更多回复(16)
亿图,为您提供一个多功能的,方便,快捷和专业的解决方案,让你享受你的工作。在企业环境中,在人力资源的乡亲需要是能够创建组织结构图,一些商业演示,也许一些方向性图和建筑平面图,引导游客通过设施。但是,在同一个公司,程序员和工程师也需要软件,可以让他们建立UML图,工作流程,程序结构,网页设计图,电气工程图和数据库图表。 有什么解决办法吗?购买一个图形程序,适合一组,但迫使对方妥协和凑合?或购买两个单独的图形程序,每个部门的特殊需求,并希望与贵公司同意购买?对没有上述怎么办? 亿图最大可让您创建图表图表,以满足所有这些要求和更。拥有超过4600矢量符号手绘插图和藏书丰富的图书馆,你将永远不会有以后再购买其他图形程序! 如果你是熟悉的Microsoft Office环境中,你会选择在任何时间持平亿图最大。使用模板,形状和绘图工具,你就可以直观地生成图表图表,比以往任何时候都更有效地传达信息。使用一拖和设计技术,结合自动校准和您所选择的颜色,字体和样式,图表亿图最大的是快速和容易。 亿图最大最好的一点是它的灵活性。您可以导入现有的Visio XML文件,以及多种图形格式,并创建亿图最大的项目,你可以在任何图形格式,支持完整的所见即所得的打印,或作为一个独立的可执行文件,甚至与他人分享出口。你甚至可以将图表链接到基础数据,提供更详细的信息,你的听众。 亿图最大开发商从来没有休息,因此,应用程序不断完善的软件更新,取得了比以往任何时候都更快的程序,用新的打印和导出大文件的支持。 为什么选择亿图最大 使用绘图软件,你所知道的最好的地图和你的方向。 完全基于矢量的图形软件,这有利于快速创建流程图,组织结构图,网络图和更多。 完美支持导入存在的Visio XML文件。 只要拖动生成在形状库窗格,并把它们在您的网页上的。图再简单不过了! 快速创建具有专业外观的图表为主题,效果和快速样式。 在图表的功能,如自动对齐,并安排各种形状获得更大的生产力。 包括大量的高品质的图形,示例和模板。 不同的颜色,字体,形状,样式,图片,文字和符号,为每个图表对象。 轻松,直观地呈现复杂的信息具有广泛的图表。这些图表更聪明和更有用的基​​础数据,它提供了一个更完整的系统或过程的。 与MS Office。它可以集成到Microsoft Office应用程序很容易。 UI是MS Office的风格一样,很容易学习和使用。如果你是熟悉的MS Office,你是熟悉亿图迅速。 泛型图形格式的支持和所见即所得的打印。 新功能 UI是MS Office 2010风格一样。完整的功能区的功能。 新增主题,颜色主题,效果和字体。易改变整个图通过改变活动的主题。随着新的“主题”功能,您可以格式化整个图表的颜色和效果在一个单一的点击。 实时预览。当你在各种画廊亿图滚动,你会看到您的图纸和各种对象的改变,以显示他们会像什么,如果你决定应用这些设置。只需点击画廊中的缩略图接受的变化。这使得它速度快了很多见,例如,如何改变颜色方案会影响您的图纸。 快速布局和快速的风格。这些提供了快速格式化选项中的对象,并很容易地创建漂亮的幻灯片,只需点击几下。 亿图的图形放置到Word,Excel,PowerPoint中一键式按钮。 支持文本对象的行空间,子弹,缩进,背景色,超级脚本,子脚本,并更多。 一般的阴影是非常漂亮的,在以前的版本中。事实上,我们可以控制的透明度,模糊量和颜色。 形状和文本预设使它很容易申请的对象或文本预设的外观。 它的速度更快,放大和缩小,现在使用的缩放滑块东南角的屏幕。 表支持。 图片重新着色,光线和反差的,透明的PNG支持。 开业形状表为高级用户创建更复杂的形状。 更多2000的剪贴画。 改进的“插入超链接”功能。 改进的打印功能。支持更多的页面大小,如A0,A1。您也可以在单独的页面上打印大尺寸的图形。 持久的撤消和重做。 高品质的图形输出。轻松创建SVG图形。 基于矢量的, 亿图最大是一个基于矢量的绘图软件,这意味着不论大小,你改变图中,将始终保持高品质。 简单和友好的用户界面 亿图UI是MS Office的风格一样,很容易学习和使用。如果你是熟悉的MS Office,你是熟悉亿图迅速。 与MS Office 亿图提供了多种方式的合作与MS Office系统。 您可以复制选定的形状,然后将其粘贴到MS Office文档。 您可以在MS Office应用程序中插入OLE对象的亿图。 您还可以导出图纸仿制药的图形格式,如JPG,TIF,BMP。然后切换到MS Office和插入图片。 支持几乎所有类型的图形格式 支持几乎所有的仿制药的图形格式,它可以导出或导入这些常见的图形格式,如BMP,GIF,DIB,PNG,TIF,WMF,EMF,HTML等。 保存为EXE文件,并没有与他人共享亿图 您可以保存您的绘图文件exe格式,并分享它与任何你想要的,即使它没有亿图安装。 如Illustrator提供的绘图工具 提供一组的绘图工具,如Adobe Illustrator,使用这些工具,您可以绘制自己的形状或更改库中的形状。 自动分布形状 亿图可以帮助您对齐和自动安排所有的形状,这将加速你的工作。 强式的系统和大量美丽的建立的样式 亿图有一个方便,快捷的风格,并提供了大量的预定义样式,它可以帮助你让你的图美丽和个人在很短的时间。 涉及各种领域的丰富的库和模板 提供丰富的库和模板包括流程图,组织结构图,建立计划,网络图和更多。 定义和管理自己的库和模板 您可以绘制自己的形状和文件另存为库和模板,并利用它们作为预先定义的库和模板。 更新策略 你放心,我们最优质的产品和最有力的支持。维护更新费是免费的,直到永远。主要的升级是免费提供的12个月内。相对亿图,产品具有较高的价格太昂贵的更新。 真正的用户说 在平常的元素,你可以看到任何类似的解决方案,亿图最大的现代化接口,巨大,巧妙地库原语,随着许多例子和教程提供了一个完整的电源。当你刚开始工作的一个新的亿图最大图,你会被要求选择其“种”,该软件为您提供了相应的原语。当然,你总是可以装载更多的原语,甚至是搜索他们的名字。亿图最大,覆盖所有的领域,你能想象计划和图表流程图,数据库架构,组织结构图,思维导图,网络和更多的图表,种有几个部分的形状库中的各种图,以及附带的软件的几个例子。您可以保存自己的形状的形状库中,以便今后使用。亿图绘制本身,最大提供了一个非常方便的矢量编辑器,方便的形状分组,锁定和组织,选择和缩放,你可以控制各种形状的所有参数(颜色,字体和线条),无论是你,还是从库。在严格的对应的屏幕画面,所有的美所设计的图片,你可以很容易地导出和打印。 亿图最大,而一个轻量级但令人难以置信的强大的图形软件,可以帮助您与您的绘图和图形的需要 – 组织和流程图 – 数据库设计,家的地板,时尚的设计。软件开发人员也可以使用亿图绘制UML(统一建模语言)的图,以可视化的设计。 如果流程图是唯一你打算使用它时,Visio可能是一个有点矫枉过正。如果你想使用其他的东西太虽然这将是更好的价值的钱。 Visio是太贵了,我的口味,我已经找到了一个很好的流程图绘制软件。我只是想写信亿图是很有价值的钱!这是很容易使用! Edraw Max enables students, teachers and business professionals to reliably create and publish kinds of diagrams to represent any ideas. Edraw Max is an all-in-one diagram software that makes it simple to create professional-looking flowcharts, organizational charts, network diagrams, business presentations, building plans, mind maps, science illustration, fashion designs, UML diagrams, workflows, program structures, web design diagrams, electrical engineering diagrams, directional maps, database diagrams and more. With large pre-drawn libraries and more than 5000 vector symbols, drawing couldn’t be easier! Edraw Max lets you create a wide range of diagrams using templates, shapes, and drawing tools while working in an intuitive and familiar Office-style environment. New Features • The UI is MS Office 2010 style like. Full ribbon features. • Added Themes, Color Themes, Effects and Fonts. Easy to change the whole diagram by changing the active theme. With the new Theme feature, you can format the colors and effects in an entire diagram with a single click. • Real-time previews. When you scroll over the various galleries in Edraw, you’ll see your drawings and various objects change to display what they’ll look like if you decide to apply those settings. Just click on the thumbnail in the gallery to actually accept the changes. This makes it a lot faster to see, for example, how changing a color scheme will affect your drawings. • Quick layouts and quick styles. These provide quick formatting options for the object in question, and make it easy to create good-looking slides with just a few clicks. • Put Edraw graphics into Word, Excel, PowerPoint with one-click buttons. • Text objects supported line space, bullet, Indent, back color, super script, sub script and more. • Shadows in general are so very nice compared to those in previous versions. We can actually control the transparency, amount of blur, and color now. • Shape and text presets make it really easy to apply a preset look to an object or text. • It’s quicker to zoom in and out now using the zoom slider in the southeast corner of the screen. • Table support. • Recolor picture, Light and Contrast, transparent PNG support. • Opened the Shape Sheet for senior users to create more complicated shapes. • More 2000 clip arts. • Improved the Insert Hyperlink function. • Improved the Print function. Support more page sizes such as A0, A1. You can also print the large size graphics in separate pages. • Persistent undo and redo. • High quality graphic export. Easy to create SVG graphics.
自动生成VBA窗体菜单 '*************************** '* 菜单类 * '*************************** Option Explicit Private WithEvents MenuBar_MenuItem As MSForms.Label '菜单项 Private WithEvents WorkForm As MSForms.UserForm '工作窗口 Private WithEvents MenuBar As MSForms.Image '菜单栏 Private BackMenu_BackGroud As MSForms.Image '菜单背景图片 Private BackMenu_Caption As MSForms.Label '菜单标题标签 Private Const DISTANCE As Integer = 5 '菜单与左边框距离 Private Const MENUTOP As Integer = 2 '菜单项顶点Y轴位置 Private Const MENUHEIGHT As Integer = 14 '菜单项高度 Private intIndex As Integer '索引变量 Private sAction As String '宏名称变量 Private Property Let Index(N As Byte) '指定索引属性 intIndex = N End Property Private Property Get Index() As Byte '获得陇望蜀索引属性 Index = intIndex End Property Private Property Let OnAction(sAct As String) '行为属性 sAction = sAct End Property Private Property Get OnAction() As String OnAction = sAction End Property Public Sub AddMenu(wform As MSForms.UserForm, sCaption As String, sAction As String, Optional Acc As String = vbNullString) Dim MenuLeft As Single, MenuWidth As Single '由两个标签和一个图形控件组成一个主菜单项 MenuCount = MenuCount + 1 '主菜单项总数加1 Index = MenuCount '设置索引 Set WorkForm = wform With WorkForm Set MenuBar = .FormMenuBar Set BackMenu_Caption = .Controls.Add("forms.label.1") '添加一个标签,显示菜单标题 With BackMenu_Caption .Accelerator = Acc .AutoSize = True .BackStyle = fmBackStyleTransparent .Caption = sCaption .Font = "宋体" .Font.Size = 9 .Name = "BackMenu_Caption" & MenuCount .TextAlign = fmTextAlignCenter .Top = MENUTOP + 3 .WordWrap = False .Visible = True End With If MenuCount = 1 Then MenuLeft = DISTANCE Else With .Controls("BackMenu_Caption" & MenuCount - 1) MenuLeft = .Left + .Width End With End If MenuWidth = BackMenu_Caption.Width + 10 Set BackMenu_BackGroud = .Controls.Add("forms.image.1") '添加一个image,作为背景图片 With BackMenu_BackGroud .Name = "BackMenu_BackGroud" & MenuCount .BorderStyle = fmBorderStyleNone .Move MenuLeft, MENUTOP, MenuWidth, MENUHEIGHT .BackStyle = fmBackStyleTransparent .PictureSizeMode = fmPictureSizeModeStretch BackMenu_Caption.AutoSize = False BackMenu_Caption.Left = .Left BackMenu_Caption.Width = .Width End With BackMenu_Caption.ZOrder '将标签置前 Set MenuBar_MenuItem = .Controls.Add("forms.label.1") '添加一个Label,用于触发事件 With MenuBar_MenuItem .Name = "MenuBar_MenuItem" & MenuCount .BorderStyle = fmBorderStyleNone .BackStyle = fmBackStyleTransparent With BackMenu_BackGroud MenuBar_MenuItem.Move .Left, .Top, .Width, .Height End With End With End With OnAction = sAction End Sub Private Sub MenuBar_MenuItem_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) If Button = 1 Then bMenuSelected = True: Menu_Select End Sub Private Sub MenuBar_Click() UnSelectLastMenu bMenuSelected = False End Sub Private Sub MenuBar_MenuItem_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) UnSelectLastMenu Call Menu_Select End Sub Private Sub MenuBar_MouseMove1(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) If Not bMenuSelected Then UnSelectLastMenu End Sub Private Sub WorkForm_Click() '窗体单击时 UnSelectLastMenu bMenuSelected = False End Sub Private Sub WorkForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) If Not bMenuSelected Then UnSelectLastMenu '窗体 End Sub Private Sub Menu_Select() '选择菜单 On Error Resume Next Dim Pt_Menu_RightBottom As POINTAPI, Pt_Menu_LeftTop As POINTAPI With WorkForm UnSelectLastMenu Set LastSelect_Menu = BackMenu_BackGroud With BackMenu_BackGroud .BorderStyle = fmBorderStyleSingle .BorderColor = RGB(0, 0, 128) .BackStyle = fmBackStyleOpaque If bMenuSelected = False Then WorkForm.Controls("BackMenu_BackGroud" & Index).BackColor = &HFFC0C0 Else WorkForm.Controls("BackMenu_BackGroud" & Index).BackColor = &HE0E0E0 pt.X = MenuBar_MenuItem.Left * 1.33 pt.Y = (MenuBar_MenuItem.Top + MenuBar_MenuItem.Height) * 1.33 + 3 ClientToScreen hForm, pt If OnAction "" Then Application.Run OnAction End If End If End With End With End Sub Private Sub UnSelectLastMenu() '取消上次选择 If Not LastSelect_Menu Is Nothing Then With LastSelect_Menu .Picture = LoadPicture() .BackStyle = fmBackStyleTransparent .BorderStyle = fmBorderStyleNone End With End If End Sub '********本模块结束********** '*************************** '* 菜单执行模块 * '*************************** Public Type POINTAPI X As Long Y As Long End Type Public Declare Function FindWindow Lib "user32.dll" Alias"FindWindowA"(ByVal lpClassName As String, ByVal lpWindowName As String) As Long Public Declare Function ClientToScreen Lib"user32"(ByVal hwnd As Long, lpPoint As POINTAPI) As Long Public Popup_Menu As CommandBar '指定弹出式菜单 Public LastSelect_Menu As MSForms.Image '最后选择的菜单 Public MenuCount As Integer '子菜单数量 Public hForm As Long '窗口句柄 Public intLevel As Integer '级别标识,用于设置Radio菜单(游戏菜单中:初级,中级,高级) Public bAbortEnabled As Boolean '标识放弃菜单项是否可用 Public bItemCheck As Boolean '标识音效菜单是否CheckOn Public bMenuSelected As Boolean '标识菜单是否点击 Public pt As POINTAPI '定义点 Public faceid As Integer '图标ID Public faceidselect As Integer '选择的图标 Public fistid As Integer '第一个图标号 Public lastid As Integer '最后一个图标号 Public selectrow,selectcol as integer Public Mcro(50) AS String SUB 文件() Clear_menu '清除弹出菜单上菜单项 Dim cmb As CommandBarControl AddCustomCommandBarPopup1 "打开 ", "", False, True,33,"" AddCustomCommandBarPopup1 "新建 ", "BB", False, True,18,"" AddCustomCommandBarPopup2 ("另存为 ") Set cmb = Application.CommandBars("CELL").Controls("另存为 ") AddCustomCommandBarPopup3 cmb, "OFFICE 97-2003文件 ", "DD", False, True, 3, "" Set cmb = Application.CommandBars("CELL").Controls("另存为 ") AddCustomCommandBarPopup4 cmb, "OFFICE 2007工作表 " Set cmb = Application.CommandBars("CELL").Controls("另存为 ").Controls("OFFICE 2007工作表 ") AddCustomCommandBarPopup3 cmb, "office 2007启用宏的工作表 ", "FF", False, True, 0, "" Set cmb = Application.CommandBars("CELL").Controls("另存为 ").Controls("OFFICE 2007工作表 ") AddCustomCommandBarPopup3 cmb, "OFFICE 2007工作表 ", "GG", False, True, 253, "" Popup_Menu.ShowPopup pt.X, pt.Y END SUB SUB 公式() Clear_menu '清除弹出菜单上菜单项 Dim cmb As CommandBarControl AddCustomCommandBarPopup1 "文本 ", "WB", False, True,7,"" AddCustomCommandBarPopup2 ("名称 ") Set cmb = Application.CommandBars("CELL").Controls("名称 ") AddCustomCommandBarPopup3 cmb, "定义 ", "DY", False, True, 0, "" Set cmb = Application.CommandBars("CELL").Controls("名称 ") AddCustomCommandBarPopup4 cmb, "单元格 " Set cmb = Application.CommandBars("CELL").Controls("名称 ").Controls("单元格 ") AddCustomCommandBarPopup3 cmb, "合并 ", "HB", False, True, 592, "" Set cmb = Application.CommandBars("CELL").Controls("名称 ").Controls("单元格 ") AddCustomCommandBarPopup3 cmb, "从属 ", "CS", False, True, 564, "" Popup_Menu.ShowPopup pt.X, pt.Y END SUB SUB 开发工具() Clear_menu '清除弹出菜单上菜单项 Dim cmb As CommandBarControl AddCustomCommandBarPopup1 "插入 ", "CR", False, True,548,"" AddCustomCommandBarPopup1 "模式 ", "MS", False, True,590,"" AddCustomCommandBarPopup2 ("宏 ") Set cmb = Application.CommandBars("CELL").Controls("宏 ") AddCustomCommandBarPopup3 cmb, "录制宏 ", "LZH", False, True, 205, "" Set cmb = Application.CommandBars("CELL").Controls("宏 ") AddCustomCommandBarPopup3 cmb, "安全性 ", "AQX", False, True, 279, "" Set cmb = Application.CommandBars("CELL").Controls("宏 ") AddCustomCommandBarPopup3 cmb, "查看代码 ", "CKDM", False, True, 289, "" Popup_Menu.ShowPopup pt.X, pt.Y END SUB SUB 窗口() Clear_menu '清除弹出菜单上菜单项 Dim cmb As CommandBarControl AddCustomCommandBarPopup1 "并列比较 ", "BLBJ", False, True,250,"" AddCustomCommandBarPopup1 "冻结 ", "DJ", False, True,288,"" AddCustomCommandBarPopup1 "隐藏 ", "YC", False, True,237,"" AddCustomCommandBarPopup1 "拆分 ", "CF", False, True,292,"" AddCustomCommandBarPopup1 "取消冻结 ", "QXDJ", False, True,232,"" Popup_Menu.ShowPopup pt.X, pt.Y END SUB SUB 工具() Clear_menu '清除弹出菜单上菜单项 Dim cmb As CommandBarControl AddCustomCommandBarPopup1 "拼写检查 ", "PXJC", False, True,246,"" AddCustomCommandBarPopup2 ("保护 ") Set cmb = Application.CommandBars("CELL").Controls("保护 ") AddCustomCommandBarPopup3 cmb, "保护工作表 ", "BHGZB", False, True, 277, "" Set cmb = Application.CommandBars("CELL").Controls("保护 ") AddCustomCommandBarPopup3 cmb, "保护工作薄 ", "BHGZBB", False, True, 312, "" Set cmb = Application.CommandBars("CELL").Controls("保护 ") AddCustomCommandBarPopup3 cmb, "工作表菜单栏 ", "gzbcdl", False, True, 142, "" Set cmb = Application.CommandBars("CELL").Controls("保护 ") AddCustomCommandBarPopup3 cmb, "图表菜单栏 ", "tbgjl", False, True, 164, "" Popup_Menu.ShowPopup pt.X, pt.Y END SUB SUB 常用() Clear_menu '清除弹出菜单上菜单项 Dim cmb As CommandBarControl AddCustomCommandBarPopup1 "格式 ", "gs", False, True,108,"" AddCustomCommandBarPopup1 "数据透视表 ", "sjtsb", False, True,125,"" AddCustomCommandBarPopup1 "图表 ", "tb", False, True,127,"" AddCustomCommandBarPopup1 "审阅 ", "sy", False, True,124,"" AddCustomCommandBarPopup1 "窗体 ", "ct", False, True,128,"" AddCustomCommandBarPopup1 "停止录制 ", "tzlz", False, True,185,"" AddCustomCommandBarPopup2 ("外部数据 ") Set cmb = Application.CommandBars("CELL").Controls("外部数据 ") AddCustomCommandBarPopup3 cmb, "公式审核 ", "gssh", False, True, 129, "" Set cmb = Application.CommandBars("CELL").Controls("外部数据 ") AddCustomCommandBarPopup3 cmb, "全屏显示 ", "qpxs", False, True, 130, "" Set cmb = Application.CommandBars("CELL").Controls("外部数据 ") AddCustomCommandBarPopup3 cmb, "循环引用 ", "xhye", False, True, 132, "" Set cmb = Application.CommandBars("CELL").Controls("外部数据 ") AddCustomCommandBarPopup4 cmb, "VisualBasic " Set cmb = Application.CommandBars("CELL").Controls("外部数据 ").Controls("VisualBasic ") AddCustomCommandBarPopup3 cmb, "Web ", "web", False, True, 173, "" Set cmb = Application.CommandBars("CELL").Controls("外部数据 ").Controls("VisualBasic ") AddCustomCommandBarPopup3 cmb, "控件工具箱 ", "kjgjx", False, True, 174, "" Set cmb = Application.CommandBars("CELL").Controls("外部数据 ").Controls("VisualBasic ") AddCustomCommandBarPopup3 cmb, "退出设计模式 ", "tcsjms", False, True, 162, "" Set cmb = Application.CommandBars("CELL").Controls("外部数据 ").Controls("VisualBasic ") AddCustomCommandBarPopup3 cmb, "刷新 ", "sx", False, True, 165, "" Set cmb = Application.CommandBars("CELL").Controls("外部数据 ").Controls("VisualBasic ") AddCustomCommandBarPopup3 cmb, "监视窗口 ", "jsck", False, True, 168, "" Set cmb = Application.CommandBars("CELL").Controls("外部数据 ").Controls("VisualBasic ") AddCustomCommandBarPopup3 cmb, "数据透视表字段列表 ", "sjtsbzdb", False, True, 170, "" Set cmb = Application.CommandBars("CELL").Controls("外部数据 ").Controls("VisualBasic ") AddCustomCommandBarPopup3 cmb, "边框 ", "bk", False, True, 178, "" Set cmb = Application.CommandBars("CELL").Controls("外部数据 ").Controls("VisualBasic ") AddCustomCommandBarPopup3 cmb, "保护 ", "bh", False, True, 160, "" Set cmb = Application.CommandBars("CELL").Controls("外部数据 ").Controls("VisualBasic ") AddCustomCommandBarPopup3 cmb, "文本到语音 ", "wbdyy", False, True, 164, "" Popup_Menu.ShowPopup pt.X, pt.Y END SUB SUB 列表() Clear_menu '清除弹出菜单上菜单项 Dim cmb As CommandBarControl AddCustomCommandBarPopup1 "并排比较 ", "bpbj1", False, True,180,"" AddCustomCommandBarPopup1 "绘图 ", "bpbj2", False, True,182,"" AddCustomCommandBarPopup1 "数据透视图菜单 ", "bpbj3", False, True,184,"" AddCustomCommandBarPopup2 ("工作簿标签 ") AddCustomCommandBarPopup2 ("单元格 ") Set cmb = Application.CommandBars("CELL").Controls("单元格 ") AddCustomCommandBarPopup3 cmb, "列 ", "bpbj6", False, True, 190, "" Set cmb = Application.CommandBars("CELL").Controls("单元格 ") AddCustomCommandBarPopup3 cmb, "行 ", "bpbj7", False, True, 192, "" Set cmb = Application.CommandBars("CELL").Controls("单元格 ") AddCustomCommandBarPopup3 cmb, "单元格 ", "bpbj8", False, True, 194, "" Set cmb = Application.CommandBars("CELL").Controls("单元格 ") AddCustomCommandBarPopup3 cmb, "柱形图 ", "bpbj9", False, True, 196, "" Set cmb = Application.CommandBars("CELL").Controls("单元格 ") AddCustomCommandBarPopup3 cmb, "行 ", "bpbj10", False, True, 198, "" Set cmb = Application.CommandBars("CELL").Controls("单元格 ") AddCustomCommandBarPopup4 cmb, "工作表 " Set cmb = Application.CommandBars("CELL").Controls("单元格 ").Controls("工作表 ") AddCustomCommandBarPopup3 cmb, "XLM 单元格 ", "bpbj12", False, True, 202, "" Set cmb = Application.CommandBars("CELL").Controls("单元格 ").Controls("工作表 ") AddCustomCommandBarPopup3 cmb, "文档 ", "bpbj13", False, True, 204, "" Set cmb = Application.CommandBars("CELL").Controls("单元格 ").Controls("工作表 ") AddCustomCommandBarPopup3 cmb, "桌面 ", "bpbj14", False, True, 206, "" Set cmb = Application.CommandBars("CELL").Controls("单元格 ").Controls("工作表 ") AddCustomCommandBarPopup3 cmb, "非默认拖放 ", "bpbj15", False, True, 208, "" Set cmb = Application.CommandBars("CELL").Controls("单元格 ").Controls("工作表 ") AddCustomCommandBarPopup3 cmb, "自动填充 ", "bpbj16", False, True, 210, "" Set cmb = Application.CommandBars("CELL").Controls("单元格 ").Controls("工作表 ") AddCustomCommandBarPopup3 cmb, "按钮 ", "bpbj17", False, True, 212, "" Set cmb = Application.CommandBars("CELL").Controls("单元格 ").Controls("工作表 ") AddCustomCommandBarPopup3 cmb, "对话框 ", "bpbj18", False, True, 214, "" Popup_Menu.ShowPopup pt.X, pt.Y END SUB SUB 序列() Clear_menu '清除弹出菜单上菜单项 Dim cmb As CommandBarControl AddCustomCommandBarPopup1 "图形区 ", "bpbj20", False, True,218,"" AddCustomCommandBarPopup1 "基底和墙纸 ", "bpbj21", False, True,220,"" AddCustomCommandBarPopup1 "趋势线 ", "bpbj22", False, True,222,"" AddCustomCommandBarPopup1 "图表 ", "bpbj23", False, True,224,"" AddCustomCommandBarPopup1 "设置数据系列格式 ", "bpbj24", False, True,226,"" AddCustomCommandBarPopup2 ("设置数据轴格式 ") Set cmb = Application.CommandBars("CELL").Controls("设置数据轴格式 ") AddCustomCommandBarPopup3 cmb, "设置图例项格式 ", "bpbj26", False, True, 230, "" Set cmb = Application.CommandBars("CELL").Controls("设置数据轴格式 ") AddCustomCommandBarPopup3 cmb, "编辑栏 ", "bpbj27", False, True, 232, "" Set cmb = Application.CommandBars("CELL").Controls("设置数据轴格式 ") AddCustomCommandBarPopup3 cmb, "数据透视表上下文菜单 ", "bpbj28", False, True, 234, "" Set cmb = Application.CommandBars("CELL").Controls("设置数据轴格式 ") AddCustomCommandBarPopup3 cmb, "查询 ", "bpbj29", False, True, 236, "" Set cmb = Application.CommandBars("CELL").Controls("设置数据轴格式 ") AddCustomCommandBarPopup3 cmb, "查询布局 ", "bpbj30", False, True, 238, "" Set cmb = Application.CommandBars("CELL").Controls("设置数据轴格式 ") AddCustomCommandBarPopup4 cmb, "自动计算 " Set cmb = Application.CommandBars("CELL").Controls("设置数据轴格式 ").Controls("自动计算 ") AddCustomCommandBarPopup3 cmb, "对象/图形区 ", "bpbj32", False, True, 242, "" Set cmb = Application.CommandBars("CELL").Controls("设置数据轴格式 ").Controls("自动计算 ") AddCustomCommandBarPopup3 cmb, "标题栏(图表) ", "bpbj33", False, True, 244, "" Popup_Menu.ShowPopup pt.X, pt.Y END SUB SUB 框架() Clear_menu '清除弹出菜单上菜单项 Dim cmb As CommandBarControl AddCustomCommandBarPopup1 "数据透视图快捷菜单 ", "bpbj35", False, True,248,"" AddCustomCommandBarPopup1 "拼音信息 ", "bpbj36", False, True,250,"" AddCustomCommandBarPopup1 "自动合计 ", "bpbj37", False, True,252,"" AddCustomCommandBarPopup1 "选择性粘贴下拉框 ", "bpbj38", False, True,254,"" AddCustomCommandBarPopup2 ("查找格式 ") Set cmb = Application.CommandBars("CELL").Controls("查找格式 ") AddCustomCommandBarPopup3 cmb, "替换格式 ", "bpbj40", False, True, 258, "" Set cmb = Application.CommandBars("CELL").Controls("查找格式 ") AddCustomCommandBarPopup3 cmb, "列表区域快捷菜单 ", "bpbj41", False, True, 260, "" Set cmb = Application.CommandBars("CELL").Controls("查找格式 ") AddCustomCommandBarPopup3 cmb, "列表区域布局快捷菜单 ", "bpbj42", False, True, 262, "" Set cmb = Application.CommandBars("CELL").Controls("查找格式 ") AddCustomCommandBarPopup3 cmb, "XML 区域快捷菜单 ", "bpbj43", False, True, 264, "" Set cmb = Application.CommandBars("CELL").Controls("查找格式 ") AddCustomCommandBarPopup3 cmb, "列表区域布局快捷菜单 ", "bpbj44", False, True, 266, "" Set cmb = Application.CommandBars("CELL").Controls("查找格式 ") AddCustomCommandBarPopup3 cmb, "艺术字 ", "bpbj45", False, True, 268, "" AddCustomCommandBarPopup2 ("图片 ") Set cmb = Application.CommandBars("CELL").Controls("图片 ") AddCustomCommandBarPopup3 cmb, "阴影设置 ", "bpbj47", False, True, 272, "" AddCustomCommandBarPopup2 ("三维设置 ") Set cmb = Application.CommandBars("CELL").Controls("三维设置 ") AddCustomCommandBarPopup3 cmb, "绘图画布 ", "bpbj49", False, True, 276, "" Set cmb = Application.CommandBars("CELL").Controls("三维设置 ") AddCustomCommandBarPopup3 cmb, "组织结构图 ", "bpbj50", False, True, 278, "" Set cmb = Application.CommandBars("CELL").Controls("三维设置 ") AddCustomCommandBarPopup3 cmb, "图示 ", "bpbj51", False, True, 280, "" Set cmb = Application.CommandBars("CELL").Controls("三维设置 ") AddCustomCommandBarPopup3 cmb, "墨迹绘图与书写 ", "bpbj52", False, True, 282, "" Set cmb = Application.CommandBars("CELL").Controls("三维设置 ") AddCustomCommandBarPopup3 cmb, "墨迹注释 ", "bpbj53", False, True, 284, "" AddCustomCommandBarPopup2 ("边框 ") Set cmb = Application.CommandBars("CELL").Controls("边框 ") AddCustomCommandBarPopup3 cmb, "边框 ", "bpbj55", False, True, 288, "" Set cmb = Application.CommandBars("CELL").Controls("边框 ") AddCustomCommandBarPopup4 cmb, "绘图边框 " Set cmb = Application.CommandBars("CELL").Controls("边框 ").Controls("绘图边框 ") AddCustomCommandBarPopup3 cmb, "图表类型 ", "bpbj57", False, True, 292, "" Set cmb = Application.CommandBars("CELL").Controls("边框 ").Controls("绘图边框 ") AddCustomCommandBarPopup3 cmb, "图案 ", "bpbj58", False, True, 294, "" Set cmb = Application.CommandBars("CELL").Controls("边框 ").Controls("绘图边框 ") AddCustomCommandBarPopup3 cmb, "字体颜色 ", "bpbj59", False, True, 296, "" Popup_Menu.ShowPopup pt.X, pt.Y END SUB SUB 填充颜色() Clear_menu '清除弹出菜单上菜单项 Dim cmb As CommandBarControl AddCustomCommandBarPopup1 "线条颜色 ", "bpbj61", False, True,300,"" AddCustomCommandBarPopup2 ("绘图与书写笔 ") Set cmb = Application.CommandBars("CELL").Controls("绘图与书写笔 ") AddCustomCommandBarPopup3 cmb, "批注笔 ", "bpbj63", False, True, 304, "" Set cmb = Application.CommandBars("CELL").Controls("绘图与书写笔 ") AddCustomCommandBarPopup3 cmb, "绘图和书写笔 ", "bpbj64", False, True, 306, "" Set cmb = Application.CommandBars("CELL").Controls("绘图与书写笔 ") AddCustomCommandBarPopup3 cmb, "注释笔 ", "bpbj65", False, True, 308, "" Set cmb = Application.CommandBars("CELL").Controls("绘图与书写笔 ") AddCustomCommandBarPopup3 cmb, "叠放次序 ", "bpbj66", False, True, 310, "" Set cmb = Application.CommandBars("CELL").Controls("绘图与书写笔 ") AddCustomCommandBarPopup3 cmb, "微移 ", "bpbj67", False, True, 312, "" Set cmb = Application.CommandBars("CELL").Controls("绘图与书写笔 ") AddCustomCommandBarPopup3 cmb, "对齐或分布 ", "bpbj68", False, True, 314, "" AddCustomCommandBarPopup2 ("旋转或翻转 ") Set cmb = Application.CommandBars("CELL").Controls("旋转或翻转 ") AddCustomCommandBarPopup3 cmb, "直线 ", "bpbj70", False, True, 318, "" Set cmb = Application.CommandBars("CELL").Controls("旋转或翻转 ") AddCustomCommandBarPopup4 cmb, "连接符 " Set cmb = Application.CommandBars("CELL").Controls("旋转或翻转 ").Controls("连接符 ") AddCustomCommandBarPopup3 cmb, "自选图形 ", "bpbj72", False, True, 322, "" Set cmb = Application.CommandBars("CELL").Controls("旋转或翻转 ").Controls("连接符 ") AddCustomCommandBarPopup3 cmb, "标注 ", "bpbj73", False, True, 324, "" Popup_Menu.ShowPopup pt.X, pt.Y END SUB SUB 流程图() Clear_menu '清除弹出菜单上菜单项 Dim cmb As CommandBarControl AddCustomCommandBarPopup1 "箭头总汇 ", "bpbj75", False, True,328,"" AddCustomCommandBarPopup1 "星与旗帜 ", "bpbj76", False, True,330,"" AddCustomCommandBarPopup1 "基本形状 ", "bpbj77", False, True,332,"" AddCustomCommandBarPopup1 "插入形状 ", "bpbj78", False, True,334,"" AddCustomCommandBarPopup2 ("形状 ") Set cmb = Application.CommandBars("CELL").Controls("形状 ") AddCustomCommandBarPopup3 cmb, "非活动图表 ", "bpbj80", False, True, 338, "" Set cmb = Application.CommandBars("CELL").Controls("形状 ") AddCustomCommandBarPopup3 cmb, "Excel 控件 ", "bpbj81", False, True, 340, "" AddCustomCommandBarPopup1 "曲线 ", "bpbj82", False, True,342,"" AddCustomCommandBarPopup1 "曲线结点 ", "bpbj83", False, True,344,"" AddCustomCommandBarPopup1 "曲线段 ", "bpbj84", False, True,346,"" AddCustomCommandBarPopup1 "图片上下文菜单 ", "bpbj85", False, True,348,"" Popup_Menu.ShowPopup pt.X, pt.Y END SUB SUB OLE对象() Clear_menu '清除弹出菜单上菜单项 Dim cmb As CommandBarControl AddCustomCommandBarPopup1 "ActiveX 控件 ", "bpbj87", False, True,352,"" AddCustomCommandBarPopup1 "艺术字上下文菜单 ", "bpbj88", False, True,354,"" AddCustomCommandBarPopup1 "旋转方式 ", "bpbj89", False, True,356,"" AddCustomCommandBarPopup1 "连接符 ", "bpbj90", False, True,358,"" AddCustomCommandBarPopup1 "脚本标记快捷菜单 ", "bpbj91", False, True,360,"" AddCustomCommandBarPopup1 "Canvas Popup ", "bpbj92", False, True,362,"" AddCustomCommandBarPopup1 "Organization Chart Popup ", "bpbj93", False, True,364,"" AddCustomCommandBarPopup2 ("图表 ") Set cmb = Application.CommandBars("CELL").Controls("图表 ") AddCustomCommandBarPopup3 cmb, "选择 ", "bpbj95", False, True, 368, "" Set cmb = Application.CommandBars("CELL").Controls("图表 ") AddCustomCommandBarPopup4 cmb, "版式 " Set cmb = Application.CommandBars("CELL").Controls("图表 ").Controls("版式 ") AddCustomCommandBarPopup3 cmb, "符号栏 ", "bpbj97", False, True, 372, "" Set cmb = Application.CommandBars("CELL").Controls("图表 ").Controls("版式 ") AddCustomCommandBarPopup3 cmb, "任务窗格 ", "bpbj98", False, True, 374, "" Popup_Menu.ShowPopup pt.X, pt.Y END SUB SUB 添加命令() Clear_menu '清除弹出菜单上菜单项 Dim cmb As CommandBarControl AddCustomCommandBarPopup1 "内置菜单 ", "bpbj100", False, True,378,"" AddCustomCommandBarPopup1 "剪贴板 ", "bpbj101", False, True,380,"" AddCustomCommandBarPopup1 "信封 ", "bpbj102", False, True,382,"" AddCustomCommandBarPopup1 "联机会议 ", "bpbj103", False, True,384,"" AddCustomCommandBarPopup1 "SnagIt ", "bpbj104", False, True,386,"" Popup_Menu.ShowPopup pt.X, pt.Y END SUB SUB 关于() Clear_menu '清除弹出菜单上菜单项 Dim cmb As CommandBarControl AddCustomCommandBarPopup1 "我的VBA ", "WDVBA", False, True,400,"" AddCustomCommandBarPopup1 "帮助 ", "BZ", False, True,402,"" Popup_Menu.ShowPopup pt.X, pt.Y END SUB Public Sub ClearBar() '清除Cell弹出式菜单中菜单项 Dim ctr As CommandBarControl With Popup_Menu .Enabled = True For Each ctr In .Controls ctr.Delete Next End With End Sub Sub RemoveCustomMenu() '恢复系统菜单的各弹出菜单 Application.CommandBars("CELL").Reset End Sub Sub clear_menu() Dim cmb As Object For Each cmb In Application.CommandBars("cell").Controls Application.CommandBars("cell").Controls(cmb.Caption).Delete Next End Sub Sub AddCustomCommandBarPopup1(Caption As String, Macro As String, NewGroup As Boolean, Enable As Boolean, FId As Integer, ShortT As String) '添加一级菜单选项 Dim cbb As CommandBarButton Set cbb = Application.CommandBars("CELL").Controls.Add(msoControlButton) cbb.Caption = Caption If FId > 0 Then cbb.faceid = FId If ShortT "" Then cbb.ShortcutText = ShortT cbb.OnAction = Macro cbb.BeginGroup = NewGroup cbb.Enabled = Enable End Sub Function AddCustomCommandBarPopup2(Caption As String) As CommandBarControl '添加子菜单项 Dim cmb As CommandBarControl Set cmb = Application.CommandBars("CELL").Controls.Add(msoControlPopup) cmb.Caption = Caption cmb.Visible = True Set AddCustomCommandBarPopup2 = cmb End Function Sub AddCustomCommandBarPopup3(cmb As Object, Caption As String, Macro As String, NewGroup As Boolean, Enable As Boolean, FId As Integer, ShortT As String) '添加一级菜单选项 Dim cbc As CommandBarButton Set cbc = cmb.Controls.Add(msoControlButton) cbc.Caption = Caption If FId > 0 Then cbc.faceid = FId If ShortT "" Then cbc.ShortcutText = ShortT cbc.OnAction = Macro cbc.BeginGroup = NewGroup cbc.Enabled = Enable End Sub Function AddCustomCommandBarPopup4(cmd As CommandBarControl, Caption As String) As CommandBarControl '添加子菜单项 Dim cme As CommandBarControl Set cme = cmd.Controls.Add(msoControlPopup) cme.Caption = Caption cme.Visible = True Set AddCustomCommandBarPopup4 = cme End Function '********本模块结束********** '*************************** '* 窗口模块 * '*************************** Private menu(1 To 50) As New Menu_Class '定义50个cMenu菜单类型 Private Sub UserForm_Initialize() hForm = FindWindow(vbNullString, Me.Caption) '程序中需要用到窗口句柄,先获得它 MenuCount = 0 Set Popup_Menu = Application.CommandBars("Cell") '程序中需指定一个弹出式菜单,我们指定为单元格右键菜单,您可另外指定一个弹出式菜单,请注意,是弹出式菜单 Dim bar As Control Set bar = Me.Controls.Add("Forms.image.1", "IM1", Visible) With bar .Visible = True .Left = -100 .Top = 0 .Height = 20 .Width = 20 .BackColor = &HFFC0C0 .BorderStyle = 0 End With '*************** Set bar = Me.Controls.Add("Forms.image.1", "IM2", Visible) With bar .Visible = True .Left = -100 .Top = 0 .Height = 20 .Width = 20 .BackColor = &HFFC0C0 .BorderStyle = 0 End With '*************** Set bar = Me.Controls.Add("Forms.image.1", "FormMenuBar", Visible) With bar .Visible = True .Left = -1 .Top = -1 .Height = 20 .Width = 2000 .BackColor = &HFFC0C0 .BorderStyle = 0 End With menu(1).AddMenu Me,"文件","文件","" menu(2).AddMenu Me,"公式","公式","" menu(3).AddMenu Me,"开发工具","开发工具","" menu(4).AddMenu Me,"窗口","窗口","" menu(5).AddMenu Me,"工具","工具","" menu(6).AddMenu Me,"常用","常用","" menu(7).AddMenu Me,"列表","列表","" menu(8).AddMenu Me,"序列","序列","" menu(9).AddMenu Me,"框架","框架","" menu(10).AddMenu Me,"填充颜色","填充颜色","" menu(11).AddMenu Me,"流程图","流程图","" menu(12).AddMenu Me,"OLE对象","OLE对象","" menu(13).AddMenu Me,"添加命令","添加命令","" menu(14).AddMenu Me,"关于","关于","" end sub Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) Dim i As Integer For i = LBound(menu) To UBound(menu) Set menu(i) = Nothing Next Popup_Menu.Enabled = True Popup_Menu.Reset end sub '********本模块结束**********

2,275

社区成员

发帖
与我相关
我的任务
社区描述
多媒体/设计/Flash/Silverlight 开发 Flash流媒体开发
社区管理员
  • Flash流媒体开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧