473,782 Members | 2,437 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

(More info) EnableVisualSty les breaks my program!

Further to previous post...

I have a big, complex program which works fine as long as I don't call
EnableVisualSty les.

If I do this:

Application.Ena bleVisualStyles ();
Application.DoE vents();
Application.Run (new FormOpeningMenu ());

then in one of my subordinate forms, which consits of buttons on other
things on a tab control, the non-focused buttons cease to work. Only the
focused on will actually call its OnClick procedure, although all of them
look, visually, as if they are being pressed.

My other forms are unafflicted.

On the afflicted form, the focus is being set programmaticall y by things
like button1.Select( ) or button1.Focus() (it doesn't matter which I use).

Does this ring any bells for anyone?

Many thanks!
Jun 22 '06 #1
3 1439
See bottom...
I have a big, complex program which works fine as long as I don't call
EnableVisualSty les.

If I do this:

Application.Ena bleVisualStyles ();
Application.DoE vents();
Application.Run (new FormOpeningMenu ());

then in one of my subordinate forms, which consits of buttons on other
things on a tab control, the non-focused buttons cease to work. Only the
focused on will actually call its OnClick procedure, although all of them
look, visually, as if they are being pressed.
Also, you cannot change the focus by hitting Tab.
My other forms are unafflicted.

On the afflicted form, the focus is being set programmaticall y by things
like button1.Select( ) or button1.Focus() (it doesn't matter which I use).


In fact, if I do not set focus programmaticall y (with the Select() or
Focus() method) the problem goes away.

Yet I cannot reproduce the problem in a separate, simpler program. That
makes me wonder if there is something pathological about the form on which
it is happening.

Any ideas?
Jun 22 '06 #2
Many people had problems with EnableVisualSty les()

I know of two solutions - one is to enable visual styles by using manifest
file - see http://weblogs.asp.net/grobinson/arc...25/436464.aspx
another is to enable visual styles "in a custom manner" but I can't find it
now..

Let us know if the solution described in the blog post works for you.

"Michael A. Covington" <lo**@www.covin gtoninnovations .com.for.addres s> wrote
in message news:Or******** ******@TK2MSFTN GP02.phx.gbl...
See bottom...
I have a big, complex program which works fine as long as I don't call
EnableVisualSty les.

If I do this:

Application.Ena bleVisualStyles ();
Application.DoE vents();
Application.Run (new FormOpeningMenu ());

then in one of my subordinate forms, which consits of buttons on other
things on a tab control, the non-focused buttons cease to work. Only the
focused on will actually call its OnClick procedure, although all of them
look, visually, as if they are being pressed.


Also, you cannot change the focus by hitting Tab.
My other forms are unafflicted.

On the afflicted form, the focus is being set programmaticall y by things
like button1.Select( ) or button1.Focus() (it doesn't matter which I use).


In fact, if I do not set focus programmaticall y (with the Select() or
Focus() method) the problem goes away.

Yet I cannot reproduce the problem in a separate, simpler program. That
makes me wonder if there is something pathological about the form on which
it is happening.

Any ideas?

Jun 22 '06 #3
Solved!

I was handling the Paint event of a form and setting focus to certain
buttons when it was painted.

With visual styles turned on, the Paint event arises a lot more often, and
in particular, it arises when the user is starting to press a button. (The
button border changes color.)

So I was stealing the focus away from the button that the user was pressing.

No longer doing that... and it works fine.
Jun 23 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3757
by: Tom Petersen | last post by:
I am using a response.write to test the formatting of the output. I am supposed to get this: BEGIN:VCALENDAR VERSION:1.0 BEGIN:VEVENT DTSTART:20051022T090000Z DTEND:20051022T090000Z LOCATION;ENCODING=QUOTED-PRINTABLE:Library UID:20051022T090000ZI-request DESCRIPTION;ENCODING=QUOTED-PRINTABLE:test
9
3975
by: Guy | last post by:
I have extended the datetimepicker control to incorporate a ReadOnly property. I have used the new keyword to implement my own version of the value property, so that if readonly == true then it will not set the value of the control and will leave the checked status of the checkbox to false when a user selects a new date. this works fine when using the control on a win2k machine but if we use it on a win XP box and call
17
2400
by: Lance | last post by:
I've noticed that calling DoEvents is much slower in an application that has called Application.EnableVisualStyles in Sub Main. Furthermore, the performance seems to worsen each time that DoEvents is called. To demonstrate what I'm experiencing, create an app with a Sub Main, a Main Form, and a Button (called Button1). Include the following code in Sub Main: Application.EnableVisualStyles Application.DoEvents Application.Run(New...
3
2332
by: Michael A. Covington | last post by:
I added Application.EnableVisualStyles() as the first statement in Main() of my program, and didn't notice much change in visual appearance, but what I *did* notice is that some of my buttons stopped working! They were enabled but no longer called their OnClick methods. I tried adding Application.DoEvents() right after EnableVisualStyles and that didn't help. What gives? In VS 2005/.NET 2.0, is EnableVisualStyles broken? This is...
0
10311
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10146
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10080
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9942
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7492
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6733
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5378
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4043
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3639
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.