|
using System;
using System.Text;
using System.Drawing;
namespace CP.Apps.ScreenSaver
{
/// <summary>
/// Utilities for various purposes
/// </summary>
public class Util
{
public static string StripHtml(string text)
{
StringBuilder stripped = new StringBuilder(text.Length);
bool strip = false;
foreach(char c in text)
{
if (c == '<')
strip = true;
if (c == '>')
{
if (strip)
{
strip = false;
continue;
}
}
if (!strip)
stripped.Append(c);
}
return stripped.ToString();
}
public static Bitmap MakeOpaqueBitmap(Image img, Color backColor)
{
Bitmap bmp = new Bitmap(img.Width, img.Height);
Graphics g = Graphics.FromImage(bmp);
g.Clear(backColor);
g.DrawImageUnscaled(img, 0, 0);
g.Dispose();
return bmp;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.