Introduction
- Drop Shadow Supported (İf your show shadow properties is enabled on your System, it will be shown.)
- Safe password input screen (below...)
Lock button for Popup UserControl...
This is our Popup UserControl
property. It supports a few special features. In this screen:
Background
This application is written in C# 2005. We use this project in our safe password/key attempt application. I thought of this project for Keylogger
application. Perhaps this project can be useful to us for keylogger.
We can exchange button style in this popup control because it is KarubButton
. Also, we can change our border color at this user control.
Screenshot
Default popup UserControl
picture:
and now, the support of system shadow:
Using the Code
For example, some sample code in this project...
private void Showing(object sender, EventArgs e)
{
mProgress = ((TimeSpan)
(DateTime.Now.Subtract(mTimerStarted))).TotalMilliseconds / mPopup.mAnimationSpeed;
if (mProgress >= 1)
{
mTimer.Stop();
mTimer.Tick -= new EventHandler(Showing);
AnimateForm(1);
}
else
AnimateForm(mProgress);
}
private void AnimateForm(double progress)
{
double[] dizi ={ 0, 0, 0, 0 };
if (progress <= 0.1) progress = 0.1;
if (animasyon_Tip == AnimationType.PopupMenu)
{
switch (mPlacement)
{
case ePlacement.Top:
dizi[1] = 1 - progress;
dizi[3] = progress;
break;
case ePlacement.TopLeft:
dizi[1] = 1 - progress;
dizi[3] = progress;
break;
case ePlacement.TopRight:
dizi[1] = 1 - progress;
dizi[3] = progress;
break;
case ePlacement.Bottom:
dizi[1] = 0;
dizi[3] = progress;
break;
case ePlacement.BottomLeft:
dizi[1] = 0;
dizi[3] = progress;
break;
case ePlacement.BottomRight:
dizi[1] = 0;
dizi[3] = progress;
break;
case ePlacement.Left:
dizi[1] = 0;
dizi[3] = 1;
break;
case ePlacement.Right:
dizi[1] = 0;
dizi[3] = 1;
break;
}
switch (mPlacement)
{
case ePlacement.TopLeft:
dizi[0] = 1 - progress;
dizi[2] = progress;
break;
case ePlacement.BottomLeft:
dizi[0] = 1 - progress;
dizi[2] = progress;
break;
case ePlacement.Left:
dizi[0] = 1 - progress;
dizi[2] = progress;
break;
case ePlacement.TopRight:
dizi[0] = 0;
dizi[2] = progress;
break;
case ePlacement.BottomRight:
dizi[0] = 0;
dizi[2] = progress;
break;
case ePlacement.Right:
dizi[0] = 0;
dizi[2] = progress;
break;
case ePlacement.Top:
dizi[0] = 0;
dizi[2] = 1;
break;
case ePlacement.Bottom:
dizi[0] = 0;
dizi[2] = 1;
break;
}
mCurrentBounds.X = mNormalPos.X + (int)(dizi[0] * mControlSize.Width);
mCurrentBounds.Y = mNormalPos.Y + (int)(dizi[1] * mControlSize.Height);
mCurrentBounds.Width = (int)(dizi[2] * mControlSize.Width) + 2 * BORDER_MARGIN;
mCurrentBounds.Height = (int)(dizi[3] * mControlSize.Height) + 2 * BORDER_MARGIN;
}
else
{
if (this.Opacity < (double)mPopup.OpacityValue / 100)
{
this.Opacity += (progress - 0.09);
}
else
{
this.Opacity = (double)mPopup.OpacityValue / 100;
}
mCurrentBounds.X = mNormalPos.X;
mCurrentBounds.Y = mNormalPos.Y;
mCurrentBounds.Width = mControlSize.Width + (2 * BORDER_MARGIN);
mCurrentBounds.Height = mControlSize.Height + (2 * BORDER_MARGIN);
}
this.Bounds = mCurrentBounds;
}
#region Public Properties and Event
public event bir DropDown;
public event iki DropDownClosed;
[Browsable(false)]
public Control UserControl
{
get { return mUserControl; }
set { mUserControl = value; }
}
[Description("Formun opak veya transparent gözükme seçeneklerini ayarlar."),
Browsable(true),
DefaultValue(100)]
public byte OpacityValue
{
get { return opacity_deger; }
set
{
try
{
if (value < 0 || value > 100)
throw new Exception("Lütfen 0 ile 100 arasında bir değer giriniz.");
}
catch (Exception hata_Olustu)
{
MessageBox.Show(hata_Olustu.Message);
value = 100;
}
finally
{
opacity_deger = value;
}
}
}
[Browsable(false)]
public Control Parent
{
get { return mParent; }
set { mParent = value; }
}
[Description("Shadow Visibility"),
DefaultValue(false)]
public bool ShowShadow
{
get { return mShowShadow; }
set { mShowShadow = value; }
}
[Description("Animasyonun hızını ayarlar."),
DefaultValue(100)]
public int AnimationSpeed
{
get { return mAnimationSpeed; }
set { mAnimationSpeed = value; }
}
[Description("Popup formun açılış kordinatlarını ayarlar."),
DefaultValue(typeof(SifreKontrol.Popup.ePlacement),"BottomRight")]
public ePlacement Placement
{
get { return mPlacement; }
set { mPlacement = value; }
}
[Description("Border Color"),
DefaultValue(typeof(Color),"DarkGray")]
public Color BorderColor
{
get { return mBorderColor; }
set { mBorderColor = value; }
}
[Description("Animasyon tipini ayarlamanızı sağlar."),
Browsable(true),
DefaultValue(typeof(Popup.AnimationType), "PopupMenu")]
public AnimationType Animasyon_Tip
{
get { return animasyon_Tip; }
set { animasyon_Tip = value; }
}
#endregion//done
History
- 1st August, 2007: Initial version
Since 1998...
MCPD - Enterprise Application Developer
“Hesaplı hareket ettiğini zanneden ve onunla iftihar eyliyen dar kafalar; kurtulmağa, yükselmeğe elverişli hiç bir eser vücüda getirmezler. Kurtuluş ve yükselişi, ancak varlığına dayanan ve mülkü milletin gizli kapalı hazinelerini verimli hale getirmesini bilen, şahsi menfaatini millet menfaati uğruna feda eden, ruhu idealist, dimağı realist şahsiyetlerde aramalıdır.”
Nuri Demirağ, 1947