Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# WinForm Editors
how to create a textbox or richtextbox and it every row has a rowline?
like word's gridlines,in every row.you can show it or hide all lines.
rowline!can you help me?
Posted 28-Mar-13 6:36am
Comments
Sergey Alexandrovich Kryukov at 28-Mar-13 11:46am
   
Row in what? Nothing is clear...
—SA
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
   
thanks!
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
good
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) 
             {
                  aaa();
            }
            
        }
         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);
                }
            }
 
        }
    }
  Permalink  
Comments
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 350
1 Jochen Arndt 190
2 Richard MacCutchan 135
3 Sergey Alexandrovich Kryukov 130
4 DamithSL 95
0 OriginalGriff 6,045
1 DamithSL 4,601
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,310


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 28 Mar 2013
Copyright © CodeProject, 1999-2014
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