Restricted Width for PopupControl Images
Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Controls
Forum Description: Topics Related to Codejock Controls
URL: http://forum.codejock.com/forum_posts.asp?TID=11580
Printed Date: 18 May 2024 at 5:34am Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com
Topic: Restricted Width for PopupControl Images
Posted By: meaningoflights
Subject: Restricted Width for PopupControl Images
Date 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)
|
Replies:
Posted By: Oleg
Date Posted: 28 July 2008 at 2:57am
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
|
Posted By: meaningoflights
Date Posted: 28 July 2008 at 10:27pm
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)
|
|