Jump to content
Xtreme .Net Talk

xposure

Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by xposure

  1. the problem your having is the last param needs to be null, aka new IntPtr(0) Message msg = Message.Create(this.Handle, EM_GETLINE, (IntPtr)Index, (IntPtr)buffer[0]); the bold is the problem, but i'm also not sure when your trying to give it a buffer, the message handler won't work with a user created buffer, when your doing base.DefWndProc(ref msg); that, your telling the underlying control to process the message, which it expects null because its using its own internal buffer. If i read that wrong please reply and clarify. -Xposure
  2. Will do i guess i never mentioned the reasoning behind it was i do a lot of programming between MCUs and mostly on a z80, all the MCUs IDEs suck horribly, for example zilogs zds 2, if you extensively use the assembler you start getting freak errors on line numbers that don't exist, and HeW isn't much better you need a 800+ to run it:) but anyways i don't touch C and i love ASM, so its about time there is a true IDE for it:)
  3. Well its good to see some interest Yea i'm using System.Drawing, but its not bad at all, if there is some other approaches that you might know of go ahead and post i only now of DirectX and GDI. On the other hand it is efficient, it only redraws when it needs to the actual left margin is stored into a surface which can just be repainted using one line of code, but if the line numbers or anything else along the lines of changing the leftmargin the it calls renderleftmargin which redraw to the left margin surface which then invalidates the left side to repaint it P.S. i've had plans on making a generic IDE, with subversion support and project management, and a plugin framework for making additional mods to it, if anyone is interested in it or just wants to post and/or brainstorm some things go ahead and throw a post up:) -Xile
  4. screenshot here is a quick screen shot of what its looking like, (this is a old version i scraped yesterday due to too many tweaks i kept coming up with and weren't worth trying to hack/implement) http://www.shol.com/jasper/codefold.jpg -Xposure
  5. i'm in the process of making a look-a-like of the MS version for the code window, i've already have it code folding and displaying line numbers correctly. i recently came across i snip where some used the api to resize the client area so you can actually just subclass/inherit the control and draw to it rather then actually making a user control throwing a richtextbox on it and then drawing to the main control. the problem i seem to be having is the fact that when the rtb redraws it still erases the screen in the nonclient area making a harsh flickering, the margin that has the graphical data is in a surface that i just redraw when needed and update when needed, but like i said even with that the rtb insists on clearing the entire line, i've tried killing ncpaint and a few others with no luck. anyone have any ideas how to solve this? another thing is when the code folds into a single line i use a surface once again to draw the grey border and the grey text for the collapsed code description and then convert it to emf then to wmf and then to rtf which works but the rtb selects it like word would and puts blocks in the corners (making it ugly) anyone else have a idea on maybe i different approach? and last but not least how in the hell can you make the vertical scrollbar scroll in line increments rather then pixels (vs.net does whole lines) p.s. when i get a working version i'll post a link to my site which will have full source to the control -Xposure
  6. The .Net way although the above works its not the .net way:) you lose portability plus your making calls to unmanaged code on the other hand her is a nice snippet you can use, just inherit a richtextbox and add the following Private Const EM_LINELENGTH = &HC1 Private Const EM_GETLINE = &HC4 Private Const EM_GETLINECOUNT = &HBA Private Const EM_LINEFROMCHAR = &HC9 Private Const EM_LINEINDEX = &HBB Private Const EM_GETFIRSTVISIBLELINE = &HCE Private Const EM_LINESCROLL = &HB6 Private Const EM_POSFROMCHAR = &HD6 Private Const EM_GETSEL = &HB0 Private Const EM_SETSEL = &HB1 Private Const EM_CANUNDO = &HC6 Private Const EM_SETTEXTEX = (WM_USER + 97) Private Const EM_GETTEXTEX = (WM_USER + 94) Private Const EM_GETSELTEXT = (WM_USER + 62) Private Const EM_REPLACESEL = &HC2 Private Const EM_STREAMOUT = (WM_USER + 74) Private Const EM_STREAMIN = (WM_USER + 73) Private Const EM_SCROLLCARET = &HB7 Private Const EM_FINDTEXTEX = (WM_USER + 79) Private Const EM_CHARFROMPOS = &HD7 Private Const EM_GETRECT = &HB2 Private Const EM_SETRECT = &HB3 Public Function GetLine(ByVal charindex As Integer) As Integer Dim m As Message = Message.Create(Me.Handle, EM_LINEFROMCHAR, New IntPtr(charindex), New IntPtr(0)) MyBase.WndProc(m) Return m.Result.ToInt32 End Function Public Function GetLineStart(ByVal line As Integer) As Integer Dim m As Message = Message.Create(Me.Handle, EM_LINEINDEX, New IntPtr(line), New IntPtr(0)) MyBase.WndProc(m) Return m.Result.ToInt32 End Function Public Function GetLineLength(ByVal line As Integer) As Integer Dim m As Message = Message.Create(Me.Handle, EM_LINELENGTH, New IntPtr(line), New IntPtr(0)) MyBase.WndProc(m) Return m.Result.ToInt32 End Function Public Function GetLineCount() As Integer Dim m As Message = Message.Create(Me.Handle, EM_GETLINECOUNT, New IntPtr(0), New IntPtr(0)) MyBase.WndProc(m) Return m.Result.ToInt32 End Function Public Function GetCurrentLineStart() As Integer Dim m As Message = Message.Create(Me.Handle, EM_LINEINDEX, New IntPtr(-1), New IntPtr(0)) MyBase.WndProc(m) Return m.Result.ToInt32 End Function Public Function GetCurrentLine() As Integer Dim m As Message = Message.Create(Me.Handle, EM_LINEFROMCHAR, New IntPtr(-1), New IntPtr(0)) MyBase.WndProc(m) Return m.Result.ToInt32 End Function Public Function GetFirstVisibleLine() As Integer Dim m As Message = Message.Create(Me.Handle, EM_GETFIRSTVISIBLELINE, New IntPtr(0), New IntPtr(0)) MyBase.WndProc(m) Return m.Result.ToInt32 End Function Public Function GetLastVisibleLine() As Integer Return Me.GetLine(Me.GetCharIndexFromPosition(New Point(0, Me.Height - iHortBorderWidth))) End Function i know some of the above are duplicated from what it already has for example getlinefromcharindex, but do a performance test on mine vs the control its 4-5 times faster go figure.... -Xposure
×
×
  • Create New...