728x90
반응형
728x170
▶ MainForm.cs
using System;
using System.ComponentModel;
using System.Drawing;
using System.Threading;
using System.Windows.Forms;
using TestProject.Properties;
namespace TestProject
{
/// <summary>
/// 메인 폼
/// </summary>
public partial class MainForm : Form
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 생성자 - MainForm()
/// <summary>
/// 생성자
/// </summary>
public MainForm()
{
InitializeComponent();
SetToggleSwitchesForStyleTabPage();
SetToggleSwitchesForSemiImportantPropertyTabPage();
SetToggleSwitchesForCustomizationsTabPage();
}
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Method
////////////////////////////////////////////////////////////////////////////////////////// Private
//////////////////////////////////////////////////////////////////////////////// Event
#region Allow User Change 체크 박스 체크 변경시 처리하기 - allowUserChangeCheckBox_CheckedChanged(sender, e)
/// <summary>
/// Allow User Change 체크 박스 체크 변경시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private void allowUserChangeCheckBox_CheckedChanged(object sender, EventArgs e)
{
this.allowUserChangeToggleSwitch1.Checked = this.allowUserChangeCheckBox.Checked;
this.allowUserChangeToggleSwitch2.Checked = this.allowUserChangeCheckBox.Checked;
}
#endregion
#region Gray When Disabled 체크 박스 체크 변경시 처리하기 - grayWhenDisabledCheckBox_CheckedChanged(sender, e)
/// <summary>
/// Gray When Disabled 체크 박스 체크 변경시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private void grayWhenDisabledCheckBox_CheckedChanged(object sender, EventArgs e)
{
this.grayWhenDisabledToggleSwitch1.Enabled = this.grayWhenDisabledCheckBox.Checked;
this.grayWhenDisabledToggleSwitch2.Enabled = this.grayWhenDisabledCheckBox.Checked;
}
#endregion
#region Threshold Percentage 트랙 바 스크롤시 처리하기 - thresholdPercentageTrackBar_Scroll(sender, e)
/// <summary>
/// Threshold Percentage 트랙 바 스크롤시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private void thresholdPercentageTrackBar_Scroll(object sender, EventArgs e)
{
this.thresholdPercentageMessageLabel1.Text = string.Format("Value = {0} (Default = 50)", this.thresholdPercentageTrackBar.Value);
this.thresholdPercentageToggleSwitch.ThresholdPercentage = this.thresholdPercentageTrackBar.Value;
}
#endregion
#region Toggle On Button Click 체크 박스 체크 변경시 처리하기 - toggleOnButtonClickCheckBox_CheckedChanged(sender, e)
/// <summary>
/// Toggle On Button Click 체크 박스 체크 변경시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private void toggleOnButtonClickCheckBox_CheckedChanged(object sender, EventArgs e)
{
this.toggleOnButtonClickToggleSwitch.ToggleOnButtonClick = this.toggleOnButtonClickCheckBox.Checked;
}
#endregion
#region Toggle On Side Click 체크 박스 체크 변경시 처리하기 - toggleOnSideClickCheckBox_CheckedChanged(sender, e)
/// <summary>
/// Toggle On Side Click 체크 박스 체크 변경시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private void toggleOnSideClickCheckBox_CheckedChanged(object sender, EventArgs e)
{
this.toggleOnButtonClickToggleSwitch.ToggleOnSideClick = this.toggleOnSideClickCheckBox.Checked;
}
#endregion
#region Advanced Behavior Fancy 토글 스위치 체크 변경시 처리하기 - advancedBehaviorFancyToggleSwitch_CheckedChanged(sender, e)
/// <summary>
/// Advanced Behavior Fancy 토글 스위치 체크 변경시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private void advancedBehaviorFancyToggleSwitch_CheckedChanged(object sender, EventArgs e)
{
if(this.advancedBehaviorFancyToggleSwitch.Checked)
{
this.advancedBehaviorFancyToggleSwitch.AllowUserChange = false;
this.advancedBehaviorFancyToggleSwitch.OnText = "Restarting...";
SetAnimatedGIFPictureBox();
this.animatedGIFPictureBox.Visible = true;
if(!this.simulateRestartBackgroundWorker.IsBusy)
{
this.simulateRestartBackgroundWorker.RunWorkerAsync();
}
}
else
{
this.advancedBehaviorFancyToggleSwitch.AllowUserChange = true;
this.advancedBehaviorFancyToggleSwitch.OnText = "Restart";
}
}
#endregion
#region 재시작 시뮬레이션 백그라운드 작업자 작업 처리하기 - simulateRestartBackgroundWorker_DoWork(sender, e)
/// <summary>
/// 재시작 시뮬레이변 백그라운드 작업자 작업 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private void simulateRestartBackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
{
Thread.Sleep(1500);
}
#endregion
#region 재시작 시뮬레이션 백그라운드 작업자 실행 완료시 처리하기 - simulateRestartBackgroundWorker_RunWorkerCompleted(sender, e)
/// <summary>
/// 재시작 시뮬레이션 백그라운드 작업자 실행 완료시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private void simulateRestartBackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
this.animatedGIFPictureBox.Visible = false;
this.advancedBehaviorFancyToggleSwitch.Checked = false;
}
#endregion
//////////////////////////////////////////////////////////////////////////////// Function
#region 스타일 탭 페이지용 토글 스위치들 설정하기 - SetToggleSwitchesForStyleTabPage()
/// <summary>
/// 스타일 탭 페이지용 토글 스위치들 설정하기
/// </summary>
private void SetToggleSwitchesForStyleTabPage()
{
this.metroStyleToggleSwitch.Style = ToggleSwitch.ToggleSwitchStyle.Metro;
this.metroStyleToggleSwitch.Size = new Size(120, 25);
this.metroStyleToggleSwitch.OnText = "ON";
this.metroStyleToggleSwitch.OnFont = new Font(tabControl.Font.FontFamily, 12, FontStyle.Bold);
this.metroStyleToggleSwitch.OnForegroundColor = Color.White;
this.metroStyleToggleSwitch.OffText = "OFF";
this.metroStyleToggleSwitch.OffFont = new Font(tabControl.Font.FontFamily, 12, FontStyle.Bold);
this.metroStyleToggleSwitch.OffForegroundColor = Color.FromArgb(141, 123, 141);
this.ios5StyleToggleSwitch.Style = ToggleSwitch.ToggleSwitchStyle.IOS5;
this.ios5StyleToggleSwitch.Size = new Size(120, 25);
this.ios5StyleToggleSwitch.OnText = "ON";
this.ios5StyleToggleSwitch.OnFont = new Font(tabControl.Font.FontFamily, 12, FontStyle.Bold);
this.ios5StyleToggleSwitch.OnForegroundColor = Color.White;
this.ios5StyleToggleSwitch.OffText = "OFF";
this.ios5StyleToggleSwitch.OffFont = new Font(tabControl.Font.FontFamily, 12, FontStyle.Bold);
this.ios5StyleToggleSwitch.OffForegroundColor = Color.FromArgb(141, 123, 141);
this.androidStyleToggleSwitch.Style = ToggleSwitch.ToggleSwitchStyle.Android;
this.androidStyleToggleSwitch.Size = new Size(120, 25);
this.androidStyleToggleSwitch.OnText = "ON";
this.androidStyleToggleSwitch.OnFont = new Font(tabControl.Font.FontFamily, 12, FontStyle.Bold);
this.androidStyleToggleSwitch.OnForegroundColor = Color.White;
this.androidStyleToggleSwitch.OffText = "OFF";
this.androidStyleToggleSwitch.OffFont = new Font(tabControl.Font.FontFamily, 12, FontStyle.Bold);
this.androidStyleToggleSwitch.OffForegroundColor = Color.FromArgb(141, 123, 141);
this.brushedMetalStyleToggleSwitch.Style = ToggleSwitch.ToggleSwitchStyle.BrushedMetal;
this.brushedMetalStyleToggleSwitch.Size = new Size(120, 25);
this.brushedMetalStyleToggleSwitch.OnText = "ON";
this.brushedMetalStyleToggleSwitch.OnFont = new Font(tabControl.Font.FontFamily, 12, FontStyle.Bold);
this.brushedMetalStyleToggleSwitch.OnForegroundColor = Color.White;
this.brushedMetalStyleToggleSwitch.OffText = "OFF";
this.brushedMetalStyleToggleSwitch.OffFont = new Font(tabControl.Font.FontFamily, 12, FontStyle.Bold);
this.brushedMetalStyleToggleSwitch.OffForegroundColor = Color.White;
this.iPhoneStyleToggleSwitch.Style = ToggleSwitch.ToggleSwitchStyle.IPhone;
this.iPhoneStyleToggleSwitch.Size = new Size(120, 25);
this.iPhoneStyleToggleSwitch.OnText = "ON";
this.iPhoneStyleToggleSwitch.OnFont = new Font(tabControl.Font.FontFamily, 12, FontStyle.Bold);
this.iPhoneStyleToggleSwitch.OnForegroundColor = Color.White;
this.iPhoneStyleToggleSwitch.OffText = "OFF";
this.iPhoneStyleToggleSwitch.OffFont = new Font(tabControl.Font.FontFamily, 12, FontStyle.Bold);
this.iPhoneStyleToggleSwitch.OffForegroundColor = Color.FromArgb(92, 92, 92);
this.modernStyleToggleSwitch.Style = ToggleSwitch.ToggleSwitchStyle.Modern;
this.modernStyleToggleSwitch.Size = new Size(120, 25);
this.modernStyleToggleSwitch.OnText = "ON";
this.modernStyleToggleSwitch.OnFont = new Font(tabControl.Font.FontFamily, 12, FontStyle.Bold);
this.modernStyleToggleSwitch.OnForegroundColor = Color.White;
this.modernStyleToggleSwitch.OffText = "OFF";
this.modernStyleToggleSwitch.OffFont = new Font(tabControl.Font.FontFamily, 12, FontStyle.Bold);
this.modernStyleToggleSwitch.OffForegroundColor = Color.FromArgb(153, 153, 153);
this.carbonStyleToggleSwitch.Style = ToggleSwitch.ToggleSwitchStyle.Carbon;
this.carbonStyleToggleSwitch.Size = new Size(120, 25);
this.carbonStyleToggleSwitch.OnText = "ON";
this.carbonStyleToggleSwitch.OnFont = new Font(tabControl.Font.FontFamily, 12, FontStyle.Bold);
this.carbonStyleToggleSwitch.OnForegroundColor = Color.White;
this.carbonStyleToggleSwitch.OffText = "OFF";
this.carbonStyleToggleSwitch.OffFont = new Font(tabControl.Font.FontFamily, 12, FontStyle.Bold);
this.carbonStyleToggleSwitch.OffForegroundColor = Color.White;
this.osxStyleToggleSwitch.Style = ToggleSwitch.ToggleSwitchStyle.OSX;
this.osxStyleToggleSwitch.Size = new Size(120, 25);
this.osxStyleToggleSwitch.OnText = "ON";
this.osxStyleToggleSwitch.OnFont = new Font(tabControl.Font.FontFamily, 12, FontStyle.Bold);
this.osxStyleToggleSwitch.OnForegroundColor = Color.White;
this.osxStyleToggleSwitch.OffText = "OFF";
this.osxStyleToggleSwitch.OffFont = new Font(tabControl.Font.FontFamily, 12, FontStyle.Bold);
this.osxStyleToggleSwitch.OffForegroundColor = Color.White;
this.fancyStyleToggleSwitch.Style = ToggleSwitch.ToggleSwitchStyle.Fancy;
this.fancyStyleToggleSwitch.Size = new Size(120, 25);
this.fancyStyleToggleSwitch.OnText = "ON";
this.fancyStyleToggleSwitch.OnFont = new Font(tabControl.Font.FontFamily, 12, FontStyle.Bold);
this.fancyStyleToggleSwitch.OnForegroundColor = Color.White;
this.fancyStyleToggleSwitch.OffText = "OFF";
this.fancyStyleToggleSwitch.OffFont = new Font(tabControl.Font.FontFamily, 12, FontStyle.Bold);
this.fancyStyleToggleSwitch.OffForegroundColor = Color.White;
this.fancyStyleToggleSwitch.ButtonImage = Resources.handle;
}
#endregion
#region 주요 속성 탭 페이지용 토글 스위치들 설정하기 - SetToggleSwitchesForSemiImportantPropertyTabPage()
/// <summary>
/// 주요 속성 탭 페이지용 토글 스위치들 설정하기
/// </summary>
public void SetToggleSwitchesForSemiImportantPropertyTabPage()
{
this.allowUserChangeToggleSwitch1.AllowUserChange = false;
this.allowUserChangeToggleSwitch2.AllowUserChange = true;
this.noAnimationToggleSwitch.Style = ToggleSwitch.ToggleSwitchStyle.Carbon;
this.noAnimationToggleSwitch.Size = new Size(100, 20);
this.noAnimationToggleSwitch.OnText = "On";
this.noAnimationToggleSwitch.OnFont = new Font(tabControl.Font.FontFamily, 12, FontStyle.Bold);
this.noAnimationToggleSwitch.OnForegroundColor = Color.White;
this.noAnimationToggleSwitch.OffText = "Off";
this.noAnimationToggleSwitch.OffFont = new Font(tabControl.Font.FontFamily, 12, FontStyle.Bold);
this.noAnimationToggleSwitch.OffForegroundColor = Color.White;
this.noAnimationToggleSwitch.UseAnimation = false;
this.fastAnimationToggleSwitch.Style = ToggleSwitch.ToggleSwitchStyle.Carbon;
this.fastAnimationToggleSwitch.Size = new Size(100, 20);
this.fastAnimationToggleSwitch.OnText = "On";
this.fastAnimationToggleSwitch.OnFont = new Font(tabControl.Font.FontFamily, 12, FontStyle.Bold);
this.fastAnimationToggleSwitch.OnForegroundColor = Color.White;
this.fastAnimationToggleSwitch.OffText = "Off";
this.fastAnimationToggleSwitch.OffFont = new Font(tabControl.Font.FontFamily, 12, FontStyle.Bold);
this.fastAnimationToggleSwitch.OffForegroundColor = Color.White;
this.fastAnimationToggleSwitch.UseAnimation = true;
this.fastAnimationToggleSwitch.AnimationInterval = 1;
this.fastAnimationToggleSwitch.AnimationStep = 10;
this.slowAnimationToggleSwitch.Style = ToggleSwitch.ToggleSwitchStyle.Carbon;
this.slowAnimationToggleSwitch.Size = new Size(100, 20);
this.slowAnimationToggleSwitch.OnText = "On";
this.slowAnimationToggleSwitch.OnFont = new Font(tabControl.Font.FontFamily, 12, FontStyle.Bold);
this.slowAnimationToggleSwitch.OnForegroundColor = Color.White;
this.slowAnimationToggleSwitch.OffText = "Off";
this.slowAnimationToggleSwitch.OffFont = new Font(tabControl.Font.FontFamily, 12, FontStyle.Bold);
this.slowAnimationToggleSwitch.OffForegroundColor = Color.White;
this.slowAnimationToggleSwitch.UseAnimation = true;
this.slowAnimationToggleSwitch.AnimationInterval = 10;
this.slowAnimationToggleSwitch.AnimationStep = 1;
this.grayWhenDisabledToggleSwitch1.Style = ToggleSwitch.ToggleSwitchStyle.Fancy;
this.grayWhenDisabledToggleSwitch1.Size = new Size(100, 20);
this.grayWhenDisabledToggleSwitch1.OnText = "ON";
this.grayWhenDisabledToggleSwitch1.OnFont = new Font(tabControl.Font.FontFamily, 12, FontStyle.Bold);
this.grayWhenDisabledToggleSwitch1.OnForegroundColor = Color.White;
this.grayWhenDisabledToggleSwitch1.OffText = "OFF";
this.grayWhenDisabledToggleSwitch1.OffFont = new Font(tabControl.Font.FontFamily, 12, FontStyle.Bold);
this.grayWhenDisabledToggleSwitch1.OffForegroundColor = Color.White;
this.grayWhenDisabledToggleSwitch1.ButtonImage = Resources.arrowRight;
this.grayWhenDisabledToggleSwitch1.GrayWhenDisabled = false;
this.grayWhenDisabledToggleSwitch2.Style = ToggleSwitch.ToggleSwitchStyle.Fancy;
this.grayWhenDisabledToggleSwitch2.Size = new Size(100, 20);
this.grayWhenDisabledToggleSwitch2.OnText = "ON";
this.grayWhenDisabledToggleSwitch2.OnFont = new Font(tabControl.Font.FontFamily, 12, FontStyle.Bold);
this.grayWhenDisabledToggleSwitch2.OnForegroundColor = Color.White;
this.grayWhenDisabledToggleSwitch2.OffText = "OFF";
this.grayWhenDisabledToggleSwitch2.OffFont = new Font(tabControl.Font.FontFamily, 12, FontStyle.Bold);
this.grayWhenDisabledToggleSwitch2.OffForegroundColor = Color.White;
this.grayWhenDisabledToggleSwitch2.ButtonImage = Resources.arrowRight;
this.grayWhenDisabledToggleSwitch2.GrayWhenDisabled = true;
this.thresholdPercentageToggleSwitch.Style = ToggleSwitch.ToggleSwitchStyle.IOS5;
this.thresholdPercentageToggleSwitch.Size = new Size(100, 20);
this.thresholdPercentageToggleSwitch.OnText = "ON";
this.thresholdPercentageToggleSwitch.OnFont = new Font(tabControl.Font.FontFamily, 12, FontStyle.Bold);
this.thresholdPercentageToggleSwitch.OnForegroundColor = Color.White;
this.thresholdPercentageToggleSwitch.OffText = "OFF";
this.thresholdPercentageToggleSwitch.OffFont = new Font(tabControl.Font.FontFamily, 12, FontStyle.Bold);
this.thresholdPercentageToggleSwitch.OffForegroundColor = Color.FromArgb(141, 123, 141);
this.thresholdPercentageToggleSwitch.ThresholdPercentage = 50;
this.toggleOnButtonClickToggleSwitch.Style = ToggleSwitch.ToggleSwitchStyle.BrushedMetal;
this.toggleOnButtonClickToggleSwitch.Size = new Size(93, 30);
this.toggleOnButtonClickToggleSwitch.OnText = "ON";
this.toggleOnButtonClickToggleSwitch.OnFont = new Font(tabControl.Font.FontFamily, 10, FontStyle.Bold);
this.toggleOnButtonClickToggleSwitch.OnForegroundColor = Color.White;
this.toggleOnButtonClickToggleSwitch.OffText = "OFF";
this.toggleOnButtonClickToggleSwitch.OffFont = new Font(tabControl.Font.FontFamily, 10, FontStyle.Bold);
this.toggleOnButtonClickToggleSwitch.OffForegroundColor = Color.White;
this.toggleOnButtonClickToggleSwitch.ToggleOnButtonClick = true;
this.toggleOnButtonClickToggleSwitch.ToggleOnSideClick = true;
}
#endregion
#region 개인화 탭 페이지용 토글 스위치들 설정하기 - SetToggleSwitchesForCustomizationsTabPage()
/// <summary>
/// 개인화 탭 페이지용 토글 스위치들 설정하기
/// </summary>
public void SetToggleSwitchesForCustomizationsTabPage()
{
this.normalMetroToggleSwitch.Style = ToggleSwitch.ToggleSwitchStyle.Metro;
this.normalMetroToggleSwitch.Size = new Size(100, 20);
MetroToggleSwitchRenderer customizedMetroToggleSwitchRenderer = new MetroToggleSwitchRenderer();
customizedMetroToggleSwitchRenderer.LeftSideColor = Color.Red;
customizedMetroToggleSwitchRenderer.LeftSideColorHovered = Color.FromArgb(210, 0, 0);
customizedMetroToggleSwitchRenderer.LeftSideColorPressed = Color.FromArgb(190, 0, 0);
customizedMetroToggleSwitchRenderer.RightSideColor = Color.Yellow;
customizedMetroToggleSwitchRenderer.RightSideColorHovered = Color.FromArgb(245, 245, 0);
customizedMetroToggleSwitchRenderer.RightSideColorPressed = Color.FromArgb(235, 235, 0);
this.customizedMetroToggleSwitch.Style = ToggleSwitch.ToggleSwitchStyle.Metro;
this.customizedMetroToggleSwitch.Size = new Size(100, 20);
this.customizedMetroToggleSwitch.SetRenderer(customizedMetroToggleSwitchRenderer);
this.normalIOS5ToggleSwitch.Style = ToggleSwitch.ToggleSwitchStyle.IOS5;
this.normalIOS5ToggleSwitch.Size = new Size(100, 20);
this.normalIOS5ToggleSwitch.OnText = "ON";
this.normalIOS5ToggleSwitch.OnFont = new Font(tabControl.Font.FontFamily, 12, FontStyle.Bold);
this.normalIOS5ToggleSwitch.OnForegroundColor = Color.White;
this.normalIOS5ToggleSwitch.OffText = "OFF";
this.normalIOS5ToggleSwitch.OffFont = new Font(tabControl.Font.FontFamily, 12, FontStyle.Bold);
this.normalIOS5ToggleSwitch.OffForegroundColor = Color.FromArgb(141, 123, 141);
IOS5ToggleSwitchRenderer customizedIOS5ToggleSwitchRenderer = new IOS5ToggleSwitchRenderer();
customizedIOS5ToggleSwitchRenderer.LeftSideUpperColor1 = Color.FromArgb(128, 0, 64);
customizedIOS5ToggleSwitchRenderer.LeftSideUpperColor2 = Color.FromArgb(180, 0, 90);
customizedIOS5ToggleSwitchRenderer.LeftSideLowerColor1 = Color.FromArgb(250, 0, 125);
customizedIOS5ToggleSwitchRenderer.LeftSideLowerColor2 = Color.FromArgb(255, 120, 190);
customizedIOS5ToggleSwitchRenderer.RightSideUpperColor1 = Color.FromArgb(0, 64, 128);
customizedIOS5ToggleSwitchRenderer.RightSideUpperColor2 = Color.FromArgb(0, 90, 180);
customizedIOS5ToggleSwitchRenderer.RightSideLowerColor1 = Color.FromArgb(0, 125, 250);
customizedIOS5ToggleSwitchRenderer.RightSideLowerColor2 = Color.FromArgb(120, 190, 255);
customizedIOS5ToggleSwitchRenderer.ButtonNormalOuterBorderColor = Color.Green;
customizedIOS5ToggleSwitchRenderer.ButtonNormalInnerBorderColor = Color.Green;
customizedIOS5ToggleSwitchRenderer.ButtonNormalSurfaceColor1 = Color.Red;
customizedIOS5ToggleSwitchRenderer.ButtonNormalSurfaceColor2 = Color.Red;
customizedIOS5ToggleSwitchRenderer.ButtonHoverOuterBorderColor = Color.Green;
customizedIOS5ToggleSwitchRenderer.ButtonHoverInnerBorderColor = Color.Green;
customizedIOS5ToggleSwitchRenderer.ButtonHoverSurfaceColor1 = Color.Red;
customizedIOS5ToggleSwitchRenderer.ButtonHoverSurfaceColor2 = Color.Red;
customizedIOS5ToggleSwitchRenderer.ButtonPressedOuterBorderColor = Color.Green;
customizedIOS5ToggleSwitchRenderer.ButtonPressedInnerBorderColor = Color.Green;
customizedIOS5ToggleSwitchRenderer.ButtonPressedSurfaceColor1 = Color.Red;
customizedIOS5ToggleSwitchRenderer.ButtonPressedSurfaceColor2 = Color.Red;
this.customizedIOS5ToggleSwitch.Style = ToggleSwitch.ToggleSwitchStyle.IOS5;
this.customizedIOS5ToggleSwitch.Size = new Size(100, 20);
this.customizedIOS5ToggleSwitch.OnText = "ON";
this.customizedIOS5ToggleSwitch.OnFont = new Font(tabControl.Font.FontFamily, 12, FontStyle.Bold);
this.customizedIOS5ToggleSwitch.OnForegroundColor = Color.White;
this.customizedIOS5ToggleSwitch.OffText = "OFF";
this.customizedIOS5ToggleSwitch.OffFont = new Font(tabControl.Font.FontFamily, 12, FontStyle.Bold);
this.customizedIOS5ToggleSwitch.OffForegroundColor = Color.White;
this.customizedIOS5ToggleSwitch.SetRenderer(customizedIOS5ToggleSwitchRenderer);
this.normalFancyToggleSwitch.Style = ToggleSwitch.ToggleSwitchStyle.Fancy;
this.normalFancyToggleSwitch.Size = new Size(100, 30);
this.normalFancyToggleSwitch.OnText = "ON";
this.normalFancyToggleSwitch.OnFont = new Font(tabControl.Font.FontFamily, 12, FontStyle.Bold);
this.normalFancyToggleSwitch.OnForegroundColor = Color.White;
this.normalFancyToggleSwitch.OffText = "OFF";
this.normalFancyToggleSwitch.OffFont = new Font(tabControl.Font.FontFamily, 12, FontStyle.Bold);
this.normalFancyToggleSwitch.OffForegroundColor = Color.White;
this.customizedFancyToggleSwitch.Style = ToggleSwitch.ToggleSwitchStyle.Fancy;
this.customizedFancyToggleSwitch.Size = new Size(100, 30);
this.customizedFancyToggleSwitch.OffButtonImage = Resources.arrowRight;
this.customizedFancyToggleSwitch.OffSideImage = Resources.cross;
this.customizedFancyToggleSwitch.OnButtonImage = Resources.arrowLeft;
this.customizedFancyToggleSwitch.OnSideImage = Resources.check;
Color tempColor;
FancyToggleSwitchRenderer customizedFancyToggleSwitchRenderer = new FancyToggleSwitchRenderer();
tempColor = customizedFancyToggleSwitchRenderer.LeftSideBackgroundColor1;
customizedFancyToggleSwitchRenderer.LeftSideBackgroundColor1 = customizedFancyToggleSwitchRenderer.RightSideBackgroundColor1;
customizedFancyToggleSwitchRenderer.RightSideBackgroundColor1 = tempColor;
tempColor = customizedFancyToggleSwitchRenderer.LeftSideBackgroundColor2;
customizedFancyToggleSwitchRenderer.LeftSideBackgroundColor2 = customizedFancyToggleSwitchRenderer.RightSideBackgroundColor2;
customizedFancyToggleSwitchRenderer.RightSideBackgroundColor2 = tempColor;
this.advancedBehaviorFancyToggleSwitch.Style = ToggleSwitch.ToggleSwitchStyle.Fancy;
this.advancedBehaviorFancyToggleSwitch.Size = new Size(180, 30);
this.advancedBehaviorFancyToggleSwitch.OnText = "Restart";
this.advancedBehaviorFancyToggleSwitch.OnFont = new Font(tabControl.Font.FontFamily, 10, FontStyle.Bold);
this.advancedBehaviorFancyToggleSwitch.OnForegroundColor = Color.White;
this.advancedBehaviorFancyToggleSwitch.OffText = "Online";
this.advancedBehaviorFancyToggleSwitch.OffFont = new Font(tabControl.Font.FontFamily, 10, FontStyle.Bold);
this.advancedBehaviorFancyToggleSwitch.OffForegroundColor = Color.White;
this.advancedBehaviorFancyToggleSwitch.OffButtonImage = Resources.arrowRight;
this.advancedBehaviorFancyToggleSwitch.UseAnimation = false;
this.advancedBehaviorFancyToggleSwitch.SetRenderer(customizedFancyToggleSwitchRenderer);
this.advancedBehaviorFancyToggleSwitch.CheckedChanged += advancedBehaviorFancyToggleSwitch_CheckedChanged;
this.animatedGIFPictureBox.Parent = this.advancedBehaviorFancyToggleSwitch;
}
#endregion
#region 애니메이션 GIF 픽처 박스 설정하기 - SetAnimatedGIFPictureBox()
/// <summary>
/// 애니메이션 GIF 픽처 박스 설정하기
/// </summary>
private void SetAnimatedGIFPictureBox()
{
Rectangle buttonRectangle = this.advancedBehaviorFancyToggleSwitch.ButtonRectangle;
this.animatedGIFPictureBox.Height = buttonRectangle.Height - 2;
this.animatedGIFPictureBox.Width = this.animatedGIFPictureBox.Height;
this.animatedGIFPictureBox.Left = buttonRectangle.X + ((buttonRectangle.Width - this.animatedGIFPictureBox.Width ) / 2);
this.animatedGIFPictureBox.Top = buttonRectangle.Y + ((buttonRectangle.Height - this.animatedGIFPictureBox.Height) / 2);
}
#endregion
}
}
728x90
반응형
그리드형(광고전용)
'C# > WinForm' 카테고리의 다른 글
[C#/WINFORM] 트레이 아이콘 사용하기 (0) | 2017.05.20 |
---|---|
[C#/WINFORM] 워터마크 사용하기 (0) | 2017.05.05 |
[C#/WINFORM] 후킹을 사용해 화면 잠그기 (0) | 2017.05.05 |
[C#/WINFORM] Graphics 클래스 : CopyFromScreen 메소드를 사용해 화면 캡처하기 (0) | 2017.05.04 |
[C#/WINFORM] UserControl 클래스 : 이미지 버튼 사용하기 (0) | 2017.05.04 |
[C#/WINFORM] 더블 버퍼링 설정하기 (0) | 2017.04.30 |
[C#/WINFORM] Clipboard 클래스 : 엑셀 데이터 붙여넣기 (0) | 2017.04.03 |
[C#/WINFORM] 외곽선 텍스트 그리기 (0) | 2017.02.01 |
[C#/WINFORM] 컨트롤 비트맵 구하기 (0) | 2017.01.17 |
[C#/WINFORM] 커서 구하기 (0) | 2017.01.17 |
댓글을 달아 주세요