Click here to Skip to main content
15,878,809 members
Home / Discussions / C#
   

C#

 
GeneralHelp With Reading RSA Private Key From File (C#) Pin
yccheok30-Jun-03 21:56
yccheok30-Jun-03 21:56 
Generalreading a minimized form/window into a bitmap?how do i read a minimized form/window into a bitmap. Pin
peenu30-Jun-03 20:42
peenu30-Jun-03 20:42 
QuestionHow to upload a web-application? Pin
puppiesLover30-Jun-03 20:22
puppiesLover30-Jun-03 20:22 
QuestionConstrain form to horizontal resize only? Pin
james-cxx30-Jun-03 19:27
james-cxx30-Jun-03 19:27 
AnswerRe: Constrain form to horizontal resize only? Pin
Jim Stewart30-Jun-03 19:59
Jim Stewart30-Jun-03 19:59 
AnswerRe: Constrain form to horizontal resize only? Pin
peenu30-Jun-03 21:46
peenu30-Jun-03 21:46 
GeneralRe: Constrain form to horizontal resize only? Pin
james-cxx1-Jul-03 5:12
james-cxx1-Jul-03 5:12 
GeneralGDI Tip of the Day Pin
leppie30-Jun-03 18:14
leppie30-Jun-03 18:14 
This will help you manage all those brushes and pens you so relentlessly create without disposing of them correctly. YES YOU!!!
public class GDIBuffer
{
  static Hashtable pens = new Hashtable();
  static Hashtable brushes = new Hashtable();

  public static Brush GetBrush(Color color)
  {
    if (!brushes.Contains(color))
        brushes.Add(color, new SolidBrush(color));
    return brushes[color] as Brush;
  }

  public static Pen GetPen(Color color)
  {
    if (!pens.Contains(color))
      pens.Add(color, new Pen(color));
    return pens[color] as Pen;
  }

  public static Pen GetPen(Brush brush)
  {
    if (!pens.Contains(brush))
      pens.Add( brush, new Pen(brush));
    return pens[brush] as Pen;
  }

  public static Pen GetPen(Brush brush, int width)
  {
    Tuple t = new Tuple();
    t.left = brush;
    t.right = width;

    if (!pens.Contains(t))
      pens.Add( t, new Pen(brush, width));
    return pens[t] as Pen;
  }

  struct Tuple
  {
    public object left;
    public object right;
  }
}

Now instead of calling new Pen/SolidBrush, just call the buffer. Smile | :)

leppie::AllocCPArticle(Generic DFA State Machine for .NET);
GeneralRe: GDI Tip of the Day Pin
Oleksandr Kucherenko30-Jun-03 21:44
Oleksandr Kucherenko30-Jun-03 21:44 
GeneralRe: GDI Tip of the Day Pin
Nathan Blomquist1-Jul-03 2:12
Nathan Blomquist1-Jul-03 2:12 
GeneralRe: GDI Tip of the Day Pin
Oleksandr Kucherenko1-Jul-03 2:21
Oleksandr Kucherenko1-Jul-03 2:21 
GeneralRe: GDI Tip of the Day Pin
Nathan Blomquist1-Jul-03 2:39
Nathan Blomquist1-Jul-03 2:39 
GeneralRe: GDI Tip of the Day Pin
leppie1-Jul-03 7:02
leppie1-Jul-03 7:02 
GeneralRe: GDI Tip of the Day Pin
leppie1-Jul-03 6:59
leppie1-Jul-03 6:59 
GeneralRe: GDI Tip of the Day Pin
Nathan Blomquist1-Jul-03 2:14
Nathan Blomquist1-Jul-03 2:14 
GeneralRe: GDI Tip of the Day Pin
leppie1-Jul-03 7:04
leppie1-Jul-03 7:04 
Generalabout WebBrowser in mdi Pin
benzite30-Jun-03 15:02
benzite30-Jun-03 15:02 
GeneralListView Column Width Pin
.gonad30-Jun-03 14:33
.gonad30-Jun-03 14:33 
GeneralPrint a web page Pin
nahumtakum30-Jun-03 11:08
nahumtakum30-Jun-03 11:08 
QuestionTimer + Thread = what? Pin
RB@Emphasys30-Jun-03 7:43
RB@Emphasys30-Jun-03 7:43 
AnswerRe: Timer + Thread = what? Pin
J. Dunlap30-Jun-03 7:57
J. Dunlap30-Jun-03 7:57 
GeneralRe: C# Memmory allocation Pin
Nemanja Trifunovic30-Jun-03 6:38
Nemanja Trifunovic30-Jun-03 6:38 
GeneralRe: C# Memmory allocation Pin
leppie30-Jun-03 9:22
leppie30-Jun-03 9:22 
GeneralRe: C# Memory allocation Pin
Wesner Moise30-Jun-03 12:45
Wesner Moise30-Jun-03 12:45 
GeneralRe: C# Memmory allocation Pin
Nemanja Trifunovic30-Jun-03 12:54
Nemanja Trifunovic30-Jun-03 12:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.