Nerseus
*Experts*-
Posts
2607 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by Nerseus
-
Gettingwhich colors are transparent in a Bitmap
Nerseus replied to aewarnick's topic in Graphics and Multimedia
Are you asking how to "undo" the MakeTransparent call? -Nerseus -
What exactly are you trying to do with a Matrix? The Matrix object has numerous static methods for doing what the old Module used to do, such as Translate, Scale, LookAtLH, RotationQuaternion and more. -Nerseus
-
You *can* give SQL Server optimizer "hints", but I wouldn't recommend it. You can place the hints in your SQL code to tell the compiler to use a particular index but the optimizer should be picking the correct index in just about every case (assuming you're keeping your indexes fairly up to date). The rare cases are when you perform a large bulk insert that doesn't update the indexes, then the optimizer may choose badly. But hopefully you're having SQL Server rebuild the indexes after a large bulk load. In fact, if I remember right, there are options that rebuild after large loads (a table grows by more than 25% or something like that). Don't hold me to that - you may have to turn that on manually, but I'm pretty sure it *can* be made to update them like that automatically. There are other hints you can give, such as NOLOCK, on a query. The NOLOCK hint is really a directive - it tells SQL Server to disregard any other higher orders to lock on the SELECT. Useful in a transaction where you need to read some values that can be "dirty" reads but you also need locking on other SELECTS. -nerseus
-
Here's an article that may help: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/controlarrays.asp -nerseus
-
One more note, the following is all you need in your manifest file. This is a trimmed down version from what most people use and has one major benefit: You don't have to update it for every project you have. You can use this contents for any EXE, just make sure you rename the file to match your EXE's name plus the manifest extension. If your EXE is named "Project1.Test1.EXE" then the manifest file should be named "Project1.Test1.EXE.manifest". <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <description></description> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*" /> </dependentAssembly> </dependency> </assembly> edit: Added the following: Here are the instructions for embedding the manifest in the EXE (the original link I have isn't working - it's on gotdotnet.com but redirects somewhere else): 1. Open your exe in VS (file -> open file) 2. Right click on it and select add resource 3. Click "Import..." from the dialog 4. Select your manifest file 5. In the "Resource Type" field, enter "RT_MANIFEST" 6. In the property grid, change the resource ID from "101" to "1". 7. Save the exe. -Nerseus
-
I had an article from MSDN that showed how to embed the manifest file in the EXE. The steps were something like open up the compiled EXE in Visual Studio (shows a tree, including resources and such). You could then add a new item, give it a very specific name and include the text that the manifest file contained. You would then resave your EXE with the newly embedded manifest. In fact, you could open up ANY EXE (even non .NET) and do this. It might not work if the controls didn't have their FlatStyle set (or whatever the "real" windows name is for that style), but you could still embed the info and save the new EXE. When my buddy gets back in from lunch I'll see if he still has a link to the article. -Nerseus
-
Normally you want DoEvents to have windows process some messages through the normal windows message pump. On a web server you won't have a message pump and you certainly don't have access to the client's window's message pump (which would only be IE's). What are you trying to do with DoEvents? It sounds like you need to be doing something else. -Nerseus
-
If you'd like to embed the manifest in the EXE, you can. But you have to do it manually after each recompile. Visual Studio will let you do it, but it's a somewhat tedious process (less than 2 minutes, but 5 to 10 steps). I don't know how to do it outside of Visual Studio. But, as Volte said, as long as the EXE and manifest file are in the same folder, it should work fine. -Nerseus
-
just thought i'd share my news :) , the Twins have arrived early.
Nerseus replied to dynamic_sysop's topic in Water Cooler
We will be finding out, but not for a few more weeks :( I'm shooting for Bob or Bobby (boy or girl, I don't care) but my wife gives it about 0.00001 % chance :) For those of you that are interested, we JUST found out that they can now PICK the sex of your baby ahead of time by sampling genes from the man's baby-makers and get it right with over 99% accuracy. Right or wrong (depends on your views of the world), it's interesting :) -ner -
just thought i'd share my news :) , the Twins have arrived early.
Nerseus replied to dynamic_sysop's topic in Water Cooler
Nope, this will be my second. We're taking them one at a time (whew!), a few years apart. I have a pic for those that are interested (you get stuck looking at me, too, unfortunately :)). Just click the www link below. -Nerseus -
What code are you using? Can you post a small project? -Nerseus
-
If this is a professional program and you're not a very good artist, you can check out http://www.photodisc.com. You have to buy them, but if you only want one and you plan on selling this program, it's worth it. Otherwise try gimp - if you don't even know what program to use to do drawing, you're probably not ready for Adobe's Photoshop (very high learning curve for beginners). :) -Nerseus
-
Fields are implemented as two properties (which are wrappers for methods as Volte mentioned). In case that helps :) -Ner
-
just thought i'd share my news :) , the Twins have arrived early.
Nerseus replied to dynamic_sysop's topic in Water Cooler
Better not be contageous! I've got ONE coming in February, and I couldn't handle twins :) -Nerseus -
If you are databinding, you could use the DataSet's built in HasChanges method. If you're not using the Tag property for anything, you might store the initial values of all the controls in their Tag (at the bottom of Form_Load) and compare things that way. Or you could use a more custom solution such as storing the values in a hashtable or somesuch. I don't think one IF on a bool and setting one bool on every keystroke is that much overhead. Plus, you can reuse the event handler for every control to simplify things. That's the route I'd probably go if I weren't binding. Keep in mind that your way won't allow you to show any kind of indicator to the user that something's changed (such as MS Word's asteric that appears as soon as something changes). This may not be a big deal, especially in a dataentry type of app where you're likely just checking if something's changed on form_closing. -Nerseus
-
A DateTime stores the milliseconds and so does SQL Server. My guess is that the line that first sets dt doesn't store milliseconds (just the date and time). Later you add 5000 milliseconds, which is just 5 seconds. Your milliseconds should still be 0, as expected. Try your test setting dt to DateTime.Now to see if the code works. Make sure that the value DateTime.Now HAS milliseconds as well as you may get lucky/unlucky and hit it just right :) -Nerseus
-
List your current project! (A "what's everyone up to?" thread)
Nerseus replied to wyrd's topic in Water Cooler
Professionally, brain-numbing MVD stuff for a couple of states. (Too many rules!) For fun: 1. Built-in chat client for the professional stuff 2. Ms Pacman clone (DX9 - 3D and 2D) 3. Log file parser and stats builder for a 3D game I play with some friends (was VB6, SQL Server, ASP, etc. - needs a massive update but no time) -Nerseus -
Wowzers - didn't realize this would fuel a browser war type of response. I've got nothing against any browser (well maybe Netscape - never rendered my GOOD HTML right and previously, when I and my clients needed it, never handled scripting as good as IE)... whoops, got into it myself :p Just wanted to let us IE users know we had a "nice" popup stopper available. And you can use the advanced version, just turn off the page ranking feature which stops the sending of the info. It only sends what pages you hit, nothing about you or your computer. -Nerseus
-
Yep, the new google toolbar (http://toolbar.google.com) stops popups! Plus, you can search google ALL the time, instantly. Woo hoo! -Nerseus
-
What are the error messages and associated lines of code that you're getting errors on? Keep in mind that the Upgrade Wizard will only handle very simple VB6 code. Even relatively simple tasks it will not know how to convert OR (even worse, possibly), convert in a "non standard" way. In general, it might be a good way to prototype a conversion on a small scale, but any large projects are best converted by hand or not converted at all. -Nerseus
-
Try MeasureString (part of the Graphics object), which returns a SizeF object with the width and height. -Nerseus
-
Excellent, worked great! :) Thanks, Nerseus
-
If you remove the Form's border, the caption, and any system buttons (ControlBox, Minimize, Maximize) and set the WindowState to Maximized, it will go "full screen", even over the task bar. To change the resolution, you could use ChangeDisplaySettings as mentioned above - but remember that if they Alt-Tab to another window you *may* want to resize back - or prevent them from using Alt-Tab. -Ner
-
I'm creating an inherited Label control to hold a string. The inherited version will draw the text in two colors, the first portion of the string in the standard Foreground color of the control, the last 6 digits will be a special color. I'm handling the drawing in an overriden OnPaint event by figuring out the two strings, creating appropriate Brush and Font objects, and drawing the strings. The problem I'm noticing is that MeasureString seems to be off by a varying amount depending on the letters (both the contents and number) used in the first part of the string. Here's the code for the inherited label. I've turned off wrapping as I know the length of the strings will never be greater than the size of the Label in my production code. That's also why the rectangle used after MeasureString has a top position of 0 hard-coded. using System; using System.Windows.Forms; using System.Drawing; using System.ComponentModel; namespace WinTest { public class VINLabel : Label { public VINLabel() { } [Description("The Short VIN portion of the VIN, readonly"), Category("Appearance")] public string TextShortVIN { get { int shortVinPos = (this.Text.Length >= 6 ? this.Text.Length - 6 : 0); return this.Text.Substring(shortVinPos); } } protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { int shortVinPos = (this.Text.Length >= 6 ? this.Text.Length - 6 : 0); string shortVIN = this.Text.Substring(shortVinPos); string remainingVIN = this.Text.Substring(0, shortVinPos); Graphics g = e.Graphics; Brush remainingVINBrush = Brushes.Black; Brush shortVINBrush = Brushes.Blue; Font remainingVINFont = this.Font; Font shortVINFont = new Font(remainingVINFont, FontStyle.Bold); StringFormat sf = new StringFormat(); sf.Alignment = StringAlignment.Near; sf.FormatFlags |= StringFormatFlags.NoWrap; // Clear the area of the control e.Graphics.DrawRectangle(new Pen(this.BackColor), this.ClientRectangle); Rectangle r = this.ClientRectangle; // Draw the first part of the text e.Graphics.DrawString(remainingVIN, remainingVINFont, remainingVINBrush, r, sf); // Get the position (r) where the shortVIN should be drawn from SizeF layoutArea = new SizeF(r.Width, r.Height); SizeF textSize = g.MeasureString(remainingVIN, remainingVINFont, layoutArea, sf); int width = (int)textSize.Width; r.Location = new Point(width, 0); // Draw the short VIN e.Graphics.DrawString(shortVIN, shortVINFont, shortVINBrush, r, sf); } } } And here's some code to create 3 labels, and set their Text. The space between the first and second portions of the string is a different size. I would HOPE that there wouldn't be any space at all in any of the strings. VINLabel vl = new VINLabel(); vl.Size = new Size(120, 20); vl.Location = new Point(0, 0); this.Controls.Add(vl); vl.Text = "ABCDEFGHIJKL123456"; VINLabel v2 = new VINLabel(); v2.Size = new Size(120, 20); v2.Location = new Point(0, 21); this.Controls.Add(v2); v2.Text = "ABC123456"; VINLabel v3 = new VINLabel(); v3.Size = new Size(120, 20); v3.Location = new Point(0, 42); this.Controls.Add(v3); v3.Text = "abc123456"; Any ideas? -Nerseus