Click here to Skip to main content
12,079,202 members (27,640 online)
Rate this:
 
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 row.you can show it or hide all lines.
rowline!can you help me?
Posted 28-Mar-13 6:36am
Comments
Sergey Alexandrovich Kryukov 28-Mar-13 11:46am
   
Row in what? Nothing is clear...
—SA
Richard MacCutchan 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 28-Mar-13 11:58am
   
maybe its better make own usercontrol !
Richard MacCutchan 28-Mar-13 12:09pm
   
And you are telling me this why?
source.compiler 28-Mar-13 12:28pm
   
a control inherited from textbox , can do some addition work!?
Richard MacCutchan 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 28-Mar-13 12:59pm
   
i didnt know a simple friendly comment, make you angry! i am so sorry!
Richard MacCutchan 28-Mar-13 13:19pm
   
I'm not angry, I'm just trying to explain how to use this forum.
source.compiler 28-Mar-13 13:28pm
   
thanks!
GRASSDRAGON 29-Mar-13 6:31am
   
word,Letter paper or Draft paper style's cotrol in delphi/c++,In some business products.
ryanb31 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 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
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web04 | 2.8.160212.1 | Last Updated 28 Mar 2013
Copyright © CodeProject, 1999-2016
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