如何在VB6的运行时绘制我自己的应用程序图标? [英] How to paint my own app icon at runtime in VB6 ?

查看:136
本文介绍了如何在VB6的运行时绘制我自己的应用程序图标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好社区,

我是这个论坛的新人.
我已经在vb6上编程了一段时间了.

我想在运行时绘制表单的图标(该图标显示在任务栏按钮以及表单的标题栏上).
我已经搜索了一段时间,但无法找到解决方案.
据我了解,图标可以包含各种16x16、32x32 ...图片.
如何使用在运行时绘制的图片作为图标?
透明的颜色是什么?

有人知道如何解决我的问题吗?

谢谢1,000,000

Charlie

Hello community,

I''m a newcomer in this forum.
I''ve been programming vb6 for a while now.

I want to draw forms'' icons during runtime (that icon which appears on the taskbar button as well as on the title bar of the form).
I''ve been googling for a while now, but can''t come close to a solution.
As far as I understand an icon can persist of a variety of 16x16, 32x32 ... pictures.
How can I use a picture - drawn in runtime - as my icon?
What would be the color of transparency?

Has anybody a clue how to solve my problem?

Thanx 1,000,000

Charlie

推荐答案

您可以根据需要使用免费软件/共享软件Icon Creator/Editor.但是,使用VC ++(Visual Studio 6.0中附带的)可以执行此操作,因为其中有选项.
you can use freewares/sharewares Icon Creator/Editor for your need. But using VC++(which comes in Visual studio 6.0) you can do this because there is option in that.


谢谢.但这不是我想要的.

我想在运行时绘制图片(取决于程序中的几种状态),并将其用作表单的图标.

我从 http://www.thevbzone.com/modICON.bas [
Thanx thatraja. But that''s not what I wanted.

I want to draw a picture in runtime (depending on several states in the program) and use it as the icon for my form.

I got a possible solution from http://www.thevbzone.com/modICON.bas[^] where an ImageList is used to work around, using the function ListImage.ExtractIcon.
I''m just working on it and will post whether it will do the trick.

Thanks anyway for the quick reply.

Charlie.


作品!

您需要一个带有ImageList名为"temp_IL"的表单对象,然后添加以下代码:

WORKS!

You need a form object with an ImageList called "temp_IL" then add following code:

Function GetIcon _
    (ByVal Pic As StdPicture, _
     ByVal BackColor&, _
     Optional ByVal UseMask As Boolean, _
     Optional ByVal MaskColor&) As StdPicture
  If Pic = 0 Then Exit Function
  On Error GoTo 10
  With temp_IL
    .ListImages.Clear
    .ImageHeight = ScaleX(Pic.Height, vbHimetric, vbPixels)
    .ImageWidth = ScaleY(Pic.Width, vbHimetric, vbPixels)
    .BackColor = BackColor
    .MaskColor = MaskColor
    .UseMaskColor = UseMask
    Set GetIcon = .ListImages.Add(, , Pic).ExtractIcon
''    .ListImages.Clear
  End With
Exit Function
10:
  If Err.Number = 0 Then      '' No Error
    Resume Next
  ElseIf Err.Number = 20 Then '' Resume Without Error
    Err.Clear
    Resume Next
  Else                        '' Other Error
    Err.Clear
  End If
End Function



右伙计们.
干杯,查理



Right lads.
Cheers, Charlie


这篇关于如何在VB6的运行时绘制我自己的应用程序图标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆