Restricted Width for PopupControl Images |
Post Reply |
Author | |
meaningoflights
Groupie Joined: 27 October 2007 Status: Offline Points: 35 |
Post Options
Thanks(0)
Posted: 25 July 2008 at 6:44am |
Hi,
I am using a PopupControl with a 111x101 jpg image in it. 1. How do I set the PopupItems width so all of the image is shown? I cant work out what is preventing it, as per the screenshot: 2. There's another problem noted in the code comments of this repro A RollOver effect appears when set differing values for "Left" and "Right" arguments in the Popup.AddItem method, see pic below, the Right argument takes priority over the Left argument when the mouse is rolled over the 111x101 area: Please help, here is the repro, all you have to do is put a command button and Popupcontrol on a form, make 111x101 image and run this code: Option Explicit Private Declare Function LoadImage Lib "user32" Alias "LoadImageA" (ByVal hInst _ As Long, ByVal lpsz As String, ByVal un1 As Long, ByVal n1 As Long, ByVal n2 _ As Long, ByVal un2 As Long) As Long Private Const IMAGE_BITMAP = &O0 Private Const LR_LOADFROMFILE = 16 Private Const LR_CREATEDIBSECTION = 8192 Private Sub Command_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Call SetPopupTheme(PopupControl) Call PopupControl.Show End Sub Sub SetPopupTheme(ByVal Popup As XtremeSuiteControls.PopupControl) Dim item As PopupControlItem Popup.RemoveAllItems Popup.Icons.RemoveAll On Error Resume Next 'The image doesn't move on mouse over 'Set item = Popup.AddItem(12, 12, 12, 12, "") ' The image moves on mouse over! and the picture is still half its width Set item = Popup.AddItem(12, 12, 123, 113, "") item.TextAlignment = DT_SINGLELINE item.SetIcons LoadBitmap("Blob.jpg"), 0, xtpPopupItemIconNormal Or xtpPopupItemIconSelected Or xtpPopupItemIconPressed Popup.VisualTheme = xtpPopupThemeOffice2007 Popup.SetSize 270, 122 Popup.Animation = 1 Popup.AnimateDelay = 256 Popup.ShowDelay = 2000 Popup.Transparency = 200 Popup.AllowMove = True End Sub Function LoadBitmap(Path As String) As Long LoadBitmap = LoadImage(App.hInstance, App.Path + "\" + Path, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE) End Function Thanks in advance for trying to reproduce and solve this half image issue |
|
Jeremy Thompson (MCSD)
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
item.SetIcons waits that bitmap will have 3 states - normal, hot, presesed.
just use
Popup.Icons.LoadBitmap instead.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
meaningoflights
Groupie Joined: 27 October 2007 Status: Offline Points: 35 |
Post Options
Thanks(0)
|
Great, that pointed me in the right direction and using the sample PopupControlLayer, I found what I was missing:
Popup.Icons.LoadBitmap App.path & "\Blob.jpg", 100, xtpImageNormal item.IconIndex = 100 Instead of : item.SetIcons LoadBitmap("Blob.jpg"), 0, xtpPopupItemIconNormal Or xtpPopupItemIconSelected Or xtpPopupItemIconPressed More info: I've found the order you add items does make a difference. When I loaded a icon, then text then bitmap I saw a weird effect... It was really hard to select icon buttons as the hover area was a quarter of the icons size. Loading Bitmaps, then Icons then text seems to be the best order. |
|
Jeremy Thompson (MCSD)
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |