Jump to content
  • Advertisement
Sign in to follow this  
cpp forever

Static & edit text at same x-coordinate

This topic is 4814 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have created static and edit with x-coordinate = 50. I have set text to them. The problem: text in edit control begins at ~ 55 (text in static stays at 50). How to decrease the left margin of editbox to 0, so texts in static and edit will be at the same x-coordinate?

Share this post


Link to post
Share on other sites
Advertisement
Does it really matter that much? But anyway, I haven't tried this, but you could try using AdjustWindowRect(), passing it the style you get from GetWindowLong(hWndEditBox,GWL_style) and then use the x-difference to work out where to display the static control.

Edit: Apparently that doesn't work. Damn.
You can't actually change the edit control to display its text at a 0 x-coordinate, since that would be over the frame of the control. You can however, move the static control right by a few pixels to compensate. But IMO it'd look better as it is, with both controls at x:50.

Share this post


Link to post
Share on other sites
Quote:
Original post by Evil SteveYou can't actually change the edit control to display its text at a 0 x-coordinate, since that would be over the frame of the control. You can however, move the static control right by a few pixels to compensate. But IMO it'd look better as it is, with both controls at x:50.


Could I disable editbox's frame (border, make it zero)?

Share this post


Link to post
Share on other sites
Quote:
Original post by cpp forever
Could I disable editbox's frame (border, make it zero)?
It doesn't seem like it. It seems that the edit control itself draws the frame, it's not drawn by Windows, so editing the style won't help.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!