Author Topic: Vertically align static text  (Read 80 times)

0 Members and 1 Guest are viewing this topic.

Offline Andy

  • Hero Member
  • *****
  • Posts: 1234
Vertically align static text
« on: January 13, 2018, 05:09:47 AM »
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.

Offline Egil

  • Paid Subscriber
  • Hero Member
  • *****
  • Posts: 877
    • LA2PJ
Re: Vertically align static text
« Reply #1 on: January 13, 2018, 08:55:18 AM »
Andy,

Why not use a RichEdit Control?

Code: [Select]
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!

Offline LarryMc

  • Administrator
  • Hero Member
  • *****
  • Posts: 5897
  • 'All I like is finishing'
Re: Vertically align static text
« Reply #2 on: January 13, 2018, 10:03:11 AM »
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

Offline Andy

  • Hero Member
  • *****
  • Posts: 1234
Re: Vertically align static text
« Reply #3 on: January 13, 2018, 10:27:20 PM »
Larry,

That's perfect, thank you!

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

Andy.
 :)
« Last Edit: January 14, 2018, 06:43:00 AM by Andy »
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Offline billhsln

  • Paid Subscriber
  • Hero Member
  • *****
  • Posts: 776
Re: Vertically align static text
« Reply #4 on: January 13, 2018, 11:03:29 PM »
Also came in handy for me.  Makes the program look much cleaner.

Bill
When all else fails, get a bigger hammer.