473,763 Members | 10,253 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Visual Styles and Button Images

Hey,
I have come into a bit of a problem.
When Flatsyle is on system it will not show my images that i have set
in image list or just in image.
Also somethings i have found online do not work because i coded it to
change the flatstyles(if needed) to whatever theme the user is using.
This is the code that effects it:

private void RecursivelyForm atForWinXP(Cont rol control)
{
for(int x = 0; x < control.Control s.Count; x++)
{
// If the control derives from ButtonBase,
// set its FlatStyle property to FlatStyle.Syste m.
if(control.Cont rols[x].GetType().Base Type == typeof(ButtonBa se))
{
((ButtonBase)co ntrol.Controls[x]).FlatStyle = FlatStyle.Syste m;
}

// If the control holds other controls, iterate through them also.
if(control.Cont rols.Count > 0)
{
RecursivelyForm atForWinXP(cont rol.Controls[x]);
}
}
}

and...

private void frmNonPOReceipt sEntry_Load(obj ect sender,
System.EventArg s e)
{
// Makes sure Windows XP is running and
// a .manifest file exists for the EXE.
if(Environment. OSVersion.Versi on.Major > 4
& Environment.OSV ersion.Version. Minor > 0
& System.IO.File. Exists(Applicat ion.ExecutableP ath + ".manifest" ))
{
// Iterate through the controls.
for(int x = 0; x < this.Controls.C ount; x++)
{
// If the control derives from ButtonBase,
// set its FlatStyle property to FlatStyle.Syste m.
if(this.Control s[x].GetType().Base Type == typeof(ButtonBa se))
{
((ButtonBase)th is.Controls[x]).FlatStyle = FlatStyle.Syste m;
}
RecursivelyForm atForWinXP(this .Controls[x]);
}
}
}

So my question is how do i get my own images to show up on the
buttons?(if possible by using my image list)

Thank you to whoever can help.
Nov 16 '05 #1
2 5028
Hi,

I had a similar problem with tool tip buttons and a treeview that were loosing their images when using FlatStyle.Syste m. I've solved my problem by calling Application.DoE vents() after calling Application.Ena bleVisualStyles () eg.

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

I cant remember which post I got this from but its out there somewhere.

Hope this helps

Scott
"Curtis Wellborn" wrote:
Hey,
I have come into a bit of a problem.
When Flatsyle is on system it will not show my images that i have set
in image list or just in image.
Also somethings i have found online do not work because i coded it to
change the flatstyles(if needed) to whatever theme the user is using.
This is the code that effects it:

private void RecursivelyForm atForWinXP(Cont rol control)
{
for(int x = 0; x < control.Control s.Count; x++)
{
// If the control derives from ButtonBase,
// set its FlatStyle property to FlatStyle.Syste m.
if(control.Cont rols[x].GetType().Base Type == typeof(ButtonBa se))
{
((ButtonBase)co ntrol.Controls[x]).FlatStyle = FlatStyle.Syste m;
}

// If the control holds other controls, iterate through them also.
if(control.Cont rols.Count > 0)
{
RecursivelyForm atForWinXP(cont rol.Controls[x]);
}
}
}

and...

private void frmNonPOReceipt sEntry_Load(obj ect sender,
System.EventArg s e)
{
// Makes sure Windows XP is running and
// a .manifest file exists for the EXE.
if(Environment. OSVersion.Versi on.Major > 4
& Environment.OSV ersion.Version. Minor > 0
& System.IO.File. Exists(Applicat ion.ExecutableP ath + ".manifest" ))
{
// Iterate through the controls.
for(int x = 0; x < this.Controls.C ount; x++)
{
// If the control derives from ButtonBase,
// set its FlatStyle property to FlatStyle.Syste m.
if(this.Control s[x].GetType().Base Type == typeof(ButtonBa se))
{
((ButtonBase)th is.Controls[x]).FlatStyle = FlatStyle.Syste m;
}
RecursivelyForm atForWinXP(this .Controls[x]);
}
}
}

So my question is how do i get my own images to show up on the
buttons?(if possible by using my image list)

Thank you to whoever can help.

Nov 16 '05 #2
Yea see i have thought of that before but there is one problem. I call
my flatstyles in the form load because Im not always going to have it on
XP style. I have it finding what theme they use and having that play a
part. So my code on when to change my flatstyle and what to change it to
is in form load. So in form load once it finds the style then my immages
are taken away. If you knwo anything else or anyone who can help let me
know.

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #3

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

Similar topics

7
5861
by: Greg Raven | last post by:
I styled my links just the way I want them using CSS, but now my linked images have picked up these same styles. I've tried turning the styles off for the images with: a img { text-decoration: none; outline: none; margin: 0px; padding: 0px;
7
6844
by: codeslayer | last post by:
Greetings to everyone in ‘forum-land': I have a problem that has plaguing me to no end. It is a CSS-related question, and I have not seen this question posted anywhere in forums or through Google search. So here is my problem: I want to use CSS to apply images as bullet styles. However, I want to be able to apply VARIOUS, MULTIPLE styles in the same document. For example, let's assume I have a set of categorized hyperlinks on a...
9
1146
by: Curtis Wellborn | last post by:
Hey, I have come into a bit of a problem. When Flatsyle is on system it will not show my images that i have set in image list or just in image. Also somethings i have found online does not work because i coded the application to change the flatstyles(if needed) to whatever theme the user is using. I call this at FORM_LOAD. This is the code that effects it: private void RecursivelyFormatForWinXP(Control control)
1
1382
by: Glen | last post by:
Hey there, I've seen in several instances where certain (non-standard) visual styles on WinXP can cause the text on .Net form button controls to display incorrectly. Usually, the last letter of the button text will be cut off regardless of how large the button is drawn, so the 'OK' button becomes the 'O' button. My guess would be that these themes are using non-standard fonts for controls and the standard draw methods of the button...
10
14373
by: Robert Jacobson | last post by:
Hi, I'm develing a COM add-in for Microsoft Word XP that displays a form. I'd like to have the form display using the Windows XP theme. However, neither using a manifest nor calling Application.EnableVisualStyles does the trick. (EnableVisualStyles works but massive instability, probably because the system is trying to theme the Word application itself.) I'm now trying to selectively enable the themes for just my form, or just...
3
1782
by: Brian Henry | last post by:
here's something odd, maybe someone can explain it, when i turn on application.enablevisualstyles at application start before i do my application.run(context) command in the sub main, when the app context runs and I get my main form, the toolbar is now missing all its icons (24x24) the buttons are there just the icons are gone, also pretty much all image list icons are not displaying. as soon as i turn the enable visual styles off, they...
1
1975
by: =?Utf-8?B?UmljaA==?= | last post by:
On my old workstation (development workstation) if I set Application/Enable XP visual styles - I was able to get/see the visual styles - like button borders highlighting when you run the mouse over them. But on my new workstation (development workstation) I can't get the visual styles to work. Matter of fact, the button controls appear raised (like in old VB6). I downloaded/Installed a bunch of updates for VS2005 after I got the new...
0
7334
jwwicks
by: jwwicks | last post by:
Introduction This tutorial describes how to use Visual Studio to create a new C++ program, compile/run a program, resume work on an existing program and debug a program. It is aimed at the beginning CIS student who is struggling to get their programs working. I work in the computer lab at the college I'm attending and I see many students who don't know how to use the IDE for best results. Visual Studio automatically creates a number of...
0
9383
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9989
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...
0
8819
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7364
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
6642
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
5268
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...
0
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3515
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2790
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.