Jump to content
Xtreme .Net Talk

pjv

Avatar/Signature
  • Posts

    91
  • Joined

  • Last visited

Everything posted by pjv

  1. Just handle the mouse move events and store the position from the X and Y properties of MouseEventArgs. Get the stored values in your Paint event and do the drawing there. Simple.
  2. DX is poorly documented.. but it's not the worst.
  3. I'm pretty sure you'll need d3d if you want alpha blending as well.. as I don't think directdraw supports it. I could be wrong though. Also, even in a 2d game you can benefit from 3d effects. i.e. particle system or whatever.
  4. There's a redistributable file you'll need users to download. I think it's part of the SDK, but it's also available for separate download.
  5. pjv

    Decompiler

    Reflector (search for it on google) will allow you to view inside assemblies (dll or exe) and decompile to c# or vb (or IL if you really want). The code does not recompile.. but you can look. I'm uncertain as to whether or not it's legal.. surely if you own the program (i.e. you paid for it) then you can do what you like with it (from the comfort of your own home, without involving others or selling a competitive product, etc)?
  6. Interesting.. I've just tried it and it doesn't seem to work. -- Pete
  7. Richedit.h from the platform SDK offers these possibilities: // PARAFORMAT 2.0 masks and effects #define PFM_SPACEBEFORE 0x00000040 #define PFM_SPACEAFTER 0x00000080 #define PFM_LINESPACING 0x00000100 To use them you will need a PARAFORMAT2 struct: [structLayout( LayoutKind.Sequential )] private struct PARAFORMAT { public int cbSize; public uint dwMask; public short wNumbering; public short wReserved; public int dxStartIndent; public int dxRightIndent; public int dxOffset; public short wAlignment; public short cTabCount; [MarshalAs( UnmanagedType.ByValArray, SizeConst = 32 )] public int[] rgxTabs; // PARAFORMAT2 from here onwards public int dySpaceBefore; public int dySpaceAfter; public int dyLineSpacing; public short sStyle; public byte bLineSpacingRule; public byte bOutlineLevel; public short wShadingWeight; public short wShadingStyle; public short wNumberingStart; public short wNumberingStyle; public short wNumberingTab; public short wBorderSpace; public short wBorderWidth; public short wBorders; } You will then need SendMessage: [DllImport( "user32", CharSet = CharSet.Auto )] private static extern IntPtr SendMessage( HandleRef hWnd, int msg, int wParam, ref PARAFORMAT lParam ); Now make sure the text you want to change line spacing for is selected and do this: PARAFORMAT fmt = new PARAFORMAT(); fmt.cbSize = Marshal.SizeOf( fmt ); fmt.dwMask = PFM_LINESPACING; // Or whatever fmt.dyLineSpacing = 2; // Or whatever // This assumes you will be calling from a class derived from RichTextBox SendMessage( new HandleRef( this, Handle ), EM_SETPARAFORMAT, SCF_SELECTION, ref fmt ); Where the two constants used are: const int SCF_SELECTION = 1; const int EM_SETPARAFORMAT = 1095; Hope this helps, it's completely untested. -- Pete
  8. I suppose it's possible to override VScroll and WndProc (for the scroll messages that don't seem to make it to VScroll)... I was hoping for a better solution though (like a simple API call or something to set an option for richedit). Ah well. -- Pete
  9. *sigh* I'm rapidly coming to the conclusion that there's no way of doing this. Very annoying as TextBox seems to scroll normally, but RichTextBox insists on doing it smoothly. -- Pete
  10. You need a manifest file (filename.exe.manifest) for your app with .net 1.0. You also need to set all control's FlatStyle properties to FlatStyle.System. Search the internet for more info. -- Pete
  11. pjv

    callback

    You don't like function pointers.. and yet your example seems to be using them? I can't see any other way ExOfCallback could be passed to the send method. I would like to see the signature of the send method to be sure. Delegates in c# are quite different (there's lots of info on the internet). It would be a good idea to let us know exactly what you are trying to achieve here. What does the code do? -- Pete
  12. Most of what you want can probably be found here: http://www.codeproject.com/books/0764549146_8.asp It talks about both context menus and parsing urls before they get to the browser. -- Pete
  13. pjv

    callback

    Callbacks are perfectly usable in C++ (through function pointers or functor classes). In C# we have delegates. What do you mean virtual functions cannot make recursive calls (I don't see why not)? How is this windows forms related? -- Pete
  14. I think the closest we have is this: http://motlib.net but I don't think it's much good. I haven't looked too closely though. -- Pete
  15. Hey folks, I'm trying to use the RichTextBox in my application. The problem is that I would like it to scroll line-by-line normally, instead of the default smooth scrolling. Does anyone know how this might be accomplished? I've searched the forums, google, codeproject, etc and found nothing.. so it's either difficult or so blindingly obvious that noone mentions it :) Thanks, -- Pete
  16. I've had this problem too. Neither of the posted solutions worked for me. I think I solved it by adding the dir with the debugger in to my path.. but I can't quite remember. -- Pete
  17. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/custlaywinforms.asp ..might be of some use. I wish I knew if he'd continued work on it or not, as it's not quite complete. -- Pete
  18. If you're using Application.EnableVisualStyles, then you need an Application.DoEvents immediately after it. It's a workaround for a bug in the framework that sometimes prevents imagelists from working with xp visual styles. -- Pete
  19. Use a converter
  20. I recently found a free component at: http://www.csharphelp.com/archives3/archive503.html which might be worth checking out. I think it comes with source too. -- Pete
  21. It's just occurred to me that you might get what you want from putting your control in a panel and setting AutoScroll to true. Check the docs for more info. -- Pete
  22. This is one of .nets weak areas I'm afraid. For those controls that don't have scrollbars you will need a custom control approach tying together HScrollBar, VScrollBar and the other component of your choice. Fortunately, there are lots of samples on http://www.codeproject.com. -- Pete
  23. Can't you use regexp to separate them? Or string.split? -- Pete
  24. So is there any particular reason that it has to be done this way? What's wrong with just using a common method to do the drawing and calling it separately from SaveSurface and OnPaint with different graphics objects? -- Pete
  25. How about not saving anything to disk in the OnPaint override? It's only really meant for screen painting you know. If you need a Graphics object just to save to disk you could use CreateGraphics to get one. If you have common code between OnPaint and the image you want to save, just use a method and pass a graphics object to it. In OnPaint pass e.Graphics, for saving pass newly created graphics object (don't forget to dispose when method returns). ...Or maybe I'm still not understanding the problem? Are you trying to take a screenshot or something? In which case this might help: http://www.syncfusion.com/faq/winforms/search/625.asp -- Pete
×
×
  • Create New...