|
This is the way I'd do it:
System.Security.Cryptography.SHA1 shaM = new System.Security.Cryptography.SHA1Managed();
byte[] hash = shaM.ComputeHash(System.Text.UTF8Encoding.UTF8.GetBytes(bPassword));
string hashedPassword = System.Convert.ToBase64String(hash)
|
|
|
|
|
Is there a .NET equivalent to subclassing controls in a dialog box as on the Win32 side of things? I need a little more control over a textbox than the standard .NET API allows.
"Any clod can have the facts, but having opinions is an art."
Charles McCabe, San Francisco Chronicle
|
|
|
|
|
Create a new class inheriting from TextBox, add your functionality, then use that class on your Form.
Or use event handlers attached to a TextBox, but this is only good for having the TextBox do additional work, not change/stop the work it does.
James
- out of order -
|
|
|
|
|
Thanks. I've actually done that, but it does not represent a complete solution for what I am trying to achieve.
The form still owns the control and defines it's behavior. So, for example, even if I override the TextBox's OnPaint method and attempt to use the Graphics object to draw in the client area of the text box - the form's default behavior still overrides what I want the control to do.
The only way I am aware of to gain ownership of a control is to actually subclass it so that I can control its internal behavior - as commonly done in Win32.
"Any clod can have the facts, but having opinions is an art."
Charles McCabe, San Francisco Chronicle
|
|
|
|
|
Stan Shannon wrote:
The form still owns the control and defines it's behavior. So, for example, even if I override the TextBox's OnPaint method and attempt to use the Graphics object to draw in the client area of the text box - the form's default behavior still overrides what I want the control to do.
(I may not understand your situation right so this may not be what you are asking)
Then you need to override the Paint member inside your inhereted control.
e.g. In my CP+ app I did the following to provide a underlined look on DataGrid cells (this is C# but should be easy enough for other languages):
First I inhereted the DataGridTextBoxColumn (subclass I assume):
public class DataGridLinkColumn : DataGridTextBoxColumn
then I overrode the Paint event:
protected override void Paint(Graphics g,Rectangle Bounds,CurrencyManager Source,int RowNum, Brush BackBrush ,Brush ForeBrush ,bool AlignToRight)
{
g.FillRectangle(BackBrush, Bounds.X, Bounds.Y, Bounds.Width, Bounds.Height);
FontStyle fstylNew = new FontStyle();
fstylNew = FontStyle.Underline;
System.Drawing.Font font = new Font(System.Drawing.FontFamily.GenericSansSerif , (float)8.25, fstylNew);
g.DrawString( GetColumnValueAtRow(Source, RowNum).ToString(), font ,Brushes.Blue ,Bounds.X ,Bounds.Y );
}
Is that what you are looking for?
Paul Watson Bluegrass Cape Town, South Africa Ray Cassick wrote: Well I am not female, not gay and I am not Paul Watson
|
|
|
|
|
Thanks, Paul. With the TextBox, even when "subclassed", the Paint event handler is never called. I assume this is because the parent class (in the windows sense) is processing the message via the parent Form.
I found a work-around, but to me this is just another example of why .NET is not yet an optimum development environment.
"Any clod can have the facts, but having opinions is an art."
Charles McCabe, San Francisco Chronicle
|
|
|
|
|
You can override the WndProc function and intercept WM_PAINT. By overriding WndProc IMHO you should be able to do everything you could by Win32 subclassing.
Cheers
HTH
Martin
"Situation normal - all fu***d up"
Illuminatus!
|
|
|
|
|
Thats sort of what I was thinking also, I just wanted to hear someone else say it. I don't want to spend a lot of time right now going down that road only to run into more unexpected issues, but I might try it in the near future. Thanks.
"Any clod can have the facts, but having opinions is an art."
Charles McCabe, San Francisco Chronicle
|
|
|
|
|
I want to catch the "SCROLL" events on a ListView control,
in order to code something like a dynamic populating ListView.
Someone knows about that?
|
|
|
|
|
You can use WndProc to catch messages if needed:
i.e.
protected override void WndProc( ref Message m )
{
if( m.Msg == 0x0114
|| m.Msg == 0x0115 )
{
}
base.WndProc( ref m );
}
"Any clod can have the facts, but having opinions is an art."
Charles McCabe, San Francisco Chronicle
|
|
|
|
|
Thanks!!
It's nice.
|
|
|
|
|
When I create a .Net windows client that calls a .Net web service I can maintain session state on the web service as long I set the CookieContainer property to a new instance of a CookieContainer within the client side web service proxy.
Now, when the client of the web service is a .Net web site, I can't seem to maintain web service session state. I have made sure that the web service proxy and the CookieContainer have been persisted in a web site session variable, but every time the web site calls the web service, the web service sees a new session cookie and establishes a new session state.
Anyone having this same problem, or better yet solved it?
Thanks to anyone who responds.
|
|
|
|
|
...size. I'm just a beginner, but I'm trying to get the form to be maximised in the window. I now it's not to difficult, and I've even manage to do it some days ago, but I deleted the code and now I can't find out how I did it
Please help me...
Børge
|
|
|
|
|
Munti wrote:
but I'm trying to get the form to be maximised in the window
Use the Form.WindowState Property and set it to FormWindowState.Maximized
e.g. (from MSDN)
public void InitMyForm()
{
Label label1 = new Label();
label1.Location = new System.Drawing.Point(54, 128);
label1.Name = "label1";
label1.Size = new System.Drawing.Size(220, 80);
label1.Text = "Start position information";
this.Controls.Add(label1);
WindowState = FormWindowState.Maximized;
label1.Text = "The form window is " + WindowState;
}
Paul Watson Bluegrass Cape Town, South Africa Ray Cassick wrote: Well I am not female, not gay and I am not Paul Watson
|
|
|
|
|
Excelent, worked perfectly
Thanks, Børge
|
|
|
|
|
None of my .NET apps, which run fine on XP, are running on W2K. I've loaded SP3, IE6, and DOTNETFX.EXE. I get "Application has generated an exception which could not be handled." BTW, these apps also run fine on my W2K machine on which I've already installed the dev environment.
No networking issues, etc.
Any ideas? I don't want to load the entire dev environment because I'm afraid then the problem will go away without my knowing why!
Marc
Help! I'm an AI running around in someone's f*cked up universe simulator.
|
|
|
|
|
If you are using Data Access then MDAC 2.7 also needs to be installed.
May the Source be with you
Sonork ID 100.9997 sijinjoseph
|
|
|
|
|
Is it possible to serialize an Exception derived class? When I try to add an exception to a System.Messaging.Message object (which internally serializes the object to XML) I receive the following error:
System.InvalidOperationException: There was an error reflecting 'Send.DALException'. ---> System.InvalidOperationException: The property 'Source' on type 'System.Exception' cannot be serialized because it is decorated with declarative security permission attributes. Consider using imperative asserts or demands in the property accessors.
What does this mean? Can I get around it?
|
|
|
|
|
I'm giving a talk on GDI+ (which I know) and am looking for a comparison with DirectX.
Does anyone have any links or maybe some points for me to ponder on?
Cheers,
Simon
"VB.NET ... the STD of choice", me, internal company memo
|
|
|
|
|
It's a bit like comparing a car with a plane. Both are modes of transport, but used for different things. DX is faster than GDI+, and it's also harder to use. It's notoriously hard to set up, especially in 3D. DX also includes modules for playing sound, movies, and networking.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
What tool or product do you recommand to create a program that installs a .NET Windows Form component?
Does Microsoft provides one such tool with the .NET SDK?
|
|
|
|
|
There's the Windows Installer projects that are seemlessly integrated with VS.NET. You can even assign your build outputs, sources, content, etc. to directories and what-not. If you really don't mind learning the internals of the MSI database, you can get free tools in the Platform SDK, but you have to do almost everything yourself. Otherwise, you could go with commercial solutions.
Another options lies in the System.Configuration.Install namespace, where you use and create installer classes that can do about anything, from installing Windows Services to VS.NET toolbox items to custom CodeGroups. To use these, you use installutil.exe [options] MyAssembly.dll . InstallUtil.exe is a utility in the .NET SDK.
There are other free solutions out there, but none with support for .NET assemblies that I've seen. I recommend either the Windows Installer projects in VS.NET or writing custom installers like I also mentioned.
"Well, I wouldn't say I've been missing it, Bob." - Peter Gibbons
|
|
|
|
|
Thanks very much for these informations.
Just another question: where can I find the Windows Installer projects in VS.NET?
|
|
|
|
|
If you need a sample Windows Installer project, you can try Desktop Bob[^]
lazy isn't my middle name.. its my first.. people just keep calling me Mel cause that's what they put on my drivers license. - Mel Feik
|
|
|
|
|
Add a new project to your solution (with your existing project, making build outputs available to your setup project) from the Deployment category. There should be several options available to you. Use the wizard if you're not sure about what to do. It does quite a bit for you.
"Well, I wouldn't say I've been missing it, Bob." - Peter Gibbons
|
|
|
|