Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Suite Pro
  New Posts New Posts RSS Feed - change pushButton Icon position
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

change pushButton Icon position

 Post Reply Post Reply
Author
Message
yair-edsoft View Drop Down
Newbie
Newbie
Avatar

Joined: 14 April 2007
Location: Israel
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote yair-edsoft Quote  Post ReplyReply Direct Link To This Post Topic: change pushButton Icon position
    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
Back to Top
Mika View Drop Down
Newbie
Newbie
Avatar

Joined: 18 April 2007
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mika Quote  Post ReplyReply Direct Link To This Post 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?
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.109 seconds.