易截截图软件、单文件、免安装、纯绿色、仅160KB

根据宽度来决定显示的字符串长度(C#)

根据宽度来决定显示的字符串长度 (C#,VS2005)
如果 lable长度固定但字符串长度可变,如果超过了lable显示的长度时,希望用 ...代替剩下的字符,这时需要一个函数
Graphics.MeasureString
具体代码如下
  public string Abbreviation(string str)
        {
            if (str == null)
            {
                return null;
            }
            int strWidth = FontWidth(txtName.Font, txtName, str);
            //获取label最长可以显示多少字符
            int len = label.Width * str.Length / strWidth;
            if (len > 3 && len < str.Length)
            {
                return str.Substring(0, len - 3) + "...";
            }
            else
            {
                return str;
            }
        }
        /// <summary>
        /// 获取字符串在 font时的长度
        /// </summary>
        private int FontWidth(Font font, Control control, s


相关文档:

C#与Flash交互

C#与Flash交互 (转自小磊在线)
C#与Flash交互
前段日子公司要求做一个C#与Flash交互的东西,用来C#与短信猫通讯将数据传到Flash上显示与操作的应用。
第一步C#添加组件
打开VS2005-工具-选择工具箱项-COM组件-选择Shockwave Flash Object-确定
添加好组件往场景上拖放,如果提示注册需求注册
c# 注册控件-在运行输 ......

Delphi 调用 C#的Webservice 不能传入参数


Delphi7 调用 C#的Webservice 不能传入参数
解决办法:
在Delphi导入WSDL后生成的单元的最后一行,即initialization里的初始化端口的代码中加入代码
InvRegistry.RegisterInvokeOptions(TypeInfo(接口名), ioDocument);
即可
 
 
......

C#里对xml文件进行修改,新增,删除,插入操作

已知有一个XML文件(bookstore.xml)如下:
<?xml version="1.0" encoding="gb2312"?>
<bookstore>
<book genre="fantasy" ISBN="2-3631-4">
<title>Oberon's Legacy</title>
<author>Corets, Eva</author>
<price>5.95</price> ......

接口(C# 参考)

以下参考 :http://msdn.microsoft.com/zh-cn/library/87d83y5b.aspx
接口(C# 参考)
更新:2007 年 11 月
接口只包含方法、属性、事件或索引器的签名。成员的实现是在实现接口的类或结构中完成的,如下面的示例所示:
示例
interface ISampleInterface
{
    void SampleMethod();
}
class Implem ......

c# 将枚举作为键值的形式存储

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace 将枚举作为键值的形式存储
{
    enum Myenum
    {
       First=3,
       Second ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号