March 29, 2024, 03:46:12 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Vertically align static text

Started by Andy, January 13, 2018, 05:09:47 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andy

Does any one know how to vertically align text in a static?

The text appears near the top border of the static and I would like a way to move it down slightly, best case would be centered.

I think you can do it with buttons but can't find anything on msdn about the same for statics.

Thanks,
Andy.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Egil

Andy,

Why not use a RichEdit Control?


AutoDefine "Off"

def win:window 
def run,wstyle:int 
wstyle = @MINBOX|@MAXBOX|@size|@TOOLWINDOW


' Create a window .. 
OpenWindow win,0,0,480,300,wstyle,0,"  IWB Test Window",&messages 


CONTROL win,@RICHEDIT,"TEST",150,100,12,100,@CTEDITRO|@CTEDITMULTI,100
'setcontroltext win,100,"Test"


run = 1 
WAITUNTIL run = 0 
CLOSEWINDOW win 
END 


'
' Main loop
'-------------------------------------------------------------------------------------
SUB messages(),int

SELECT @class

CASE @idcreate 
centerwindow win

CASE @idclosewindow 
run = 0 

ENDSELECT 

RETURN  0
EndSub
'-------------------------------------------------------------------------------------
'

Support Amateur Radio  -  Have a ham  for dinner!

LarryMc

Andy
Add a style of 0x200.
That will center the text exactly vertically in the box (give or take 1 pixel)

I need to add that flag to iwbstd.incc.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Andy

January 13, 2018, 10:27:20 PM #3 Last Edit: January 14, 2018, 06:43:00 AM by Andy
Larry,

That's perfect, thank you!

The text looks so much better now it's aligned.

Andy.
:)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

billhsln

Also came in handy for me.  Makes the program look much cleaner.

Bill
When all else fails, get a bigger hammer.