ImageManager.Icons.AddIcon don't work correctly |
Post Reply |
Author | |
dimdar
Groupie Joined: 11 July 2007 Status: Offline Points: 34 |
Post Options
Thanks(0)
Posted: 11 July 2007 at 12:38pm |
Hi, I'd like create an ImageManager collection with defferent icon state so i have writed this code With ImageManager1.Icons the problem is that the image for xtpImageNormal is empty, the other work fine. The problem was only with .AddIcon, if I use .LoadIcon all work file ex: With ImageManager1.Icons Thank's
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hello,
May be PicNormal contains bitmaps - not icons ?
I recommend add all icons of ImageManager in design time - in properties of imagemanager.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
dimdar
Groupie Joined: 11 July 2007 Status: Offline Points: 34 |
Post Options
Thanks(0)
|
Hi,
Sorry but I don't understand. I don’t want load icon at design-time but at run-time .
PicNormal contain an icon because if I write:
With ImageManager1.Icons End With Otherwise: With ImageManager1.Icons End With The xtpImageNormal is always empty but the xtpImageHot is displayed correctly when I move mouse on it. I thing this is a bug . |
|
dimdar
Groupie Joined: 11 July 2007 Status: Offline Points: 34 |
Post Options
Thanks(0)
|
Hi, While waiting for correction bug I have found a work around: I draw my icon on ImageManagerIcon Handle (ImageManager1.Icons.GetImage(ID_FILE_NEW, 32).Handle). But now I have a question: If I would like draw on xtpImageHot handle? I think that Handle property need a state arguments for retrieve image handle for each state, someone have a workaround for it? Thanks’ |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hello,
Please attach form with PicNormal and PicHot. Need to test it.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
dimdar
Groupie Joined: 11 July 2007 Status: Offline Points: 34 |
Post Options
Thanks(0)
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
Add CommandBars.Options.UseFadedIcons = False
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
dimdar
Groupie Joined: 11 July 2007 Status: Offline Points: 34 |
Post Options
Thanks(0)
|
Hi, Many thanks’ for you patient, it works correctly now. I have just I suggest to you : how you could know I can load icon with alpha support on .res directly but I can load it how custom resource. This sub loads a custom resource and returns a byte array. Public Function LoadDllData(ByVal Index As Long, Optional ByVal ResFormat As String = "CUSTOM") As Byte() '************************************************************************* '* Loads raw data from a dll '* Parameter: '* Index (required) : Integer specifying the Identifier (Id) of '* the data in the resource file. '* resformat (optional): Constant that specifies the type of '* the data: '* AVI, WAVE, RTF ,RCDATA ...... '* default value: CUSTOM '* Return value : Byte-Array '************************************************************************* Dim hResInfo As Long Dim hResData As Long Dim pBuffer As Long Dim nCount As Long Dim bBuffer() As Byte On Error Resume Next Debug.Assert (m_hInstance <> 0) ' If you get this debug assertion, you forgot to load a dll ' Set the DllName property to a valId file before calling ' this method hResInfo = FindResource(m_hInstance, Index, ResFormat) ' If you get this debug assertion, the resource you ' specified, was not found in the resource dll you are using ' Check the Id and the resource type Debug.Assert (hResInfo <> 0) If hResInfo > 0 Then nCount = SizeofResource(m_hInstance, hResInfo) ' We do not want to load empty data If nCount = 0 Then Exit Function End If ' Load the resource into memory hResData = LoadResource(m_hInstance, hResInfo) If hResData > 0 Then ' and lock it pBuffer = LockResource(hResData) ' Fill byte array with memory block ReDim bBuffer(nCount - 1) CopyMemory bBuffer(0), ByVal pBuffer, nCount Else Err.Raise 31037, , "Error loading from file" Exit Function End If Else Err.Raise 326, , "Custom resource with Identifier " & Format$(Index) & " not found." End If LoadDllData = bBuffer End Function Public Property Let DllName(ByVal vData As String) '************************************************************************* '* Setting this property loads the specified dll. A previous loaded dll '* will be unloaded. '************************************************************************* On Error Resume Next If m_hInstance <> 0 Then FreeLibrary (m_hInstance) m_hInstance = LoadLibrary(vData) ' If you get this debug assertion, your program cannot load ' the dll. Check the Path and the filename. The dll itself ' may be corrupt. Debug.Assert (m_hInstance <> 0) ' Generate an runtime-error Identical to VB LoadResString If m_hInstance = 0 Then Err.Raise 48, , "Error in loading DLL: " & vData m_sDllName = vbNullString Else m_sDllName = vData End If End Property I think may be a good improvement create a new function like this: ImageManager.Icons.LoadIconData(IconData() As Byte, Command as Long, imageState as XTPImageState) Or load a custom resource directly from a module like the function ImageManager.Icons.LoadBitmapFromResource, so every user can import alpha icons in a resource file as custom resources and use them. Best regards, |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Thanks for suggestion.
Actually if you are going use Alpha icons, I suggest you create alpha bitmaps instead - We support drawing alpha bitmaps for all OS.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
dimdar
Groupie Joined: 11 July 2007 Status: Offline Points: 34 |
Post Options
Thanks(0)
|
Sorry, but alpha bitmaps are .png files?
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
bmp files also can have alpha layer. Photoshop 8/9/10 supports it.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
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 |