![]() |
|
[.NET] Align a form's text/title. - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [.NET] Align a form's text/title. (/showthread.php?tid=5168384) |
Align a form's text/title. - Exodus. - Feb 12, 2016 Not sure how to do this. I just want to align my Form title to the middle. That's all. * - AnonCensored - Feb 12, 2016 Add space's before the title name ? * - iLogic™ - Feb 13, 2016 (Feb 12, 2016 10:19 PM)Exodus. Wrote: Not sure how to do this. I just want to align my Form title to the middle. That's all.In windows 8/8.1 form titles are automatically aligned to the middle: ![]() What OS are you using? * - Specs - Feb 13, 2016 I had this issue before, i dont think there is a way to do it through simple properties. Using google i found this for you. Code Private Sub CenterMe()Just call "CenterMe()" On Form_Load event & you should be good. I think a more simpler way would to just add a couple spaces before like someone mentioned, but i guess this works correctly. * - Odus - Feb 13, 2016 There are no direct methods to this, you would have to draw your own form. (Feb 13, 2016 04:27 AM)Specs Wrote: I had this issue before, i dont think there is a way to do it through simple properties. Using google i found this for you. This would need to be called on form resize. It's not very efficient either, cleaned it up: Code Private Sub CenterMe()* - Earn - Feb 13, 2016 This is what I do with GDI+ themes. Code Dim G = e.GraphicsReplace 40 for the height of the header. Sorry if there are any mistakes, types that all out on my phone. * - Ninja - Feb 13, 2016 (Feb 13, 2016 05:34 AM)Earn Wrote: This is what I do with GDI+ themes. But you dont declare the type of G nor do you dispose of G afterwards... * - Earn - Feb 13, 2016 (Feb 13, 2016 05:43 AM)Tyranitar Wrote: But you dont declare the type of G nor do you dispose of G afterwards... I just done it quickly as I am on my phone. I only put the "Dim G = e.Graphics" there so the OP wasn't confused by the "G.DrawString()". * - Ninja - Feb 13, 2016 (Feb 13, 2016 05:47 AM)Earn Wrote: I just done it quickly as I am on my phone. I only put the "Dim G = e.Graphics" there so the OP wasn't confused by the "G.DrawString()". Code Using G as Graphics = e.Graphics* - Earn - Feb 13, 2016 (Feb 13, 2016 05:49 AM)Tyranitar Wrote: Disposing isn't needed, as the graphics object will get disposed when you exit the method. * - Ninja - Feb 13, 2016 (Feb 13, 2016 05:54 AM)Earn Wrote: Disposing isn't needed, as the graphics object will get disposed when you exit the method. Oh I didn't know that. Still wouldn't hurt for good practice though. |