Hi All,
I'm still having problem to having a rotating text/label. Is there any efficient way to achieve this?
any help will be greatly appreciated
Graphite
Printable View
Hi All,
I'm still having problem to having a rotating text/label. Is there any efficient way to achieve this?
any help will be greatly appreciated
Graphite
I know of something I could try to do, but it may be more complex than you need/want. With some API functions you can actually create fonts that are rotated to various angles, and then pop the font itself into a DC. If you did that to, say, a picturebox, any text printed from that point is going to be rotated in that manner. I can try to make up a fast control if you want this kind of thing (I might be able to use it later so I think I'll make it up anyway :) ).
Out of curiosity, how are you attempting to do the rotation? I've made up a control to do it, but I've never tried to persist an object inside a UC before. I'm getting varying results, but not a 100% working control. It does rotate text though. I'm trying to work out the way to keep the text centered relative to the extent of the control itself.
I would like to see this control.
I put that in there except for the direction of rotation, but that's easy to add in. I never thought about it, but I'm so accustomed to using trig everywhere that I never think of doing anything but counterclockwise :). I'm having a problem keeping the font info there though. I can persist a font object in other controls, but I think I may be losing a font object (as a result of DeleteObject and giving it the wrong one), and it's messing it up.
Well here it is. After many changes, and scrapping things that didn't work, and then kicking myself a lot after realizing I was trying to do the simplest of things complex ways (like attempting to persist the rotated font, which was a no no, so I switched to just repainting it on demand), I finished it. Tell me what you think, or if there are any problems.
It's not seeming to rotate for me. It just moves it around in the label. How do you use it? I am setting the angle to different degrees, but it doesn't do anything.
Nevermind! I got it to work. I changed the font from MS Serif to Arial and it worked fine! Cool control. I'll be able to use this somewhere.
______________________________________________________________________
I figured out what was wrong. If you have the font size the default, it doesn't rotate, but once you change the font size it works. MS Serif and 8 pt don't go together well. They play dirty.
Heh heh. I forgot to mention that. Only TrueType fonts can rotate, and the default font it has is part of the OEM charset (I think). TT is the ANSI charset. There's only a couple of those anyway. Like MS Serif, MS Sans Serif, Fixedsys etc. But any other font works fine. If you pick one of those, it will attempt to make a substitution if there is some angle specified. It will display any of them at 0° though.
If that is true, why did it work when I left it at MS Serif, but I changed the font size up one? Well it doesn't really matter, it's still a cool control.
PS where are you in the world? It's like almost 2 AM here (California, USA)
Hmm... well maybe there's just something about that font. Anyhow, it's not one I like :). All my VB things get Tahoma, or Courier New if I need a monospace one.
I'm 3 hours behind you, on the east coast in Virginia.
This is just a dumb question, but why are you posting so early in the morning?! Or is it late in the evening for u like it is for me?
I'm a night person, and I don't sleep very much. I'm generally up until 4-5 am during the summer or when I don't have obligations that require me to be elsewhere at early times in the morning. During classes though I have to force myself to assume a "normal" schedule :). But I do better during the summer when I can return to what I call a normal schedule. The time difference is 3 hours later. when it's 12 pm your time, it's 3 pm my time.
How did you change the font size?Quote:
Originally posted by MidgetsBro
If that is true, why did it work when I left it at MS Serif, but I changed the font size up one? Well it doesn't really matter, it's still a cool control.
Bro!!!!!!!!Quote:
Originally Posted by Kaverin
This thing ROCKS!!!!!!!
Thank you Thank you Thank you!! :thumb: :thumb: :thumb:
Hmmm... Guys, you do know that this thread is over 4 years old don't you? And Kaverin haven't been seen in these forums for almost 2 years...
But reply on the thread, and poof, I can appear (thanks to getting an email about a response, otherwise I would have never thought about the forum again). :) I got really busy with work and other stuff, and didn't mess around with VB much for a long time, and one of the consequences was that I didn't hang around in the forums much either, and eventually I must have forgotten about it. For a while I was messing with VC++ 6 since I had just bought it around that time, so that also contributed to a decline in the VB things. The last thing I remember doing with VB was writing a program that I needed in the microbiology lab where I worked, but that was more than 2 years ago, and now I can't even remember what exactly it was for. :(
I'm glad to see that people like what I had made though, even though it has been so long. I'm surprised that I could still remember my password and login, and that my account did still exist. Most of the people I remember posting quite a bit are probably moderators by now too.
I may start hanging around again though and mess with VB/C++ some more to get familiar with it again, since this has piqued my interest again, and it would probably be useful in the future. I need to update that signature too... that thing is really outdated in the post preview I just looked at. :eek:
pretty cool how that worked out! welcome back
Yes Welcome Back!
I do have a question for you on your control. When I try to print the form I get an overflow error. I am using true type fonts as well.
Can you help me with this please?
Thanks,
John