Jump to content
Xtreme .Net Talk

Ming_Lei

Avatar/Signature
  • Posts

    41
  • Joined

  • Last visited

Everything posted by Ming_Lei

  1. Yes, I did include that two header files. What do you think is the problem. Is that memory functions can not be used in .Net library? Thanks. :confused:
  2. I created a C++ class library, and I try to use malloc() and memcpy(), but I got the linkage error. I used the following line of code: unsigned char* newBuffer = (unsigned char*)malloc(size); ...... And I got the following linkage errors: Class error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3*****FYAXPAX@Z) Class error LNK2001: unresolved external symbol "void * __cdecl malloc(unsigned int)" (?malloc@*****J0YAPAXI@Z) Class error LNK2001: unresolved external symbol "void * __cdecl memcpy(void *,void const *,unsigned int)" (?memcpy@*****J0YAPAXPAXPBXI@Z) Does anyone know what went wrong? I have include 'malloc.h' header file. Thanks! :)
  3. Thanks for the link!
  4. I want to know what are the major differences, and major improvements of ASP.Net over ASP. - Thanks. :confused:
  5. I am using C# and Managed DirectX
  6. I have the problem solved. Thanks.
  7. Also I am writing a program that uses DirectX in full screen. I have the following code to create a device, but the system stops at the last line because there's a bug in the parameters. Here is the code: ==================================================== // Set our presentation parameters PresentParameters presentParams = new PresentParameters(); presentParams.Windowed = false; presentParams.SwapEffect = SwapEffect.Discard; presentParams.AutoDepthStencilFormat = DepthFormat.D16; presentParams.EnableAutoDepthStencil = true; Format current = Manager.Adapters[0].CurrentDisplayMode.Format; if(Manager.CheckDeviceType(0, DeviceType.Hardware, current, current, false)) // check valid { presentParams.BackBufferCount = 1; presentParams.BackBufferWidth = ScreenWidth; presentParams.BackBufferHeight = ScreenHeight; presentParams.BackBufferFormat = current; } // Create our device device = new Device(0, DeviceType.Hardware, this, CreateFlags.SoftwareVertexProcessing, presentParams); ============================================== What is the bug?? :confused:
  8. I like to create a 3D world editor. In the form the DirectX has to be mixed with various control objects like buttons, comb boxes, ect. What is the best way of creating such environment? Should I (and how) separate the DirectX drawing into a separated user control? - Thanks. :)
  9. I think with GDI+, you need to maintain your own image list and get them to be drawn when paint.
  10. If it is not painting after change of data, call Refresh().
  11. Pointer arithmetic can be used to make these functions. See the following article For discussion: http://www.c-sharpcorner.com/Code/2003/March/ThumbnailImages.asp Also, check out the MSDN articles comparing GetPixel\SetPixel with unsafe Image processing with pointers: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncscol/html/csharp11152001.asp
  12. I know only access through Bitmap.GetPixel() and .SetPixel(). So I searched over the web for a different solution. And I have found the following article at C# corner to be interesting, and appear to use System.IntPtr and unsafe code: http://www.c-sharpcorner.com/Code/2003/March/ThumbnailImages.asp
  13. About double buffering. When drawing your chart, for example as real-time updating, I have found it is better to do double buffering. I am not sure if it is suitable for beginner, but if you want, here is a code I have modified from someone else's I found over the web: Override the OnPaint handler as: ====================================== protected override void OnPaint(PaintEventArgs e) { if(_backBuffer==null) { _backBuffer=new Bitmap(this.ClientSize.Width,this.Client.Height); } Graphics g=Graphics.FromImage(_backBuffer); //Paint your graphics on g here g.FillRectangle(Brushes.White, 0, 0, _backBuffer.Width, _backBuffer.Height); // I use this to paint background with white. //Continue to paint your stuff.... g.Dispose(); //Copy the back buffer to the screen e.Graphics.DrawImageUnscaled(_backBuffer,-0,0); //base.OnPaint (e); //optional but not recommended } ================================= Declare: Bitmap _backBuffer. :rolleyes:
  14. Code to load and draw a DirectX .X model The following code is from book source MDX Kick Start to load a .X mesh file: ====================================== private void LoadMesh(string file) { ExtendedMaterial[] mtrl; // Load our mesh mesh = Mesh.FromFile(file, MeshFlags.Managed, device, out mtrl); // If we have any materials, store them if ((mtrl != null) && (mtrl.Length > 0)) { meshMaterials = new Material[mtrl.Length]; meshTextures = new Texture[mtrl.Length]; // Store each material and texture for (int i = 0; i < mtrl.Length; i++) { meshMaterials = mtrl.Material3D; if ((mtrl.TextureFilename != null) && (mtrl.TextureFilename != string.Empty)) { // We have a texture, try to load it meshTextures = TextureLoader.FromFile(device, @"..\..\" + mtrl.TextureFilename); } } } } ============================================ You also need to have declared the following: Mesh mesh = null; Material[] meshMaterials; Texture[] meshTextures; The 'mesh' can be drawn using the following code: ============================================ for (int i = 0; i < meshMaterials.Length; i++) { device.Material = meshMaterials; device.SetTexture(0, meshTextures); mesh.DrawSubset(i); }
  15. Maybe using GraphicsPath.GetBounds()?
  16. Here, this link at codeproject has source code that captures from various devices, including webcam: http://www.codeproject.com/directx/LiveVideo.asp And if you search "video capture" at codeproject, there are several different topics involving video capturing.
  17. For a video of duration about 800 seconds, the value of pos is around 5 to 10 (maybe say 9.782) when I moved the track bar a little forward initially.
  18. Refer to this url for the same discussion - I just found out: http://www.webmasterworld.com/forum47/1931.htm
  19. I have a problem with Video.SeekCurrentPosition method in DirectX.AudioVideoPlayback namespace. I am writing a program that plays various kind of video and sound, with a track bar that is used to go back and forth in a video or audio file. I therefore used SeekCurrentPosition with flag that is absolute positioning. But the call to the method each time seek to 0 no mather what the value been actually given. What is the problem? Code: =============================================== double pos = ((double)trackBar1.Value / 100.0) * video.Duration; video.SeekCurrentPosition(pos, SeekPositionFlags.AbsolutePositioning); ===============================================
  20. Thanks for the info. I have searched and found discussions about printing character by character from RichTextBox. But I need to print not only western characters but unicode characters like Chinese letters. And also what is "a sticky thread" you are referring to? Can you give me a link?
  21. Sorry I have solved the problem and had to be back and modify the message posted here. I have changed the Access DB's data field to OLE Object to receive binary data to be read by program. :rolleyes:
  22. I like to print the contents from RichTextBox. I've found to print text I would use DrawString with PrintDocument. Is there a way or an easier way to print with RichTextBox? - Thanks.
  23. Thanks for the reply. I have checked on the web for solutions, and I have found it!!
  24. I am trying to read binary data from database. After reader.Read(), I used the following code to first determine size, then read: =============================== Byte[] data = new Byte[Convert.ToInt32((reader.GetBytes(0,0,null,0,Int32.MaxValue)))]; long bytesReceived = reader.GetBytes(0,0,data,0,data.Length); which returns error. What's wrong with the code??
  25. Can't save I am trying to save .Rtf property to database which uses a text type field to store RichText content, but it failed to save. Code as follows: ==================================== string cmdstr = "insert into diary2 values('"+date+"', '"+DiaryTextBox.Rtf+"')"; OleDbCommand cmd = new OleDbCommand(cmdstr, conn1); cmd.ExecuteNonQuery(); What is the problem? - Thanks.
×
×
  • Create New...