Solved

Pictures in Statusbar

Posted on 2000-02-27
10
404 Views
Last Modified: 2010-05-02
I am using the statusbar control that comes with VB.

No matter where I get the picture from to show in one of the panels (be it from a picture loaded from a picturebox or from loaded from a res file) the statusbar messes with the image stretching it and or messing with the colours.

Does any one know a way of consistently being able to load pictures into a statusbar panel without any distortions or loss of colour?

NB the pictures/Icons I am working with are 16x16 as I thought this would be a reasonable/standard size.

(I have heard it rumoured that the API routine LoadImage might provide a solution........and I have got it to provide a handle to the icon in my res file......but where from here. However if your solution is different but works just as well - then heck to the LoadImage function.)

Thanks

hol
0
Comment
Question by:holgrave
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 3

Expert Comment

by:paulstamp
Comment Utility
I dont think the method you use for loading makes any difference.. it is the height of the statusbar. If you have 16x16 pixel icons try setting the toolbar height to 315 twips.

I dont know of any way of getting 16x16 icons in their correct aspect ratio without having the statusbar set to the right height.
0
 
LVL 1

Expert Comment

by:Ask_ED
Comment Utility
Hi,

The vbAccelerator site has a great example using their "no-status bar status bar class" that you can use icons within.

It's a great site to know about in any case (http://vbaccelerator.com).

For the status bar, try:
http://vbaccelerator.com/codelib/comctl/statbar.htm

The third example is the simplest solution, but the others are interesting as well.


Hope this helps
ED
0
 
LVL 3

Expert Comment

by:paulstamp
Comment Utility
Is this really a definitive answer Ask_Ed ?

I would remind you that you shouldnt lock a question unless you are confident that your answer is the definitive one, otherwise some experts will not look at the question and potentially valuable information may be lost.

Answers like yours should only be comments - it is still possible for the questioner to award you the points if your answer fits.
0
 
LVL 1

Author Comment

by:holgrave
Comment Utility
I have tried VbAccelerator's control but it has a number of bugs (more than the Microsoft control) that make it unsuitable.

The main bugs are:

1) The gripper bar allows a resizing rectangle to appear if gripped and dragged - even when the window is Maximized (pooh - this is because the statusbar window is created in usercontrol....even when maximized as far as the statusbar window is concerned in its user control it isn't.....so easily solved....create the window independantly of the user control.......I have done this but this doesn't solve the next problems)

2) When used with several controls ono a form the statusbar has problems repainting itself.

3) If a TabControl is used in the same app. as the statusbar and a windowless control (eg. label) is assigned as a child to the tabcontrol (set parent) at runtime then the statusbar disappears. Can be slightly eased by setting ClipControls = True. But still flickers and is very slow to redraw. LockWindowUpdate is only a partial solution.

Obviously I would still like to do away with the Microsoft statusbar to do away with the need for Commctrl.ocx - but there isn't a robust alternative.

And yes I have tried the CCRP statusbar - but this suffers from exactly the same problems as the VBAccelerator control in respect of 1. and 2. Not surprisingly because it has been created in a very similar manner being breed from the same class.

Thanks for the input though - but I agree with paulstamp - please don't lock a question unless you are positive you have a definitive answer.
There is nothing lost to you by posting it as a comment - but to me it potentially loses alternative answers.

holgrave.
0
 
LVL 4

Accepted Solution

by:
PBuck earned 50 total points
Comment Utility
I have yet to try loading a picture from a .res file, so I am not sure if my suggestion will make a difference.  But I usually use a ImageList and load my various icons, bmps and gifs.  I use "slide show" icons to display a wait cycle within the statusbar and they seem clear and maintain their color.

StatusBar1.Panels(1).Picture = ImageList1.ListImages(iPIC).Picture

The ImageList seems to maintain the image quality when linked to other controls that your using.  It is worth a try if you have not already.
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 1

Author Comment

by:holgrave
Comment Utility
Thanks, I will try it. And let you know.

holgrave

0
 
LVL 1

Expert Comment

by:Ask_ED
Comment Utility
Hi,

Sorry to polute this thread with a side comment, but I can not find where this type of issue should be raised and since the comment was made here ...

As a new user I am very surprised by your comment and paulstamps about my responding to your question as an ANSWER instead of a comment. My attempt to respond to your question is an answer, a valid one that did solve your initial problem of icons in the status bar, but granted may have other issues and side effects that you found undesirable and rejecting the answer is acceptable.

The problem that I see is:

Are we treating comments as answers and answers as the only solution, because the board needs to be redesigned to better suit its purpose?

From an outsiders view:

Comments are: Questions to clarify the situation or suggestions such as PBuck's above.

Answers are: Solutions believed (and hopefully tested) by the expert to resolve the initial problem/question. And as always, there are many ways to complete any task so many different answers can be supplied.

If the board doesn't function properly when Answers are returned, I'd atleast recommend that the Answer option from this page be removed as it severely hinders the user from obtaining the desired feedback.

What are your thoughts and how do we contact the group designing this site to make some design recommendations ?

Sincerely
ED

0
 
LVL 1

Author Comment

by:holgrave
Comment Utility
I was hoping for an answer that explained the use of the LoadImage API function as this is the only thing that appears to work with icons loaded from res files, otherwise the statusbar stretched the image.

holgrave.
0
 
LVL 1

Author Comment

by:holgrave
Comment Utility
Hi Ed,

I agree with you that the system on Experts Exchange isn't perfect.

The Outsiders View you put forward was initially how Experts Exchange envisioned it - however this way is seriously flawed.

Thus users have evolved there own system.

The original way means that I could for example pose a question on Monday at 12:00 - someone could then post an Answer at 1:00. Unless this is a definitive answer this is no use to me and all other experts with possible answers have been locked out. I am bound to reject this answer on the grounds of wanting to open up the question to everyone - whether or not the answer is good or not. I guess I would be holding out for a definitive answer. In my case I would consider a definitive answer to be fully tested code that is know to definately solve the posed question. I would automatically reject an EARLY Answer that didn't have this content. On the other hand if the question had been open for a couple of days  - because by this point I would have expected those that did of have an Answer to the problem to have come forward by then.

I have nothing against you giving Answers - but in this case I think your timing was a little off.
(As a side point if you check the times of the postings you actually answer my question before I posed it - which is a fairly neat trick......may be you should be given some points for just this! - I for one am quite impressed)

So any way to wrap this up:

I believe that the unwritten rules of conduct have evolved.

I believe that an Answer should not be given until at least two days have elapsed.

Answers should be treated as definitive answers.

Comments are a mechanism not only for posting comments - but for proposing answers - especially in the two day amnesty.

NOTE: I CANNOT SPEAK FOR THE EXPERTS -EXCHANGE COMMUNITY - BUT THIS IS HOW I BELIEVE THE RULES ARE INTERPRETED FROM OBSERVING AND PARTICIPATING IN THE COMMUNITY. THESE AT LEAST ARE THE RULES THAT I FOLLOW.

May be a new thread/discussion should be started on Community.

hol.
0
 
LVL 1

Expert Comment

by:Ask_ED
Comment Utility
Hi Hol,

Thanks for the information and your time.

Your interpretation of the unwritten rules seams to be a good one to follow. I'll try to do that.

I do think that only the person asking the question can determine what a "definitive answer" to their question is, as there is always more to the situation than what gets posted as the question.

Bye for Now and
Take care
ED
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now