Nerseus
*Experts*-
Posts
2607 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by Nerseus
-
Remeber that if you pass the form and you want to see the members (the controls, such as the DataGrid), you'll have to change their default protection level to public. It sounds like your second form doesn't really need the grid, just some data from the selected row? If this is true, maybe the first form could extract whatever data is needed from the currently selected row and pass that to the second form. That's usually a simpler method than passing the control or Form reference. Just a thought. -ner
-
If you're not that familiar with SQL or databases, I'd go with Access especially given that it's only for a single user. If you may be moving to more users, I'd look more into MSDE but if you plan on using dynamic SQL, either database should be easy to use. -ner
-
Copying graphic contents of picturebox/panel to clipboard
Nerseus replied to Gizmo001's topic in Graphics and Multimedia
Have you tried the Clipboard object, part of System.Windows.Forms? -ner -
Look for the SimplePad example that comes with the .NET documentation. I'm sure you can download the sample as well. -ner
-
If your ID field on the foto table is a Primary Key, Identity, you can use it to filter records. Try something like: SELECT TOP 20 * FROM foto WHERE id > @LastID ORDER BY id In this case, @LastID stores the last known ID that you viewed. The "TOP 20" brings back the first 20 records it finds. Using both pieces should give you a 20-record paging mechanism. I sure hope you've got a key set up on the ID field so that the id ordering is fast. :) Note that this will mostly only work if you're moving forward through the data. You can't jump, for instance, to page 10 (records 200 through 210) since there's no guarantee that id is in sequential order with no id's missing. A *much* better solution would be to somehow ask the user for a filter and apply that first. Or, apply their filter and a "TOP 250" so that they never get back more than 250 records (or some number). Sometimes users want the world and you've just got to reel them in :) -ner
-
You can try the following. If you want to use StructureToPtr, you'll have to allocate the memory for the IntPtr first. GCHandle hSrc = GCHandle.Alloc(srcTileRect, GCHandleType.Pinned); GCHandle hDest = GCHandle.Alloc(dstPoint, GCHandleType.Pinned); this.OurDirect3D.DeviceD3D.CopyRects(tileSurface, hSrc.AddrOfPinnedObject(), 1, backBuf, hDest.AddrOfPinnedObject()); hSrc.Free(); hDest.Free(); -ner
-
What exactly are you trying to accomplish? Are you wanting to place a grid of lines on top of a picture or the other way around (your first line says a picture on top of a grid)? What are you trying to retrieve when they click? A list of ALL the pixels inside the grid cell? As an array or what...? -ner
-
Try using the ToString() method with HH for hours (make sure it's capitalized). For example (sorry this is in C#, but you can convert I'm sure :)): DateTime t = DateTime.Parse("12/20/2002 2pm"); Debug.WriteLine(t.ToString("HH:mm:ss")); // Shows 14:00:00 -ner
-
If you'd like to annoy your users, you can always put everything in a Panel control and turn on Auto-scroll. But remember, windows is not a browser - there are many better ways to display a lot of data than scrolling things around. Tabs, grids, multiple forms, etc. -ner
-
The name of the form (class) is stored as a string in the database? So if you have a class named frmMain and you have a string with the value "frmMain" you want to instantiate frmMain (the class) from the string value? -ner
-
That's what Microsoft tells us... and we believe :) -ner
-
If you've got two forms, a splash form and main form, make sure your Main function is instantiating the main form. The main form can then show the splash screen (non-modally or else the main form won't continue running) and then close the splash screen once the main form has made its connection. You can set the splash screen to be "always on top" so that it appears in front of the main form. Since it's non-MDI, you could probably get away with hiding the splash screen in the main form's Activated event (which fires when the main form is being shown). This should occur after all your database work is done, I would assume. -nerseus
-
When you say you are pinging another computer, are you using any non-managed code? Meaning, are you calling into a DLL or COM component? Maybe something in .NET is not allowing the object to release its memory. I can't imagine why minimizing a form would release memory. The garbage collector should do its job either when things go idle or when too much memory has been used. If you'd like, you can always call the garbage collector yourself on a regular basic (once an hour or once a day may work for you). I believe it's just: GC.Collect(); -nerseus
-
And there should be NO reason why the _Load event doesn't fire when showing a form modally. It works perfectly fine for me... -ner
-
To trap system-wide keyboard and/or mouse input, you'll want to use the API call SetWindowsHookEx. See the following article for more info (it's C#, but can be converted fairly easily if you know what you're doing :)) http://msdn.microsoft.com/msdnmag/issues/02/10/CuttingEdge/default.aspx -ner
-
Two methods of the Color class will help: Color.FromName() and Color.FromArgb() FromName takes a string, such as "Red" or "ActiveCaption". FromArgb takes individual red, green, and blue values (with optional alpha). Or you can pass in a hex string, converted to an int. For example: Color.FromArgb(Convert.ToInt32("0xFF8020", 16)) This converts the hex string "0xFF8020" to red=255, green=128, blue=32. -ner
-
You can't have both - the "console" or "windows exe" is a project property. Class Library is the other type. If you wanted, you could have changed the project property though you'd have to stub out the Main() yourself, to create the form. Or do as you did, which is probably easier if the project isn't too big. :) -ner
-
You'll need to create a DataGridTableStyle object. It defines the look and feel of your grid and also allows you to specify what columns to display. Check it out in the .NET help for more info. -ner
-
Checking SelectedIndex works if SelectionMode is set to One. If it's one of the multiple selection styles, you can check the SelectedItems.Count property. -ner
-
Sorting dataView without DataGrid in Web Project
Nerseus replied to invisigoth's topic in Database / XML / Reporting
Your problem lies in how you're getting to the rows, through the Table property. This skips the DataView and goes right back to the original table in the order that it has things, not the DataView. Try replacing objTableRow = dvDataView.Table.Rows(iCnt) with objTableRow = dvDataView(iCnt) -Nerseus -
I know there are a number of issues with GDI+ when it comes to calculating text size, especially for bold items and right-aligned text (such as for $0.00). Has anyone tried out .NET 2003 beta to see if it fixes any of these issues? -nerseus
-
I love that sample! Shows the true power of VB, even when doing lots of math and looping. On a side note... The following code snippet can be used instead of the CopyVerts call in the DX8Test sample code. CopyVerts is an alias for RtlMoveMemory which does a pure memory copy. For those that would rather use pointers to copy the verts manually, here's some unsafe code to do the same thing (thanks to Vincent Demongodin who sent me this awhile back). For the texturetest sample, replace the line: DXWrapper.CopyVerts(pData, m_vertices, m_VertexSize * m_vertices.Length); with the following: unsafe { System.IntPtr ptrData = new IntPtr(pData); TextureVertex* ptrVertBuffer = (TextureVertex*)ptrData.ToPointer(); fixed(TextureVertex* ptrVerts = &m_vertices[0]) { for(int i=0; i<m_vertices.Length; i++) ptrVertBuffer[i] = ptrVerts[i]; } } Note that you'll have to change the project properties to allow unsafe code blocks for this to run (part of Configuration Options -> Build). It may not be as fast, but it might be more clear and maybe less error prone than using aliased version of RtlMoveMemory. :) Enjoy! -Nerseus
-
Here's the second sample project. It's a 2D sample using "sprites" in DirectX8. It's a rewrite of the MS sample Donuts that came with the SDK, enhanced slightly (slightly better organized code). The main points to notice are: 1. Uses a GCHandle object to get a pointer to an array of vertices. This GCHandle can be passed to DrawPrimitiveUP as an IntPtr. 2. Pressing Alt-Enter will toggle Fullscreen/Windowed mode. 3. This code looks for a suitable fullscreen mode. 4. The whole project, in general, has decent error checking on the DirectX calls. Definitely far from 100%, but there are a lot of try/catch blocks to handle most common problems. 5. Use of CreateTextureFromFileEx to load a texture and apply transparency. NOTE: The setting of m_transColorKey can be made quite a bit simpler through the use of a color object. In the sample, black is used with a full white alpha (0xFF). This can be accomplished with: m_transColorKey = Color.Black.ToArgb(); Enjoy! -nerseus dx8donuts.zip
-
I've attached the first project, DX8Test. It contains 3 samples, based loosely on the MS tutorials that came with the SDK. Of note are the following: 1. It ONLY utilizes VertexBuffers. I will post my sample that uses DrawPrimitiveUP tomorrow. 2. The texture sample has a bit of "extras" in it. At the very bottom of the form's source, you'll see the ResetDevice function. You can read the comment but it basically talks about how to get around .NET's non-deterministic finalization. I wish there were a better way for that, but I can't find it :) The main form just launches one of three sample forms. The first, triangletest, shows a simple triangle with each corner a different color. The second shows a rotating cube. The last shows a rotating, textured cylinder with the aforementioned ability to reset the managed objects (the texture and the vertex buffer). The alternative is to create all objects in the managed pool (change D3DPOOL_DEFAULT to D3DPOOL_MANAGED). This also means you'll have to create the texture using CreateTextureFromFileEx instead of CreateTextureFromFile since the Ex version allows you to specify the pool for the texture. Have fun! -ner dx8test.zip
-
You could try this (sorry, it's C# but should show what you need) GCHandle p = GCHandle.Alloc(arTypes, GCHandleType.Pinned); .pFields = p.AddrOfPinnedObject().ToInt32(); p.Free() -ner