hi when i run this class i made here , this is what it looks like
without text - http://gidsfiles.googlepages.com/LinedTextBox_1.jpg
WITH TEXT (heres the issue) - http://gidsfiles.googlepages.com/Lin...x_withText.jpg
The text turns BOLD and the lines kinda get erased because of the text.
perhaps i could overide or handle the onKeydown or somethin and
intercept the text to be entered and then draw it myself. Any
suggestions???? ????
this is the code :
using System;
using System.Collecti ons.Generic;
using System.Text;
using System.Drawing;
namespace Linedtextbox
{
class LinedTextBox : System.Windows. Forms.TextBox
{
public LinedTextBox(): base()
{
Multiline = true;
SetStyle(System .Windows.Forms. ControlStyles.U serPaint,true);
}
protected override void
OnPaint(System. Windows.Forms.P aintEventArgs e)
{
int txtHeight = Convert.ToInt32 (Font.GetHeight ()) + 3;
Pen thePen = new Pen(Color.Black );
for (int i = txtHeight; i < Height ; i += txtHeight)
{
e.Graphics.Draw Line(thePen, 0, i, this.Width, i);
}
base.OnPaint(e) ;
}
}
}
Gideon 4 6027
Call base onPaint first as this is drawing over your work. Call it first,
then you will be drawing lines over its results.
--
Ciaran O''''Donnell http://wannabedeveloper.spaces.live.com
"giddy" wrote:
hi when i run this class i made here , this is what it looks like
without text - http://gidsfiles.googlepages.com/LinedTextBox_1.jpg
WITH TEXT (heres the issue) - http://gidsfiles.googlepages.com/Lin...x_withText.jpg
The text turns BOLD and the lines kinda get erased because of the text.
perhaps i could overide or handle the onKeydown or somethin and
intercept the text to be entered and then draw it myself. Any
suggestions???? ????
this is the code :
using System;
using System.Collecti ons.Generic;
using System.Text;
using System.Drawing;
namespace Linedtextbox
{
class LinedTextBox : System.Windows. Forms.TextBox
{
public LinedTextBox(): base()
{
Multiline = true;
SetStyle(System .Windows.Forms. ControlStyles.U serPaint,true);
}
protected override void
OnPaint(System. Windows.Forms.P aintEventArgs e)
{
int txtHeight = Convert.ToInt32 (Font.GetHeight ()) + 3;
Pen thePen = new Pen(Color.Black );
for (int i = txtHeight; i < Height ; i += txtHeight)
{
e.Graphics.Draw Line(thePen, 0, i, this.Width, i);
}
base.OnPaint(e) ;
}
}
}
Gideon
good thinking , i really hoped it would work but it did'nt work.
Also , if i type text and then cause a repaint (min the wndow , then
restore it) ... the text turns invsible , and the lines show .. but
then when i select the text . . ... poof! go the lines again , like in
the picture!
Gideon
On Jan 2, 2:47 pm, Ciaran O''''Donnell
<CiaranODonn... @discussions.mi crosoft.comwrot e:
Call base onPaint first as this is drawing over your work. Call it first,
then you will be drawing lines over its results.
--
Ciaran O''''Donnellhtt p://wannabedevelope r.spaces.live.c om
"giddy" wrote:
hi when i run this class i made here , this is what it looks like
without text - >http://gidsfiles.googlepages.com/LinedTextBox_1.jpg
WITH TEXT (heres the issue) - http://gidsfiles.googlepages.com/Lin...x_withText.jpg
The text turns BOLD and the lines kinda get erased because of the text.
perhaps i could overide or handle the onKeydown or somethin and
intercept the text to be entered and then draw it myself. Any
suggestions???? ????
this is the code :
using System;
using System.Collecti ons.Generic;
using System.Text;
using System.Drawing;
namespace Linedtextbox
{
class LinedTextBox : System.Windows. Forms.TextBox
{
public LinedTextBox(): base()
{
Multiline = true;
SetStyle(System .Windows.Forms. ControlStyles.U serPaint,true);
}
protected override void
OnPaint(System. Windows.Forms.P aintEventArgs e)
{
int txtHeight = Convert.ToInt32 (Font.GetHeight ()) + 3;
Pen thePen = new Pen(Color.Black );
for (int i = txtHeight; i < Height ; i += txtHeight)
{
e.Graphics.Draw Line(thePen, 0, i, this.Width, i);
}
base.OnPaint(e) ;
}
}
}
Gideon
good thinking , i really hoped it would work but it did'nt work.
Also , if i type text and then cause a repaint (min the wndow , then
restore it) ... the text turns invsible , and the lines show .. but
then when i select the text . . ... poof! go the lines again , like in
the picture!
Gideon
On Jan 2, 2:47 pm, Ciaran O''''Donnell
<CiaranODonn... @discussions.mi crosoft.comwrot e:
Call base onPaint first as this is drawing over your work. Call it first,
then you will be drawing lines over its results.
--
Ciaran O''''Donnellhtt p://wannabedevelope r.spaces.live.c om
"giddy" wrote:
hi when i run this class i made here , this is what it looks like
without text - >http://gidsfiles.googlepages.com/LinedTextBox_1.jpg
WITH TEXT (heres the issue) - http://gidsfiles.googlepages.com/Lin...x_withText.jpg
The text turns BOLD and the lines kinda get erased because of the text.
perhaps i could overide or handle the onKeydown or somethin and
intercept the text to be entered and then draw it myself. Any
suggestions???? ????
this is the code :
using System;
using System.Collecti ons.Generic;
using System.Text;
using System.Drawing;
namespace Linedtextbox
{
class LinedTextBox : System.Windows. Forms.TextBox
{
public LinedTextBox(): base()
{
Multiline = true;
SetStyle(System .Windows.Forms. ControlStyles.U serPaint,true);
}
protected override void
OnPaint(System. Windows.Forms.P aintEventArgs e)
{
int txtHeight = Convert.ToInt32 (Font.GetHeight ()) + 3;
Pen thePen = new Pen(Color.Black );
for (int i = txtHeight; i < Height ; i += txtHeight)
{
e.Graphics.Draw Line(thePen, 0, i, this.Width, i);
}
base.OnPaint(e) ;
}
}
}
Gideon
hey i figured it out:
hey! . .i got it!!!!! .. .
1. Raise a OnPaint manually from WndProc()
2. Keep causing a repaint everytime text is typed!
using System;
using System.Collecti ons.Generic;
using System.Text;
using System.Drawing;
namespace Linedtextbox
{
class LinedTextBox : System.Windows. Forms.TextBox
{
public LinedTextBox(): base()
{
Multiline = true;
}
protected override void WndProc(ref
System.Windows. Forms.Message m)
{
if (m.Msg == 0x00f)
{
// raise the paint event
base.WndProc(re f m);
Graphics graphic = base.CreateGrap hics();
OnPaint(new
System.Windows. Forms.PaintEven tArgs(graphic, base.ClientRect angle));
graphic.Dispose ();
}
else
base.WndProc(re f m);
}
protected override void OnTextChanged(E ventArgs e)
{
Graphics graphic = base.CreateGrap hics();
OnPaint(new System.Windows. Forms.PaintEven tArgs(graphic,
base.ClientRect angle));
graphic.Dispose ();
base.OnTextChan ged(e);
}
protected override void
OnPaint(System. Windows.Forms.P aintEventArgs e)
{
base.OnPaint(e) ;
int txtHeight = Convert.ToInt32 (Font.GetHeight ()) + 1;
Pen thePen = new Pen(Color.Black );
for (int i = txtHeight; i < Height ; i += txtHeight)
{
e.Graphics.Draw Line(thePen, 0, i, this.Width, i);
}
}
}
}
On Jan 3, 7:51 pm, "giddy" <gidisr...@gmai l.comwrote:
good thinking , i really hoped it would work but it did'nt work.
Also , if i type text and then cause a repaint (min the wndow , then
restore it) ... the text turns invsible , and the lines show .. but
then when i select the text . . ... poof! go the lines again , like in
the picture!
Gideon
On Jan 2, 2:47 pm, Ciaran O''''Donnell
<CiaranODonn... @discussions.mi crosoft.comwrot e:
Call base onPaint first as this is drawing over your work. Call it first,
then you will be drawing lines over its results.
--
Ciaran O''''Donnellhtt p://wannabedevelope r.spaces.live.c om
"giddy" wrote:
hi when i run this class i made here , this is what it looks like
without text - >http://gidsfiles.googlepages.com/LinedTextBox_1.jpg
WITH TEXT (heres the issue) -
>http://gidsfiles.googlepages.com/Lin...x_withText.jpg
The text turns BOLD and the lines kinda get erased because of the text.
perhaps i could overide or handle the onKeydown or somethin and
intercept the text to be entered and then draw it myself. Any
suggestions???? ????
this is the code :
using System;
using System.Collecti ons.Generic;
using System.Text;
using System.Drawing;
namespace Linedtextbox
{
class LinedTextBox : System.Windows. Forms.TextBox
{
public LinedTextBox(): base()
{
Multiline = true;
SetStyle(System .Windows.Forms. ControlStyles.U serPaint,true);
}
protected override void
OnPaint(System. Windows.Forms.P aintEventArgs e)
{
int txtHeight = Convert.ToInt32 (Font.GetHeight ()) + 3;
Pen thePen = new Pen(Color.Black );
for (int i = txtHeight; i < Height ; i += txtHeight)
{
e.Graphics.Draw Line(thePen, 0, i, this.Width, i);
}
base.OnPaint(e) ;
}
}
}
Gideon
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Richard |
last post by:
I have a requirement to put a GDI style circle or rectangle border around
the selected row of a datagrid/ It will overlap into the row above and below
the selected row. Doing this in a the OnPaint of a subclassed
DataGridTextBoxColum dos not seem like a practical way to do it.
I have subclassed a DataGrid and overridden the OnPaint as such:
|
by: Colin McGuire |
last post by:
Hi, I am just learning "how-to" by reading some of the existing
article solutions in this newsgroup. I happened to come across this
one. Tom Spink knows what he is talking about and I am wondering why
he has done something.
My question is how does this work
<pseudo>
Function To Override OnPaint(...)
Call Base Class OnPaint(...)
|
by: BB |
last post by:
Hello all,
I am trying to override OnPaint in a custom textbox
control (so I can drawstring a caption, etc.). In the
code below, I get the "painting the form" message as
expected, but not the "painting the control". It also
has no effect to explicitly call txtTest.Invalidate or
txtTest.Refresh. Am I missing something simple here?
Any push in the right direction is appreciated.
|
by: raylopez99 |
last post by:
KeyDown won't work KeyPress fails KeyDown not seen
inspired by a poster here:http://tinyurl.com/62d97l I found some
interesting stuff, which I reproduce below for newbies like me.
The main reason you would want to do this is for example to trigger
something from an OnPaint event without resorting to boolean switches--
say if a user presses the "M" key while the program is Painting, the
user gets the PaintHandler to do something else. ...
|
by: Tom P. |
last post by:
I'm trying to make one of our perennial favorites - The Syntax Color
Editor. (Mostly as a learning exercise). I'm wondering if there is a
way to capture the Paint event of a textbox so I can render the text
myself.
I've tried to replicate the functionality of a textbox, but I think it
would be easier to simply take over the painting of a plain textbox.
Then I wouldn't have to deal with several problem areas I'm currently
running into.
| |
by: SAL |
last post by:
Hello,
I'm trying to include a popup in the ItemTemplate of a gridview row. The
ItemTemplate for the field contains a textbox and when the user clicks in
the textbox I want a popup panel to show allowing the user to make a
selection from the popup window. I have enabled AJAX extensions and have a
working sample outside of a gridview. However, when I click in the textbox
of a gridview row, all I see is a really small square instead of the...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
| |
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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.
| |