hi guys! is there any better way to make my "dialog box" move with out making the controls in that "dialog box", like Textbox, label, etc..appears as black while the "dialog box" is moving like the screenshot below. Thanks in advance!!
What i want to achieve is to make the texts on that "dialog box" appear instead of the black boxes while moving. Because as you can notice the texts on my "dialog box" is not display until the "dialog box" stops.
My code for showing my "dialog Box"
Code:
public struct Alarm_data
{
public string EvntTitle;
public string EvntDate;
public string EvntLocation;
}
public void show_Alarm_notification(string ArgEvntTitle, string ArgEvntDate, string ArgEvntLocation)
{
try
{
int notification_y_coor;
Rectangle workingArea = Screen.PrimaryScreen.WorkingArea;
Alarm_data EvntData = new Alarm_data();
EvntData.EvntTitle = ArgEvntTitle;
EvntData.EvntDate = ArgEvntDate;
EvntData.EvntLocation = ArgEvntLocation;
SoundPlayer sndAlarm = new SoundPlayer();
Notification Notification_frm = new Notification();
Notification_frm.ParentData = EvntData;
Notification_frm.TopMost = true;
Notification_frm.StartPosition = FormStartPosition.Manual;
notification_y_coor = workingArea.Height;
//workingArea.Height - Notification_frm.Height;
//MessageBox.Show("TITLE: " + EvntTitle + " Date: " + EvntDate + " Location: " + EvntLocation);
Notification_frm.Show();
for (int x = 0; x <= Notification_frm.Height; x++)
{
Notification_frm.Location = new Point(workingArea.Width - Notification_frm.Width, workingArea.Height - x);
}
if (File.Exists(txtSettingSoundFile.Text))
{
sndAlarm.SoundLocation = txtSettingSoundFile.Text;
}
else
{
sndAlarm.Stream = Properties.Resources.WARNING;
}
sndAlarm.Play();
}
catch (Exception ex)
{
show_error_message("show_Alarm_notification", ex.Message);
}
}
I know that you want the controls to display. You already said that. I meant what type of effect are you trying to accomplish by moving the form? Is this supposed to be a notification window that sildes up from the system tray area, i.e. a so-called "toast" window? Is it supposed to be something else? Is this effect only to be seen when the form is first displayed or the whole time the form is visible? As I said, what effect are you trying to achieve?
Then you should use the AnimateWindow API. I have posted code in the VB.NET CodeBank that uses it to create a toast form. If you need help with transalation post back.