3 Replies - 332 Views - Last Post: 30 August 2013 - 05:09 PM Rate Topic: -----

#1 COBOL2VB  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 20-July 13

Form Icon Disappears

Posted 30 August 2013 - 03:23 PM

I have a problem with changing the border style on my VB2010 application.
I have the FormBorderStyle set to Sizable, the MaximizeBox set to False and an icon set to a .ico file. The form icon (upper left of the title bar) displays fine as it does on all my other programs. I have an option to display a picture full screen with no border, using the same form, so I set the FormBorderStyle thusly:
    
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None


Then, when the user presses the Esc key, the picture goes away and the original format is displayed by setting the FormBorderStyle back to Sizeable thusly:
    
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.Sizable


The form comes back with no icon. I donít want to use a second form for the picture and have tried the other options for the FormBorderStyle such as Fixed3D. What can I do to fix this? Thanks.

Is This A Good Question/Topic? 0
  • +

Replies To: Form Icon Disappears

#2 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 2877
  • View blog
  • Posts: 9,547
  • Joined: 12-December 12

Re: Form Icon Disappears

Posted 30 August 2013 - 03:54 PM

This might be a glitch, try:

Me.Icon = Icon.Clone()

or re-assigning the icon.

Other approaches may be to Invalidate the form or Repaint it - I haven't really explored.

This post has been edited by andrewsw: 30 August 2013 - 03:57 PM

Was This Post Helpful? 1
  • +
  • -

#3 COBOL2VB  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 20-July 13

Re: Form Icon Disappears

Posted 30 August 2013 - 04:48 PM

View Postandrewsw, on 30 August 2013 - 03:54 PM, said:

This might be a glitch, try:

Me.Icon = Icon.Clone()

or re-assigning the icon.

Other approaches may be to Invalidate the form or Repaint it - I haven't really explored.



Thanks!!!
Me.Icon = Icon.Clone()

Did the trick. What exactly does that do?
Was This Post Helpful? 0
  • +
  • -

#4 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 2877
  • View blog
  • Posts: 9,547
  • Joined: 12-December 12

Re: Form Icon Disappears

Posted 30 August 2013 - 05:09 PM

You are welcome and, erm, it..

Quote

Clones the Icon, creating a duplicate image.


Icon.Clone :MSDN

But, in cloning the image, it forces it to be be repainted. (Well, it's possibly just reassigning the Icon that forces the repaint.)

This post has been edited by andrewsw: 30 August 2013 - 05:16 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1