# Image in Title Bar

**URL:** <https://www.ruby-forum.com/t/image-in-title-bar/166441>\
**Category:** wxRuby\
**Created:** [April 25, 2009, 9:33am UTC](https://www.ruby-forum.com/t/image-in-title-bar/166441 "2009-04-25T09:33:34Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![sweatje](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ad7895/32.png) [@sweatje](https://www.ruby-forum.com/u/sweatje)\
**Post date:** [April 25, 2009, 9:33am UTC](https://www.ruby-forum.com/t/image-in-title-bar/166441/1 "2009-04-25T09:33:34Z")

</div>

All,

How do you display an image/icon in the title bar of a window? Thanks  
in advance.

- Shelton

---

<div class="post-metadata">

**Author:** ![sweatje](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ad7895/32.png) [@sweatje](https://www.ruby-forum.com/u/sweatje)\
**Post date:** [April 25, 2009, 7:34pm UTC](https://www.ruby-forum.com/t/image-in-title-bar/166441/2 "2009-04-25T19:34:05Z")

</div>

Hi,

x \< Wx::Frame  
def initialize()  
super  
icon\_file = File.join(, “help.ico”)  
icon = Wx::Icon.new(icon\_file, Wx::BITMAP\_TYPE\_ICO)  
set\_icon(icon)

On Fri, Apr 24, 2009 at 7:04 PM, Jason S.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)wrote:

> * * *
> 
> wxruby-users mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [http://rubyforge.org/mailman/listinfo/wxruby-users](http://rubyforge.org/mailman/listinfo/wxruby-users)

–

> **[Dix's Blog](http://dix-dix.blogspot.com/)**
>
> Photos, Citations, Humour, Coup de gueule, Sortie, Evenement

101010 base 2 = 42 🙂  
Dix ~=o)p

> **[R'QUID](http://rquid.blogspot.com/)**
>
> Ruby pour
> QUALITÉ ET URBANISATION DE L'INFORMATION DÉCISIONNELLE
> R'QUID permet un gain de temps appréciable en créant des outils intelligent au profit du pilotage et la performance du besoin client - domaine de la BI (Business Intelligence) \[Ruby...

If you have some of time…Learn Ruby!

---

<div class="post-metadata">

**Author:** ![sweatje](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ad7895/32.png) [@sweatje](https://www.ruby-forum.com/u/sweatje)\
**Post date:** [April 29, 2009, 7:12pm UTC](https://www.ruby-forum.com/t/image-in-title-bar/166441/3 "2009-04-29T19:12:10Z")

</div>

Hi,

Follow the documentation  
[http://wxruby.rubyforge.org/doc/image.html](http://wxruby.rubyforge.org/doc/image.html)  
[http://wxruby.rubyforge.org/wxrubydoc.html](http://wxruby.rubyforge.org/wxrubydoc.html)

Image#replace [http://wxruby.rubyforge.org/doc/image.html#Image\_replace](http://wxruby.rubyforge.org/doc/image.html#Image_replace)  
Image#resize [http://wxruby.rubyforge.org/doc/image.html#Image\_resize](http://wxruby.rubyforge.org/doc/image.html#Image_resize)  
Image#size [http://wxruby.rubyforge.org/doc/image.html#Image\_size](http://wxruby.rubyforge.org/doc/image.html#Image_size)  
etc.

If I have an advice for you is to design your needed with WxFormBuilder.  
That’s create for you an XRC.  
Install gem wx\_sugar  
and create your based class etc.

you will win a lot of time, and it will be easiest because all your  
designed  
objects are created and you have just to change event & properties

All it explain in wiki  
[http://wxruby.rubyforge.org/wiki/wiki.pl?Using\_GUI\_Designers](http://wxruby.rubyforge.org/wiki/wiki.pl?Using_GUI_Designers)  
[http://wxruby.rubyforge.org/wiki/wiki.pl?WxSugar](http://wxruby.rubyforge.org/wiki/wiki.pl?WxSugar)

Dix

---

<div class="post-metadata">

**Author:** ![sweatje](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ad7895/32.png) [@sweatje](https://www.ruby-forum.com/u/sweatje)\
**Post date:** [April 29, 2009, 6:21pm UTC](https://www.ruby-forum.com/t/image-in-title-bar/166441/4 "2009-04-29T18:21:44Z")

</div>

Thanks for the response. Can you now tell me how to display an image on  
a frame and/or window, and set the size and position of the image?  
Thanks in advance for all assistance.

- Shelton

Date: Sat, 25 Apr 2009 19:09:53 +0200  
From: removed\_email\_address@domain.invalid  
To: removed\_email\_address@domain.invalid  
Subject: Re: [wxruby-users] Image in Title Bar

Hi,

x \< Wx::Frame  
def initialize()  
super  
icon\_file = File.join(, “help.ico”)  
icon = Wx::Icon.new(icon\_file, Wx::BITMAP\_TYPE\_ICO)  
set\_icon(icon)

On Fri, Apr 24, 2009 at 7:04 PM, Jason S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

All,

How do you display an image/icon in the title bar of a window? Thanks  
in advance.

- Shelton

Windows Liveâ„¢ SkyDriveâ„¢: Get 25 GB of free online storage. Check it out.

* * *

wxruby-users mailing list  
removed\_email\_address@domain.invalid  
[http://rubyforge.org/mailman/listinfo/wxruby-users](http://rubyforge.org/mailman/listinfo/wxruby-users)

–

> **[Dix's Blog](http://dix-dix.blogspot.com/)**
>
> Photos, Citations, Humour, Coup de gueule, Sortie, Evenement

101010 base 2 = 42 🙂  
Dix ~=o)p

> **[R'QUID](http://rquid.blogspot.com/)**
>
> Ruby pour
> QUALITÉ ET URBANISATION DE L'INFORMATION DÉCISIONNELLE
> R'QUID permet un gain de temps appréciable en créant des outils intelligent au profit du pilotage et la performance du besoin client - domaine de la BI (Business Intelligence) \[Ruby...

If you have some of time…Learn Ruby!

---

<div class="post-metadata">

**Author:** ![sweatje](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ad7895/32.png) [@sweatje](https://www.ruby-forum.com/u/sweatje)\
**Post date:** [April 29, 2009, 7:15pm UTC](https://www.ruby-forum.com/t/image-in-title-bar/166441/5 "2009-04-29T19:15:42Z")

</div>

Jason S. wrote:

> Thanks for the response. Can you now tell me how to display an image  
> on a frame and/or window, and set the size and position of the image?  
> Thanks in advance for all assistance.

As well as Dix’s advice about using Wx::Image to size images, see also  
the documentation for DC (Device Context, which handles all drawing on  
screen), and Bitmap. There’s a number of relevant samples in  
samples/drawing which show how to display an image on a Window.

a

---

<div class="post-metadata">

**Author:** ![sweatje](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ad7895/32.png) [@sweatje](https://www.ruby-forum.com/u/sweatje)\
**Post date:** [April 29, 2009, 11:31pm UTC](https://www.ruby-forum.com/t/image-in-title-bar/166441/6 "2009-04-29T23:31:07Z")

</div>

Jason S. wrote:

> I can get the image on the window, but I cannot get it to show on a  
> panel. Is this possible? If so, how? Thanks again.

Yes it is possible, the method is the same. What have you tried?

alex

---

<div class="post-metadata">

**Author:** ![sweatje](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ad7895/32.png) [@sweatje](https://www.ruby-forum.com/u/sweatje)\
**Post date:** [April 29, 2009, 10:14pm UTC](https://www.ruby-forum.com/t/image-in-title-bar/166441/7 "2009-04-29T22:14:17Z")

</div>

I can get the image on the window, but I cannot get it to show on a  
panel. Is this possible? If so, how? Thanks again.

- Shelton
