您的位置:首页 > 编程语言 > C#

C#进行Visio二次开发之动态仿真实现

2010-06-25 16:39 281 查看
Visio二次开发可以实现的项目情景很多,如电气线路分析、配电网络分析、流程图等,现因为项目需要,又认识多了一个应用场合,液压传动的仿真。项目效果图如下所示:

代码

private void HuoSaiMoving(object obj)
{
ThreadParameterInfo objParam = obj as ThreadParameterInfo;
Visio.Cell scratchCell = objParam.ScratchCell;
Visio.Cell typeCell = objParam.Cell;
int intValue = Convert.ToInt32(VisioUtility.FormulaStringToString(scratchCell.Formula));
while (intValue == 1 && isMovie)
{
string minValue = "Width*0.25";
string maxValue = "Width*0.75";
//Visio.Cell typeCell = objCell as Visio.Cell;
if (typeCell != null)
{
string currentValue = "";
//增加
for (int k = 1; k <= 10; k++)
{
currentValue = string.Format("Width*0.25 + Width*{0}", 0.05 * k);
typeCell.Formula = VisioUtility.StringToFormulaForString(currentValue);
System.Windows.Forms.Application.DoEvents();
Thread.Sleep(50);
}
//减少
for (int k = 1; k <= 10; k++)
{
currentValue = string.Format("Width*0.75 - Width*{0}", 0.05 * k);
typeCell.Formula = VisioUtility.StringToFormulaForString(currentValue);
System.Windows.Forms.Application.DoEvents();
Thread.Sleep(50);
}
}
intValue = Convert.ToInt32(VisioUtility.FormulaStringToString(scratchCell.Formula));
}
}

Visio应用曲高和寡,代码贴图众口难调;不求一鸣惊人,但求潜移默化。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐