Good Afternoon:
I was hoping if someone could share some light on a problem that I'm facing.
When I create a Visual Basic.Net program and I use the XP style for my Window
Forms and buttons; if I add images to my menu buttons they don't show when
the form is created. But, if I don't use the XP style the images show on my
buttons correctly. Can someone please explain to me what the problem is and
how to get around it? Here is how I'm calling my forms:
Public Sub Main()
Dim frmSplash As New fclsSplash
Dim mainForm As New fclsMain
System.Windows.Forms.Application.EnableVisualStyle s()
System.Windows.Forms.Application.Run(frmSplash)
Select Case vfClass.fdisplay
Case 0
System.Windows.Forms.Application.Run(SqlLogin)
Case 1
System.Windows.Forms.Application.Run(mainForm)
End Select
It's my mainForm that holds the menu buttons with the images. Do anyone
know what's going on? Thanks.
--
TC 9 3469 It's my mainForm that holds the menu buttons with the images. Do anyone know what's going on?
Just like the documentation says, when you set the button's FlatStyle
property to System the Image isn't displayed.
Mattias
--
Mattias Sjögren [MVP] mattias @ mvps.org http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
What type of button is a MenuButton?
If it's a toolbar button then you need to add Application.DoEvents after
Application.EnableVisualStyles, or supply a manifest file instead of calling
Application.EnableVisualStyles.
If it's a standard Button, then System Buttons do not show an Image. I
modified the Button class to get around this and you will find the source
for this button on my site. Note that when set to Flatsyle.System the button
still wont show an Image, but Visual Styles will be applied to
Flatstyle.Standard buttons. http://dotnetrix.co.uk/buttons.html
--
Mick Doherty http://dotnetrix.co.uk/nothing.html
"Terrance" <Te******@discussions.microsoft.com> wrote in message
news:79**********************************@microsof t.com... Good Afternoon: I was hoping if someone could share some light on a problem that I'm facing. When I create a Visual Basic.Net program and I use the XP style for my Window Forms and buttons; if I add images to my menu buttons they don't show when the form is created. But, if I don't use the XP style the images show on my buttons correctly. Can someone please explain to me what the problem is and how to get around it? Here is how I'm calling my forms: Public Sub Main()
Dim frmSplash As New fclsSplash Dim mainForm As New fclsMain
System.Windows.Forms.Application.EnableVisualStyle s() System.Windows.Forms.Application.Run(frmSplash)
Select Case vfClass.fdisplay Case 0 System.Windows.Forms.Application.Run(SqlLogin) Case 1 System.Windows.Forms.Application.Run(mainForm) End Select
It's my mainForm that holds the menu buttons with the images. Do anyone know what's going on? Thanks. -- TC
Mick,
I have the same problem in VB.net. I can see the image in the design window
on the toolbar button. But, when I build and run the application the image
doesn't show up. I don't know where the Application.EnableVisualStyles
statement is.
Can you help?
Thanks.
Dave Green dc*****@dcgreen.com
"Mick Doherty" wrote: What type of button is a MenuButton?
If it's a toolbar button then you need to add Application.DoEvents after Application.EnableVisualStyles, or supply a manifest file instead of calling Application.EnableVisualStyles.
If it's a standard Button, then System Buttons do not show an Image. I modified the Button class to get around this and you will find the source for this button on my site. Note that when set to Flatsyle.System the button still wont show an Image, but Visual Styles will be applied to Flatstyle.Standard buttons. http://dotnetrix.co.uk/buttons.html
-- Mick Doherty http://dotnetrix.co.uk/nothing.html
"Terrance" <Te******@discussions.microsoft.com> wrote in message news:79**********************************@microsof t.com... Good Afternoon: I was hoping if someone could share some light on a problem that I'm facing. When I create a Visual Basic.Net program and I use the XP style for my Window Forms and buttons; if I add images to my menu buttons they don't show when the form is created. But, if I don't use the XP style the images show on my buttons correctly. Can someone please explain to me what the problem is and how to get around it? Here is how I'm calling my forms: Public Sub Main()
Dim frmSplash As New fclsSplash Dim mainForm As New fclsMain
System.Windows.Forms.Application.EnableVisualStyle s() System.Windows.Forms.Application.Run(frmSplash)
Select Case vfClass.fdisplay Case 0 System.Windows.Forms.Application.Run(SqlLogin) Case 1 System.Windows.Forms.Application.Run(mainForm) End Select
It's my mainForm that holds the menu buttons with the images. Do anyone know what's going on? Thanks. -- TC
I'm sorry I no longer have the reference to an article on MSDN a few weeks ago that states there is a bug using image buttons in
VS.NET due to the serialization order of code.
The fix, if I remember correctly, was to go into the hidden area of code that the designer serializes and move any code that adjusts
the buttons bounds or location to appear before the image property is set.
The problem with this "quick fix" is that designer changes may revert back to the error-producing code. At this time I don't
believe there is a fix for the latest version of NET. Maybe 2005 will have fixed that issue.
--
Dave Sexton dave@www..jwaonline..com
-----------------------------------------------------------------------
"Dave Green" <Dave Gr***@discussions.microsoft.com> wrote in message news:A6**********************************@microsof t.com... Mick,
I have the same problem in VB.net. I can see the image in the design window on the toolbar button. But, when I build and run the application the image doesn't show up. I don't know where the Application.EnableVisualStyles statement is.
Can you help?
Thanks.
Dave Green dc*****@dcgreen.com
"Mick Doherty" wrote:
What type of button is a MenuButton?
If it's a toolbar button then you need to add Application.DoEvents after Application.EnableVisualStyles, or supply a manifest file instead of calling Application.EnableVisualStyles.
If it's a standard Button, then System Buttons do not show an Image. I modified the Button class to get around this and you will find the source for this button on my site. Note that when set to Flatsyle.System the button still wont show an Image, but Visual Styles will be applied to Flatstyle.Standard buttons. http://dotnetrix.co.uk/buttons.html
-- Mick Doherty http://dotnetrix.co.uk/nothing.html
"Terrance" <Te******@discussions.microsoft.com> wrote in message news:79**********************************@microsof t.com... > Good Afternoon: > I was hoping if someone could share some light on a problem that I'm > facing. > When I create a Visual Basic.Net program and I use the XP style for my > Window > Forms and buttons; if I add images to my menu buttons they don't show when > the form is created. But, if I don't use the XP style the images show on > my > buttons correctly. Can someone please explain to me what the problem is > and > how to get around it? Here is how I'm calling my forms: > Public Sub Main() > > Dim frmSplash As New fclsSplash > Dim mainForm As New fclsMain > > System.Windows.Forms.Application.EnableVisualStyle s() > System.Windows.Forms.Application.Run(frmSplash) > > Select Case vfClass.fdisplay > Case 0 > System.Windows.Forms.Application.Run(SqlLogin) > Case 1 > System.Windows.Forms.Application.Run(mainForm) > End Select > > It's my mainForm that holds the menu buttons with the images. Do anyone > know what's going on? Thanks. > -- > TC
Assuming your startup form is called Form1 add the following code to the
form.
Shared Sub main()
Application.EnableVisualStyles
Application.DoEvents
Application.Run(New Form1)
End Sub
--
Mick Doherty http://dotnetrix.co.uk/nothing.html
"Dave Green" <Dave Gr***@discussions.microsoft.com> wrote in message
news:A6**********************************@microsof t.com... Mick,
I have the same problem in VB.net. I can see the image in the design window on the toolbar button. But, when I build and run the application the image doesn't show up. I don't know where the Application.EnableVisualStyles statement is.
Can you help?
Thanks.
Dave Green dc*****@dcgreen.com
"Mick Doherty" wrote:
What type of button is a MenuButton?
If it's a toolbar button then you need to add Application.DoEvents after Application.EnableVisualStyles, or supply a manifest file instead of calling Application.EnableVisualStyles.
If it's a standard Button, then System Buttons do not show an Image. I modified the Button class to get around this and you will find the source for this button on my site. Note that when set to Flatsyle.System the button still wont show an Image, but Visual Styles will be applied to Flatstyle.Standard buttons. http://dotnetrix.co.uk/buttons.html
-- Mick Doherty http://dotnetrix.co.uk/nothing.html
"Terrance" <Te******@discussions.microsoft.com> wrote in message news:79**********************************@microsof t.com... > Good Afternoon: > I was hoping if someone could share some light on a problem that I'm > facing. > When I create a Visual Basic.Net program and I use the XP style for my > Window > Forms and buttons; if I add images to my menu buttons they don't show > when > the form is created. But, if I don't use the XP style the images show > on > my > buttons correctly. Can someone please explain to me what the problem is > and > how to get around it? Here is how I'm calling my forms: > Public Sub Main() > > Dim frmSplash As New fclsSplash > Dim mainForm As New fclsMain > > System.Windows.Forms.Application.EnableVisualStyle s() > System.Windows.Forms.Application.Run(frmSplash) > > Select Case vfClass.fdisplay > Case 0 > System.Windows.Forms.Application.Run(SqlLogin) > Case 1 > System.Windows.Forms.Application.Run(mainForm) > End Select > > It's my mainForm that holds the menu buttons with the images. Do anyone > know what's going on? Thanks. > -- > TC
Thanks Mick. Unfortunately, this form is not the startup form. I'm not sure
if that is why it doesn't work. Should that make a difference?
Dave
"Mick Doherty" wrote: Assuming your startup form is called Form1 add the following code to the form.
Shared Sub main() Application.EnableVisualStyles Application.DoEvents Application.Run(New Form1) End Sub
-- Mick Doherty http://dotnetrix.co.uk/nothing.html
"Dave Green" <Dave Gr***@discussions.microsoft.com> wrote in message news:A6**********************************@microsof t.com... Mick,
I have the same problem in VB.net. I can see the image in the design window on the toolbar button. But, when I build and run the application the image doesn't show up. I don't know where the Application.EnableVisualStyles statement is.
Can you help?
Thanks.
Dave Green dc*****@dcgreen.com
"Mick Doherty" wrote:
What type of button is a MenuButton?
If it's a toolbar button then you need to add Application.DoEvents after Application.EnableVisualStyles, or supply a manifest file instead of calling Application.EnableVisualStyles.
If it's a standard Button, then System Buttons do not show an Image. I modified the Button class to get around this and you will find the source for this button on my site. Note that when set to Flatsyle.System the button still wont show an Image, but Visual Styles will be applied to Flatstyle.Standard buttons. http://dotnetrix.co.uk/buttons.html
-- Mick Doherty http://dotnetrix.co.uk/nothing.html
"Terrance" <Te******@discussions.microsoft.com> wrote in message news:79**********************************@microsof t.com... > Good Afternoon: > I was hoping if someone could share some light on a problem that I'm > facing. > When I create a Visual Basic.Net program and I use the XP style for my > Window > Forms and buttons; if I add images to my menu buttons they don't show > when > the form is created. But, if I don't use the XP style the images show > on > my > buttons correctly. Can someone please explain to me what the problem is > and > how to get around it? Here is how I'm calling my forms: > Public Sub Main() > > Dim frmSplash As New fclsSplash > Dim mainForm As New fclsMain > > System.Windows.Forms.Application.EnableVisualStyle s() > System.Windows.Forms.Application.Run(frmSplash) > > Select Case vfClass.fdisplay > Case 0 > System.Windows.Forms.Application.Run(SqlLogin) > Case 1 > System.Windows.Forms.Application.Run(mainForm) > End Select > > It's my mainForm that holds the menu buttons with the images. Do anyone > know what's going on? Thanks. > -- > TC
Actually, I'm not entirely sure what the cause of your problem is, I
answered a bit too quickly earlier.
Since you didn't know where EnableVisualStyles was called I should assume
that this is not a WinXP issue.
I've seen several variations of this problem and the most difficult to sort
out, was in an app that started without a GUI, but displayed a dialog box
with a toolbar at specified events. I've never seen this issue on a non
Visual Styles Enabled app, but that does not mean it doesn't happen.
Can you recreate the problem in a small project, or give the steps required
to reproduce it?
--
Mick Doherty http://dotnetrix.co.uk/nothing.html
"dave green" <dave gr***@discussions.microsoft.com> wrote in message
news:88**********************************@microsof t.com... Thanks Mick. Unfortunately, this form is not the startup form. I'm not sure if that is why it doesn't work. Should that make a difference?
Dave
Did you attempt to try the fix I posted previously on this thread?
Locate the designer-serialized code in your code-behind. It will probably be in a #region block named, "Windows Form Designer
generated code".
In the region, find the method named, "InitializeComponent".
In the method there will be a declartion for your control. Find the area of the method that sets the properties on your control
(The appropriate section should be marked with a comment).
Cut and Paste the line of code that sets the image of the button as the last line of the section.
See if that does it.
Like I said, the article states that this is a bug. No sense driving yourself crazy over this if you can identify the problem as a
bug early on.
--
Dave Sexton dave@www..jwaonline..com
-----------------------------------------------------------------------
"Mick Doherty" <EX***********@AND.REMOVE.SQUAREBRACKETS.[mdaudi100#ntlworld.com]> wrote in message
news:eM**************@TK2MSFTNGP09.phx.gbl... Actually, I'm not entirely sure what the cause of your problem is, I answered a bit too quickly earlier. Since you didn't know where EnableVisualStyles was called I should assume that this is not a WinXP issue.
I've seen several variations of this problem and the most difficult to sort out, was in an app that started without a GUI, but displayed a dialog box with a toolbar at specified events. I've never seen this issue on a non Visual Styles Enabled app, but that does not mean it doesn't happen.
Can you recreate the problem in a small project, or give the steps required to reproduce it?
-- Mick Doherty http://dotnetrix.co.uk/nothing.html
"dave green" <dave gr***@discussions.microsoft.com> wrote in message news:88**********************************@microsof t.com... Thanks Mick. Unfortunately, this form is not the startup form. I'm not sure if that is why it doesn't work. Should that make a difference?
Dave
If that is the problem, then the code could be cut from the
InitializeComponent() method and pasted to Sub New() after the
InitializeComponent() call. That way the designer is not going to mess with
it every time you rebuild the project.
--
Mick Doherty http://dotnetrix.co.uk/nothing.html
"Dave" <NO*********@dotcomdatasolutions.com> wrote in message
news:Oq**************@tk2msftngp13.phx.gbl... Did you attempt to try the fix I posted previously on this thread?
Locate the designer-serialized code in your code-behind. It will probably be in a #region block named, "Windows Form Designer generated code".
In the region, find the method named, "InitializeComponent".
In the method there will be a declartion for your control. Find the area of the method that sets the properties on your control (The appropriate section should be marked with a comment).
Cut and Paste the line of code that sets the image of the button as the last line of the section.
See if that does it.
Like I said, the article states that this is a bug. No sense driving yourself crazy over this if you can identify the problem as a bug early on.
-- Dave Sexton dave@www..jwaonline..com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Marek Mänd |
last post by:
Can the
<button><img></button>
mutated via CSS so, that the inner image of <BUTTON>
would entirely visually become the button itsself - I mean without the
outer elements borders and so...
...
|
by: IkBenHet |
last post by:
Hello,
I am creating a toolbar for an richtext editor. I already managed to
make the images act as buttons (hovering,...) But now I want to be able
to keep a button selected (down) when clicking...
|
by: meltedown |
last post by:
Oh ye Gods of Style, I have been having fun making buttons with CSS:
<div class='cssnav2'>
<a href='#'
onClick="document.location.href='/catalog/index.php?brand=94'">
<img...
|
by: martinjeffreys |
last post by:
Anyone know of a good source of additional pictures for buttons in Access?
Ta
Martin
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com)....
|
by: Terrance |
last post by:
Good Afternoon:
I was hoping if someone could share some light on a problem that I'm facing.
When I create a Visual Basic.Net program and I use the XP style for my Window
Forms and buttons; if I...
|
by: dominic.martin |
last post by:
Hi,
I'm no javascript programmer but I found a really good piece of
javascript at http://www.isdntek.com/tagbot/zipzoom.htm that magnifies
areas of an image. It's just what I want but their...
|
by: Phil_Cam |
last post by:
Hello All
On a webpage I have a standard paypal image button for purchases. I am
trying to set it up so that it only shows up or is endabled when text
is entered into a textbox and a button is...
|
by: arupfrancis |
last post by:
Hi,
I am trying to create a colored box using background images. I am able to do it easily using tables but doing it in divs is proving to be an issue. Moreover IE and Mozilla also seems to be...
|
by: Peted |
last post by:
im using radio button array with button appearence.
Im just wondering if there is a easy way programtically to enhance the
button look with such things a gradient color fills and effects and...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |