473,586 Members | 2,620 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with changing backcolor of picturebox

I have a form with some picture boxes as buttons. I'm setting the picture
property to a gif file for "normal", and to a different gif for the
"pressed" state. This works fine. I get into trouble with the fact that the
gif files have a transperent region in the middle (the button icon) that
lets the back color of the picture box show through. This lets me change the
button highlight to any user-specified color when I mouseover the picbox
(which is done very inefficiently I might add, but that's another story).

Everything works, except that I get occasional flicker that shows through
the image as the backcolor is changing. Is there a way to change the picture
box backcolor without any flicker? I've tried setting it to invisible and
then back, played with z-order, LockWindowUpdat e API, etc., all to no avail.
Some type of memory painting/swapping maybe?

Any help is greatly appreciated. Any good advice for an efficient
"mouseover" event for controls would also be greatly appreciated.

Thanks much in advance

Jul 17 '05 #1
1 4745
"Calan" <no**@nospam.co m> wrote in
news:ip******** ******@fe25.use netserver.com:
I have a form with some picture boxes as buttons. I'm setting the
picture property to a gif file for "normal", and to a different gif
for the "pressed" state. This works fine. I get into trouble with the
fact that the gif files have a transperent region in the middle (the
button icon) that lets the back color of the picture box show through.
This lets me change the button highlight to any user-specified color
when I mouseover the picbox (which is done very inefficiently I might
add, but that's another story).

Everything works, except that I get occasional flicker that shows
through the image as the backcolor is changing. Is there a way to
change the picture box backcolor without any flicker? I've tried
setting it to invisible and then back, played with z-order,
LockWindowUpdat e API, etc., all to no avail. Some type of memory
painting/swapping maybe?

Any help is greatly appreciated. Any good advice for an efficient
"mouseover" event for controls would also be greatly appreciated.

Thanks much in advance


have you tried setting the autoredraw setting of the picture box to True?
this will eliminate flicker

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Jul 17 '05 #2

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

Similar topics

0
1564
by: Job Lot | last post by:
I have an Expense Data Entry form which contains a DataGrid showing various expense categories. There are three columns Description, Cash Exp, Credit Exp, where Description column is readonly. Users have to press a checkbox to specify whether they want to use DataGrid to provide break-up or provide total value in textbox. Now when checkbox...
1
4012
by: Rhy Mednick | last post by:
I'm creating a custom control (inherited from UserControl) that is displayed by other controls on the form. I would like for the control to disappear when the user clicks outside my control the same way a menu does. To do this my control needs to get notified when the user tried to click off of it. The Leave and LostFocus events of the...
8
10802
by: Ryan Chavez | last post by:
Hello, I'm working on a project that basically draws lines onto a PictureBox control. Now I'm using a Timer with an interval of 100 to draw the information. Now my code looks something like this: Private Sub Draw() m_pPictBox.Refresh() ' Draw etc... End Sub Private Sub m_pTimer_Tick(ByVal sender As Object, ByVal e As System.EventArgs)...
1
5432
by: Martin Horn | last post by:
Hi all, I'm trying to save a picturebox image to a database. This is part of the code I'm using:- <snip> Private drv As DataRowView Private dr As MainDataSet.OrdersRow If PictureBox.Image IsNot Nothing Then
1
12430
by: Filippo Bettinaglio | last post by:
Hi, I have a PictureBox with the border set to BorderStyle = FixedSingle and it comes up with a nice Black border. How can I change it at runtime? I use VS2005 (net2 framework)
3
2423
by: senfo | last post by:
I developed a Windows control in VS 2005 that inherits from the PictureBox Control that adds the ability to select images in a Windows application. It is, however, experiencing a strange issue that I can't explain. One of the desired affects was to provide the ability to change the background color on images that were selected, as well as...
7
3441
by: MasterMax1313 | last post by:
I'm trying to make a grid of picture box controls, which I do via code. Each of these boxes has a mouseclick, mousedown, mouseup, and mouseenter event. The mouseclick event is simple enough and works fine. However, i use the mousedown, mouseup, and mouseenter events to be able to click and drag to apply the same image across all of the boxes the...
7
2989
by: active | last post by:
In control panel/Display/Appearance/Effects if : 'Use the following method to smooth edges of screen fonts' is checked and ClearType is selected in the combobox (no problem if Standard is selected) I get a crazy font display in parts of my picturebox.
0
1268
by: jhop | last post by:
Hello everyone, I am having a slight problem with a program i am working on for a class, I am using Visual Studio 2005. The program only allows the up arrow key as input. In the code it is set up that one tap of the key will highlight (change the back color) of the next button, and that a double tap of the key will be like a mouse click...
0
7912
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
1
7959
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...
0
8216
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...
0
6614
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...
0
5390
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...
0
3837
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...
1
2345
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
1
1449
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1180
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...

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.