Hello all,
I'm currently writing a program in which I need a textbox control, similar
to the code editor in .NET. but with line numbers and such. I can't find
anything third-party that even comes close to what I want to do, so I
figured I'd have to write one myself.
I started first by inheriting from a RichTextBox, but I want to be able to
scroll line by line in the control instead of pixel by pixel, and I couldn't
figure out a way to make that happen. Also, I had a hard time making the
line numbers, line up with their line of text.
Then, I tryed started from scratch, and I pretty much got it working, but
scrolling is incredibly slow, as I'm using GDI+ to draw the text, and all
the lines needed.
Am I going about this all wrong? It seems like there should be a better way
to do it, but I'm not sure. If anyone here could point me in the right
direction, that would be great.
Thanks,
Matt Rudder 2 1595
avoid using the RichTextBox for anything custom. The RTB is a great
control if you need a lot of functionality built in but is almost
entirely non-customizeable.
If you are really needing to do it from scratch I suggest you start
with the Windows.Forms.U serControl object and work on optimizing the
draw routines so you only 'display' items that are currently in view.
To get the line numbers to line up correctly (assuming you mean
vertical line up) then make sure you use a fixed font like FixedSys so
everything lines up as if each letter were in a box.
hope that helps
Allen Anderson http://www.glacialcomponents.com
On Sun, 5 Oct 2003 14:49:27 -0700, "Matt Rudder"
<ma**@cypher-edge.com> wrote: Hello all,
I'm currently writing a program in which I need a textbox control, similar to the code editor in .NET. but with line numbers and such. I can't find anything third-party that even comes close to what I want to do, so I figured I'd have to write one myself.
I started first by inheriting from a RichTextBox, but I want to be able to scroll line by line in the control instead of pixel by pixel, and I couldn't figure out a way to make that happen. Also, I had a hard time making the line numbers, line up with their line of text.
Then, I tryed started from scratch, and I pretty much got it working, but scrolling is incredibly slow, as I'm using GDI+ to draw the text, and all the lines needed.
Am I going about this all wrong? It seems like there should be a better way to do it, but I'm not sure. If anyone here could point me in the right direction, that would be great.
Thanks, Matt Rudder
avoid using the RichTextBox for anything custom. The RTB is a great
control if you need a lot of functionality built in but is almost
entirely non-customizeable.
If you are really needing to do it from scratch I suggest you start
with the Windows.Forms.U serControl object and work on optimizing the
draw routines so you only 'display' items that are currently in view.
To get the line numbers to line up correctly (assuming you mean
vertical line up) then make sure you use a fixed font like FixedSys so
everything lines up as if each letter were in a box.
hope that helps
Allen Anderson http://www.glacialcomponents.com
On Sun, 5 Oct 2003 14:49:27 -0700, "Matt Rudder"
<ma**@cypher-edge.com> wrote: Hello all,
I'm currently writing a program in which I need a textbox control, similar to the code editor in .NET. but with line numbers and such. I can't find anything third-party that even comes close to what I want to do, so I figured I'd have to write one myself.
I started first by inheriting from a RichTextBox, but I want to be able to scroll line by line in the control instead of pixel by pixel, and I couldn't figure out a way to make that happen. Also, I had a hard time making the line numbers, line up with their line of text.
Then, I tryed started from scratch, and I pretty much got it working, but scrolling is incredibly slow, as I'm using GDI+ to draw the text, and all the lines needed.
Am I going about this all wrong? It seems like there should be a better way to do it, but I'm not sure. If anyone here could point me in the right direction, that would be great.
Thanks, Matt Rudder This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Andy |
last post by:
Alright, I am beyond confused here and need some guidance. I need a
C# only sample. I have a simple Page and within it i am creating a
user control (ascx). The user control contains textboxes, buttons,
ect. I would like to catch/add a handler/recieve the Button.OnClick
event from the buttons that are in the user control, in the Page.
How?...
|
by: Kepler |
last post by:
I have a custom control that is thrown onto a UserControl that is
thrown onto a WebForm. Basically, I've got a scenario where if my
UserControl sets an attribute on the custom control in the ascx,
EnsureChildControls gets called, creating the control before the
UserControl is even added to the webform. The problem with this is
that the...
|
by: Raed Sawalha |
last post by:
Hi,
I have a strange problem with a usercontrol on a page. The usercontrol
dispalyes three categories (From a database) when the user clicks a category
they see all the products in a shop for that category, the results are paged
10 to a page and the user can page them.
As this "Category" usercontrol hardly ever changes I wanted to setup...
|
by: JohnR |
last post by:
In it's simplest form, assume that I have created a usercontrol,
WSToolBarButton that contains a button. I would like to eventually create
copies of WSToolBarButton dynamically at run time based on some
initialization information obtained elsewhere. Basically, I'm going to
create my own dynamic toolbar where the toolbarbuttons can change. ...
|
by: Joe |
last post by:
Hello All:
Do I have to use the LoadControl method of the Page to load a UserControl?
I have a class which contains three methods (one public and two private).
The class acts as a control server. It "serves" back the required control
(either WebControl or UserControl) based on the contents of an xml file. The
code in the webform places...
| |
by: Marcelo Cabrera |
last post by:
Hi,
I have a user control that in turn creates a bunch of webcontrols
dynamically and handles the events these webcontrols raise. It used to work
fine on ASP .Net 1.1 but when compiled on 2.0 it does not. The problem is
that the webcontrols get created on the OnLoad event of the usercontrol and
the event handlers are assigned at the same...
|
by: MeowCow |
last post by:
I have created a UserControl that encapsulates a third party data grid.
My goal was to create my own DataSource and DataMember properties that
forward the binding to the third party grid, then use binding like
normal.
The problem I am running into is that my UserControl ends up with a
different BindingContext then the ParentForm it is...
|
by: Martin |
last post by:
Hi !
I've developed a small UserControl with five textbox and label.
However, when I want to display the UserControl in a form, controls
appear slowly one after one. I've activated double buffering and
removed all code in the OnLoad, constructor and I still have the same
problem.
Here is the code that I use to display the UserControl un...
|
by: Wayne Brantley |
last post by:
If you expose a public property of a usercontrol that accesses an object on
the user control it will give a null reference exception when you wrap that
in an update panel.
Others are having the same problem. Here is a complete example:
http://forums.asp.net/thread/1555836.aspx
Related to this: (But I am not doing dynamic user control...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |