locked
Textbox Margin set by EM_SETMARGINS ignored? RRS feed

  • 질문

  • Hi,
     
    I used EM_SETMARGINS to set 10px margin on the right hand of the textbox.

    It works fine when i am typing letters and exceeds the width of the textbox.
    When the text is more than what textbox can hold, the text will shift left and the margin space is reserved.

    However, once i have text and press "Home" key or left arrow to scroll back, the entire textbox is occupied (including the margin).
    It looks like it happens if my textbox is set to be Left-to-Right and if i have margin on right side.
    If I set the margin on the left side when the textbox is Left-to-Right, the margin is correct regardless where the current position is.

    To make sure nothing is resetting the margin, in the rendering, i get the margin by EM_GETMARGINS and draw 2 lines for both left and right margin.
    The line is at the right position regardless where the text is, but if i scroll the text back to the beginning, the right margin is ignored.

    Is anything else experiencing this problem?
    If so, is there any workaround?

    Thanks!
    • 편집됨 Khronosx 2008년 10월 12일 일요일 오전 2:01
    2008년 10월 12일 일요일 오전 1:59

답변

  • No repro on XP but repro on Vista x64.  This looks like a Vista bug to me, I don't see a viable workaround.  You'll have to contact Microsoft CSS.
    Hans Passant.
    • 답변으로 표시됨 nobugz 2008년 10월 25일 토요일 오후 9:53
    2008년 10월 14일 화요일 오전 10:57

모든 응답

  • I cannot repro your problem, it works fine on Windows XP, SP2.  Post a small repro project on a file sharing service.
    Hans Passant.
    2008년 10월 12일 일요일 오후 7:32
  • Thanks for the reply.

    Here is the project.
    http://cid-433d41df9bddd7e0.skydrive.live.com/self.aspx/Margin/TextboxMargin.zip

    It's C# code, but it uses SendMessage to set the margin.

    Here is a picture that might help explaining the problem.

    http://cid-433d41df9bddd7e0.skydrive.live.com/self.aspx/Margin/Form.JPG

    There are 2 textboxes in the form. Both have 30 px margin on the left side and 20px margin on the right side.

    Both textboxes have the exact same text. It works find when user is typing the letters.
    However, as soon as the user press arrow keys or Home key to scroll back, the right margin is no longer honored.
    The left margin is still working fine.

    Red lines are used to show where the margin is.

    It looks like, if the TextBox is set to be Left-To-Right, the left margin will always work, but the right margin doesn't.
    If the TextBox is set to be Right-To-Left, then the right margin will always work, but the left margin doesn't.

    Can you point out what is wrong in the code?

    Thanks!
    2008년 10월 14일 화요일 오전 6:15
  • No repro on XP but repro on Vista x64.  This looks like a Vista bug to me, I don't see a viable workaround.  You'll have to contact Microsoft CSS.
    Hans Passant.
    • 답변으로 표시됨 nobugz 2008년 10월 25일 토요일 오후 9:53
    2008년 10월 14일 화요일 오전 10:57
  • Interesting... I am using XP SP3 and it's reproing for me..

    I will see if i can get SP2 machine to try out.

    Thanks!
    2008년 10월 14일 화요일 오후 5:36
  • Hi Khronosx,

    I downloaded the project from the LINK above, and copy it to a XP SP2 English edition, exactly, I can reproduce the problem, when the text length is greater than the length of the textbox, scroll back lead to the problem that the text occupied the right margin of the textbox control .

    Perhaps you can try to submit a bug via the connect web site below, and you can paste the LINK of this thread to clarify and verify the issue when submit the problem.

    http://connect.microsoft.com/visualstudio/

    Regards,

    Xun


    Please remember to mark the replies as answers if they help and unmark them if they provide no help. http://forums.msdn.microsoft.com/en-US/csharpide/thread/8e9ed0d7-11ff-402a-8489-9b5f05eeb706
    • 편집됨 jack 321 2008년 10월 16일 목요일 오전 4:02 correct grammar
    2008년 10월 16일 목요일 오전 4:01
  • The Connect site doesn't handle bugs caused by Windows, only bugs fixable by DevDiv.  They'll close your feedback with Closed (external).  You'll have to go through Microsoft CSS.  However, the odds that they'll make a new version of user32.dll for you are fairly slim.  The best you can hope for is a workaround.
    Hans Passant.
    2008년 10월 16일 목요일 오전 9:54
  • Thanks Xun and Hans,

    I just wanted to know whether the problem was due to my code or if it's a bug from system.

    I have already start making workaround, so hopefully that will work better.

    Thanks!
    2008년 10월 16일 목요일 오후 6:12
  • I know this is an old post, but I confirm that I'm seeing the same problem with Windows 7, Windows 7 SP1 also.
    2011년 3월 6일 일요일 오후 8:34
  • 2020 and looks like this bug will never be fixed...


    GP Software

    2020년 4월 9일 목요일 오전 4:51