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
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
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
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....
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.
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: - Graphics g = e.Graphics;
-
Bitmap btmap = new Bitmap(labelX1.Size.Width, labelX1.Size.Height);
-
labelX1.DrawToBitmap(btmap, new Rectangle(0, 0, labelX1.Size.Width, labelX1.Size.Height));
-
g.DrawImage(btmap, new Point(5, 5));
-
//g.DrawString("Sample Graphics...", Font, Brush, new PointF(0, 0));
-
//TextRenderer.DrawText(g, "Sample TextRenderer...", Font, new Point(0, 25), Color.Navy);
-
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: - System.Argument Exception: Parameter is not valid.
any ideas?
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.
nope i have tested it on windows 2000 too, it does not change theme :) i run on Win7
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: -
using System;
-
using System.Collections.Generic;
-
using System.ComponentModel;
-
using System.Drawing;
-
using System.Data;
-
using VM = VishalMethods;
-
using System.Text;
-
using System.Windows.Forms;
-
using System.Threading;
-
-
namespace organizer
-
{
-
public partial class task_show : UserControl
-
{
-
#region variables
-
sTask _task;
-
Bitmap b_lbl_time;
-
bool _bitmapavailable = false;
-
#endregion
-
-
#region load
-
private void task_show_Load(object sender, EventArgs e)
-
{
-
RefreshBitmaps();
-
new Thread(new ThreadStart(delegate//you may learn something new here :)
-
{
-
SetTime();
-
})).Start();
-
}
-
#endregion
-
-
#region set values and language
-
private void SetTime()
-
{
-
string hour , minute, second;
-
//hour
-
if (Convert.ToInt32(VM.DateAndTime.Time.To12Hour(_task.DateTime.Hour)[0]) < 10)
-
hour = "0" + VM.DateAndTime.Time.To12Hour(_task.DateTime.Hour)[0];
-
else
-
hour = VM.DateAndTime.Time.To12Hour(_task.DateTime.Hour)[0];
-
//minute
-
if (_task.DateTime.Minute < 10)
-
minute = "0" + _task.DateTime.Minute;
-
else
-
minute = _task.DateTime.Minute.ToString();
-
//second
-
if (_task.DateTime.Second < 10)
-
second = "0" + _task.DateTime.Second;
-
else
-
second = _task.DateTime.Second.ToString();
-
string time = Language.ConvertNumberToSelectedLang(hour) + ":" + Language.ConvertNumberToSelectedLang(minute) + ":" + Language.ConvertNumberToSelectedLang(second) + " " + VM.DateAndTime.Time.To12Hour(_task.DateTime.Hour)[1];
-
-
lbl_time.Text = time;
-
}
-
#endregion
-
-
#region text painting and stuff
-
private void task_show_Paint(object sender, PaintEventArgs e)
-
{
-
if (!_bitmapavailable) { RefreshBitmaps(); }
-
PaintAll();
-
}
-
-
private void PaintAll()
-
{
-
using(Graphics g = back.CreateGraphics())
-
{
-
this.Invoke((MethodInvoker)delegate { g.DrawImage(b_lbl_time, lbl_time.Location); });
-
}
-
}
-
-
private void RefreshBitmaps()
-
{
-
Bitmap btmap = new Bitmap(lbl_time.Size.Width, lbl_time.Size.Height);
-
lbl_time.DrawToBitmap(btmap, new Rectangle(0, 0, lbl_time.Size.Width, lbl_time.Size.Height));
-
b_lbl_time = MakeTransparent(btmap, lbl_time.BackColor);
-
//b_lbl_time.Save(VM.FilesAndFolders.Paths.Desktop + "\\woo.png");
-
-
-
_bitmapavailable = true;
-
}
-
-
private Bitmap MakeTransparent(Bitmap Image, Color Base)
-
{
-
Image.MakeTransparent(Base);
-
return Image;
-
}
-
#endregion
-
}
-
}
-
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?
nothing for transparency?
Hey :) there is a very simple answer for this - set label Enabled field to false. will ignore mouse interactions and button should be available.
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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...
|
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...
|
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,...
|
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...
|
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...
|
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...
|
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....
|
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,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
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...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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,...
| |