Jump to content
Xtreme .Net Talk

Ming_Lei

Avatar/Signature
  • Posts

    41
  • Joined

  • Last visited

Personal Information

  • Visual Studio .NET Version
    VS Standard 2003
  • .NET Preferred Language
    C#

Ming_Lei's Achievements

Newbie

Newbie (1/14)

0

Reputation

  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()?
×
×
  • Create New...