Jump to content
Xtreme .Net Talk

MadHatter

Members
  • Posts

    4
  • Joined

  • Last visited

MadHatter's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. here's a quick and dirty line control I wrote a long time ago. feel free to use it. /* * Copyright © 2003 NullFX Software * By: Steve Whitley * * $Log: Line.cs,v $ * * */ namespace NullFX.Controls { using System; using System.Collections; using System.ComponentModel; using System.Drawing; using System.Data; using System.Windows.Forms; [Designer(typeof(Line.LineDesigner))] public class Line : System.Windows.Forms.Control { internal class LineDesigner : System.Windows.Forms.Design.ControlDesigner { public override System.Windows.Forms.Design.SelectionRules SelectionRules { get { return System.Windows.Forms.Design.SelectionRules.LeftSizeable | System.Windows.Forms.Design.SelectionRules.RightSizeable | System.Windows.Forms.Design.SelectionRules.Visible | System.Windows.Forms.Design.SelectionRules.Moveable; } } } private System.Windows.Forms.FlatStyle _flatStyle; private Pen _systemPen; private System.ComponentModel.Container components = null; [Category("Appearance"), Description("Determines the display of the control when the users move the mouse over the control and click")] public System.Windows.Forms.FlatStyle FlatStyle { get{return _flatStyle;} set{ _flatStyle = value; Invalidate(); } } public Line() { _flatStyle = FlatStyle.Standard; _systemPen = new Pen(SystemColors.ControlDark, 2); SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer| ControlStyles.ResizeRedraw| ControlStyles.UserPaint, true); } protected override void Dispose( bool disposing ) { if( disposing ) { if( components != null ) { components.Dispose(); } } base.Dispose( disposing ); } protected override Size DefaultSize { get { return new System.Drawing.Size(32, 2); } } protected override void OnPaint(PaintEventArgs pe) { switch(_flatStyle) { case System.Windows.Forms.FlatStyle.Flat: case System.Windows.Forms.FlatStyle.Popup: case System.Windows.Forms.FlatStyle.Standard: { pe.Graphics.FillRectangle(SystemBrushes.ControlLightLight, 0, 0, Width, 2); pe.Graphics.FillRectangle(SystemBrushes.ControlDark, 0, 0, Width - 1, Height / 2); }break; case System.Windows.Forms.FlatStyle.System: { pe.Graphics.DrawLine(_systemPen, 0, 1, Width, 1); }break; default: goto case System.Windows.Forms.FlatStyle.Standard; } } } }
  2. you have to escape your string @"full path to snk" you can use a relitive path also @"..\..\snkey.snk" will do it if you have your key in the base project folder.
  3. use the mysql datareader and insert the items from each row into an array.
  4. A while ago I was trying to do the same thing (only in another language). I was hashing credit card numbers, and don't think I would have found it had it not been for the million+ records I was parsing and hashing. one thing you need to add to your hash function is inside your for loop (sorry I don't know VB so I'm taking an honest stab at it :p) Private Function computeMD5(ByVal plainText As String) As String Dim ue As New UTF8Encoding Dim bytes() As Byte = ue.GetBytes(plainText) Dim md5 As New Security.Cryptography.MD5CryptoServiceProvider Dim hashBytes() As Byte hashBytes = md5.ComputeHash(bytes) Dim hashString As String Dim i As Integer For i = 0 To UBound(hashBytes) ' ---- here ---- Dim tempString As String tempString = Convert.ToString(hashBytes(i), 16) If (tempString.Length.Equals(0)) Then hashString += "00" ElseIf (tempString.Length.Equals(1)) Then hashString += "0" + tempString Else hashString += tempString End If ' ---- to here ---- Next Return hashString End Function I found that if the byte sometimes is null (or nothing) and won't be converted to zero's, so you have to do it manually. this fixes the problem..
×
×
  • Create New...