Click here to Skip to main content
11,805,035 members (66,439 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C# editing
how to create a textbox or richtextbox and it every row has a rowline?
like word's gridlines,in every can show it or hide all lines.
rowline!can you help me?
Posted 28-Mar-13 5:36am
Sergey Alexandrovich Kryukov at 28-Mar-13 11:46am
Row in what? Nothing is clear...
Richard MacCutchan at 28-Mar-13 11:46am
I don't think text boxes (rich or poor) are designed to do that; you probably need to use a datagrid of some type.
source.compiler at 28-Mar-13 11:58am
maybe its better make own usercontrol !
Richard MacCutchan at 28-Mar-13 12:09pm
And you are telling me this why?
source.compiler at 28-Mar-13 12:28pm
a control inherited from textbox , can do some addition work!?
Richard MacCutchan at 28-Mar-13 12:54pm
If you have some advice on this question please post it to the questioner rather than to me.
source.compiler at 28-Mar-13 12:59pm
i didnt know a simple friendly comment, make you angry! i am so sorry!
Richard MacCutchan at 28-Mar-13 13:19pm
I'm not angry, I'm just trying to explain how to use this forum.
source.compiler at 28-Mar-13 13:28pm
GRASSDRAGON at 29-Mar-13 6:31am
word,Letter paper or Draft paper style's cotrol in delphi/c++,In some business products.
ryanb31 at 28-Mar-13 16:06pm
Maybe you can explain what you are trying to do more clearly. There may be an alternative you haven't thought of.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

like this,but I dont get rowhight.

class rowlineTextbox : TextBox
          const int WM_PAINT = 0xF;
        protected override void WndProc(ref Message m)
            base.WndProc(ref m);
            if (m.Msg == WM_PAINT||m.Msg == 0x133) 
         private void aaa()
            using (Graphics g = Graphics.FromHwnd(base.Handle))
                Pen tPen;
                Size CSize = this.ClientSize;
                int cordX1 = this.Location.X + this.Padding.Left;
                int cordX2 = CSize.Width - this.Padding.Right;
                int cordY1 = this.Location.Y + this.Padding.Top;
                int cordY2 = cordY1;
                tPen = new Pen(Color.Black, 1.0F);
                g.DrawLine(tPen, cordX1, cordY1, cordX2, cordY2);
                for (int i = cordY1; i <= CSize.Height; i += this.Font.Height)
                    g.DrawLine(tPen, cordX1, i, cordX2, i);
Richard MacCutchan at 29-Mar-13 6:37am
What results do you get? Use your debugger to step through the code and check the values of all the variables at each step.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 305
1 Sergey Alexandrovich Kryukov 268
2 CPallini 210
3 Richard Deeming 190
4 CHill60 150
0 OriginalGriff 3,255
1 Maciej Los 1,990
2 KrunalRohit 1,907
3 CPallini 1,855
4 Richard MacCutchan 1,227

Advertise | Privacy | Mobile
Web02 | 2.8.151002.1 | Last Updated 28 Mar 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100