Problem with distance of text from image

Feb 13, 2013 at 10:22 PM
Edited Feb 13, 2013 at 10:31 PM
Hey; I am currently in the process of developing an application using the Office 2007 Ribbon created as a result of this project; I am having a problem which I would assume would be relatively easy to fix but insofar as the documentation I have read on this site I have not found a means of resolving. As you can see in the image I have included the button text that consists of more than one word or line is displaying lower than the text for a single line or word. Any ideas as to how I could have it display the same distance from the image regardless of the length of the text?
Feb 14, 2013 at 7:39 AM
As I am currently short of time, I have no time to verify that:
In RibbonButton.cs go to function OnPaintText. Change the settings of the StringFormat "sf" accordingly.
Please let me know if that works.
Feb 14, 2013 at 5:05 PM
I appreciate the response but I honestly am not sure what you're suggesting I do. I am at the definition for OnPaintText and I'm afraid I'm unaware of the StringFormat you're referring to. I'm sorry, I'd have to say I'm relatively new to application development.
Feb 15, 2013 at 7:20 AM
The StringFormat defines the alignment of the string (Near, Center and Far). This translates e.g. for vertival alignment to Top, Center and Bottom. Change them, play around with the values and see the difference.
Feb 15, 2013 at 7:36 PM
I am not seeing any property of OnPaintText called StringFormat, or sf.
Feb 18, 2013 at 7:54 AM
In the function "OnPaintText" is a local variable "sf" of type "StringFormat". "sf" has a property LineAlignement - change it like "sf.LineAlignement = StringAlignment.Near;".
Feb 18, 2013 at 6:14 PM
That worked like a charm! I'm sorry, I hadn't thought about modifying the source code and recompiling the DLL. Thank you so much for your help :D