Print Page | Close Window

change pushButton Icon position

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Suite Pro
Forum Description: Topics Related to Codejock Suite Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=7041
Printed Date: 19 May 2024 at 12:18pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: change pushButton Icon position
Posted By: yair-edsoft
Subject: change pushButton Icon position
Date Posted: 04 May 2007 at 9:11am
hi all
if you are using RTL Lay out and want to change the posion of the icon to the right of the text,
 
(this code was written by codejock and it placed in one of the sampels "MultiLanguage Scribble")
 
Example:(Vb6.0)
copy this and add it to one of your modules
 
Const WS_EX_LAYOUTRTL = &H400000
Const WS_EX_NOINHERITLAYOUT = &H100000
Const GWL_EXSTYLE = -20
Const GW_CHILD = 5
Const GW_HWNDNEXT = 2
Private Declare Function InvalidateRect Lib "user32" (ByVal hWnd As Long, lpRect As Long, ByVal bErase As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function GetWindow Lib "user32" (ByVal hWnd As Long, ByVal wCmd As Long) As Long
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function GetParent Lib "user32" (ByVal hWnd As Long) As Long
 
Public Sub UpdateRTLForSingelCtl(hWnd, bRTLLayout As Boolean)
    Dim Old As Long
   
    Old = GetWindowLong(hWnd, GWL_EXSTYLE)
    SetWindowLong hWnd, GWL_EXSTYLE, IIf(bRTLLayout, Old Or WS_EX_LAYOUTRTL, Old And Not WS_EX_LAYOUTRTL)
end sub
 
using the Code:
btn.icon=imag.Icons.GetImage(Id,0)
UpdateRTLForSingelCtl btn.hWnd,True


-------------
yair



Replies:
Posted By: Mika
Date Posted: 08 June 2007 at 9:09am

hi yair,

Thank you for your good advice!
I tried UpdateRTLForSingelCtl procedure but horizontal direction of loded picture was flipped like below screen shot.
And then, I made a flipped picture and tried it again. Picture is ok but some character next to alphabet was moved to opposite direction.

Do you have some idea to avoid this problem?



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net