06
2013
05

采集博客园asp.net的文章内容实例(下)

在上一文章中的“文章信息操作类(Articles)”添加如下方法来读取文章内容,博客园文章内容都是包含在同一个div中,所以如下:

/// <summary>
/// 采集博客园asp.net文章内容实例(下)
/// </summary>
/// <returns>读取文章后返回文章内容字符串</returns>
public static string GetArtContent(string artUrl)
{
    string TextStr = "";

05
2013
05

采集博客园asp.net的文章地址实例(上)

在winform窗体中建立一个RichTextBox,用来显示文章标题和链接地址

private void Form1_Load(object sender, EventArgs e)
{
    //得到采集的全部文章
    List<Article> list = Articles.GetArticles();
    string TextStr = "";
    //通过循环将全部文章遍历
    if (list != null)
    {
        for (int i = 0; i < list.Count; i++)
        {
            Article temp = list[i];
            //将数据输出显示
            if (TextStr.Trim() != "")
            {
                TextStr += "\n";
            }
            TextStr += "标题:" + temp.Title;
            TextStr += "\n链接:" + temp.Url;
            TextStr += "\n阅读次数:" + temp.Views;
            TextStr += "\n作者:" + temp.Author + "\n";
        }
    }
    richTextBox1.Text = TextStr;
}

22
2013
04

Asp.Net生成条形码实例,通过测试

 已经有网友制作出来,没有实际的调用,调试已经通过

    Code128 code128 = new Code128();
    context.Response.Clear();

    MemoryStream ms = new MemoryStream();
    Bitmap bmp = code128.GetCodeImage("https://www.zhengdecai.com/", Code128.Encode.Code128B); //生成字符串的“123456”的条形码图片
    bmp.Save(ms, ImageFormat.Png);
    context.Response.BinaryWrite(ms.ToArray());

«1»