473,386 Members | 1,764 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

reflect mouse on label to button

first, i don't know what could i possibly write for the "question" field...

i have a button, and i put a label over it, i did that, and transparency and other things are not a problem for me, the problem is, when i take mouse over the label, the button no more has the "effect" which comes when mouse is over it (blue colored in vista/7) so what i wanna do is, somehow make button think the mouse is over it when the mouse is actually over the label (that label is over button), and make it blue..., sorry if you don't get my english :( i don't know how to explain this.
Dec 30 '09
59 8030
ThatThatGuy
449 Expert 256MB
This post is getting way long....

i read your first reply..... i understood what do you want to do.......

Although this is not the right way to do.....

you can call the Focus() method of the button when mouse is over the label the effect comes.....and then... press to lose focus out of it
Jan 6 '10 #51
you dont get it, i got a label over button, i want the button to "glow" like the mouse is over it, while the mouse actually is over label, ur Focus method just gives the focus to button that dosent makes sense. (i tried it too like all the methods in this post, who knows what can work), By the way.. i was seeing your profile your join date is 7th July 2009, thats my birthday woo! :P
Jan 6 '10 #52
so? there's nothing? :(

i used Graphics class, TextRender class and a Label together...



See the difference? WHY is there so much difference? same font, same color, same style....
Jan 9 '10 #53
GaryTexmo
1,501 Expert 1GB
You've got me, it doesn't make sense. But then, I don't know enough about the inner workings of that stuff to tell you anyway. In addition, you're using another graphics package (as mine doesn't have that result).

Let me ask you this. Does it matter if the graphics method looks different than the label method? From what I saw in your app, you're only having one bit of text displayed on the button.. so just use the graphics method to display it.
Jan 9 '10 #54
as u saw in application, that *button* is in the form displaying all the events on that date.. each button will contain time, discription, title and reoccurence of events, only for now i write the "Sample"s.

Anyways i thought of "another" idea that no one suggested me in this whole post... take a screenshot of label using DrawToBitmap and paint the image! howz that?, keeps the quality of text from label too, so i did that and wrote this OnPaint event:
Expand|Select|Wrap|Line Numbers
  1. Graphics g = e.Graphics;
  2. Bitmap btmap = new Bitmap(labelX1.Size.Width, labelX1.Size.Height);
  3. labelX1.DrawToBitmap(btmap, new Rectangle(0, 0, labelX1.Size.Width, labelX1.Size.Height));
  4. g.DrawImage(btmap, new Point(5, 5));
  5. //g.DrawString("Sample Graphics...", Font, Brush, new PointF(0, 0));
  6. //TextRenderer.DrawText(g, "Sample TextRenderer...", Font, new Point(0, 25), Color.Navy);
  7. g.Dispose();
but for some strange reason, it freezes my app (keeps painting again and again and again...forever) and then after 15 seconds gives this Exception:
Expand|Select|Wrap|Line Numbers
  1. System.Argument Exception: Parameter is not valid.
any ideas?
Jan 9 '10 #55
GaryTexmo
1,501 Expert 1GB
What I was saying was, use the graphics to draw all the text. Anything you want on your button, you can draw yourself.

I'll try looking at the bitmap thing later, but I think it's a good idea. So long as you realize that it wont' change with the OS theme, which I dont' think you care about anyway.
Jan 9 '10 #56
nope i have tested it on windows 2000 too, it does not change theme :) i run on Win7
Jan 10 '10 #57
after being stuck on this part for about 2 weeks and support from all of you guys, i m happy to say that i m screwed, no, jokes, anyways i am successful to be able to draw the text correctly, neatly and nicely by drawing a bitmap of the label and make the background of bitmap transparent (a little little problem here), here's the codez:
Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Drawing;
  5. using System.Data;
  6. using VM = VishalMethods;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using System.Threading;
  10.  
  11. namespace organizer
  12. {
  13.     public partial class task_show : UserControl
  14.     {
  15.         #region variables
  16.         sTask _task;
  17.         Bitmap b_lbl_time;
  18.         bool _bitmapavailable = false;
  19.         #endregion
  20.  
  21.         #region load
  22.         private void task_show_Load(object sender, EventArgs e)
  23.         {
  24.             RefreshBitmaps();
  25.             new Thread(new ThreadStart(delegate//you may learn something new here :)
  26.                 {
  27.                     SetTime();
  28.                 })).Start();
  29.         }
  30.         #endregion
  31.  
  32.         #region set values and language
  33.         private void SetTime()
  34.         {
  35.             string hour , minute, second;
  36.             //hour
  37.             if (Convert.ToInt32(VM.DateAndTime.Time.To12Hour(_task.DateTime.Hour)[0]) < 10)
  38.                 hour = "0" + VM.DateAndTime.Time.To12Hour(_task.DateTime.Hour)[0];
  39.             else
  40.                 hour = VM.DateAndTime.Time.To12Hour(_task.DateTime.Hour)[0];
  41.             //minute
  42.             if (_task.DateTime.Minute < 10)
  43.                 minute = "0" + _task.DateTime.Minute;
  44.             else
  45.                 minute = _task.DateTime.Minute.ToString();
  46.             //second
  47.             if (_task.DateTime.Second < 10)
  48.                 second = "0" + _task.DateTime.Second;
  49.             else
  50.                 second = _task.DateTime.Second.ToString();
  51.             string time = Language.ConvertNumberToSelectedLang(hour) + ":" + Language.ConvertNumberToSelectedLang(minute) + ":" + Language.ConvertNumberToSelectedLang(second) + " " + VM.DateAndTime.Time.To12Hour(_task.DateTime.Hour)[1];
  52.  
  53.             lbl_time.Text = time;
  54.         }
  55.         #endregion
  56.  
  57.         #region text painting and stuff
  58.         private void task_show_Paint(object sender, PaintEventArgs e)
  59.         {
  60.             if (!_bitmapavailable) { RefreshBitmaps(); }
  61.             PaintAll();
  62.         }
  63.  
  64.         private void PaintAll()
  65.         {
  66.             using(Graphics g = back.CreateGraphics())
  67.             {
  68.                 this.Invoke((MethodInvoker)delegate { g.DrawImage(b_lbl_time, lbl_time.Location); });
  69.             }            
  70.         }
  71.  
  72.         private void RefreshBitmaps()
  73.         {
  74.             Bitmap btmap = new Bitmap(lbl_time.Size.Width, lbl_time.Size.Height);
  75.             lbl_time.DrawToBitmap(btmap, new Rectangle(0, 0, lbl_time.Size.Width, lbl_time.Size.Height));
  76.             b_lbl_time = MakeTransparent(btmap, lbl_time.BackColor);
  77.             //b_lbl_time.Save(VM.FilesAndFolders.Paths.Desktop + "\\woo.png");
  78.  
  79.  
  80.             _bitmapavailable = true;
  81.         }
  82.  
  83.         private Bitmap MakeTransparent(Bitmap Image, Color Base)
  84.         {
  85.             Image.MakeTransparent(Base);
  86.             return Image;
  87.         }
  88.         #endregion
  89.     }
  90. }
  91.  
see the Control's OnLoad event you may learn something new :) I use those type of Thread starters everywhere, you can just directly write your code in it, instead of calling a method seperatly...

for anyone wondering what is "using VM = VishalMethods;" i made a DLL of my own for use in all my applications, contains methods and structs I normally use and need time to time, from hardware info to Email, Downloads it also has a Sever and Client :)

BACK TO THE TOPIC! maheam

it looks like this when its not mouse over-ed:


and like this when thrs mouse over it:



and yes taking mouse over the text also make it glow, just perfect how i wanted but if you look closely in mouse over image you will see a little "blue" color around text, its not doing the transparency job nice, any ideas?
Jan 12 '10 #58
nothing for transparency?
Jan 14 '10 #59
mikeil
1
Hey :) there is a very simple answer for this - set label Enabled field to false. will ignore mouse interactions and button should be available.
Dec 27 '11 #60

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Raymond H. | last post by:
Hello, 1- How to see, in a Label, the URL of a link that the mouse pass over? (in the WebBrower control in a vb projet). 2- How to create a menu and a submenu via a button Command1? and...
3
by: Steen Gellett | last post by:
Hey...........is it possible to move a picture around the form with the mouse ? I have a form with one picture on it........when I hold down the mouse I would like the picture to follow the...
5
by: John Champaign | last post by:
Hi all, I'm working on an educational applet for a child with special needs. He's got a bit of a trick to make my life more difficult... To interact with the applet he needs to click on...
6
by: Raistlin | last post by:
Hi Guys, Is there an On Mouse Over event that is available in Access (Ver 200 pro)? What I'd like to do is change the text in a Label (say DescrLabel) when the mouse pointer is placed over a...
6
by: jcrouse | last post by:
I have the following mouse events assigned to a label control. Is the a way I can tell which mouse button the users has clicked with? Private Sub lblP1JoyUp_Click(ByVal sender As System.Object,...
3
by: jcrouse | last post by:
I have created a form designer type application (with a lot of you peoples helpJ). It has label controls that are draggable at runtime. The user is also allowed to change some properties such as...
24
by: aam | last post by:
hi, im trying to figure out how i can program the mouse to automatically click on a button of a web page that i'm viewing.i do not have control over the page.i would also like to set up an...
2
by: pigeonrandle | last post by:
Hi, I am trying (with little (no) success) to create a transparent form that can capture mouse events. Put another way, i would like to show the other windows that are behind my form (like setting...
3
by: tigger | last post by:
Hi I have a label called buttonLabel. How do i display the label only when the mouse is over the button? I tried using mouse hover event and use a timer. But the label will disappear after 1 sec....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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,...

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.