From ecba45c93391066bc30c7bd602c3a7683fbb99a7 Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期五, 31 七月 2020 10:56:12 +0800
Subject: [PATCH] 临时备份
---
ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelColorSelectForm.cs | 94 ++++++++++++++++++++++++++++++++++++----------
1 files changed, 73 insertions(+), 21 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelColorSelectForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelColorSelectForm.cs
index 4ccf131..85c4f68 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelColorSelectForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelColorSelectForm.cs
@@ -23,11 +23,11 @@
/// <summary>
/// 褰撳墠閫夋嫨鐨勬帶浠�(澶栨)
/// </summary>
- private FrameLayoutControl nowSelectIcon1 = null;
+ private FrameLayoutStatuControl nowSelectIcon1 = null;
/// <summary>
/// 鍦嗙洏閫夋嫨鐨勯鑹叉樉绀烘帶浠�(澶栨)
/// </summary>
- private FrameLayoutControl wheelSelectIcon1 = null;
+ private FrameLayoutStatuControl wheelSelectIcon1 = null;
/// <summary>
/// 鍦嗙洏閫夋嫨鐨勯鑹叉樉绀烘帶浠�(鍐呮)
/// </summary>
@@ -45,6 +45,8 @@
/// <param name="i_B">B</param>
public void ShowForm(int i_R,int i_G,int i_B)
{
+ this.ScrollEnabled = false;
+
//璁剧疆澶撮儴淇℃伅
base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uSelectColor));
@@ -102,8 +104,8 @@
bodyFrameLayout.AddChidren(frameBack);
var framePic = new FrameLayout();
- framePic.Width = Application.GetMinRealAverage(588);
- framePic.Height = Application.GetMinRealAverage(588);
+ framePic.Width = this.GetPictrueRealSize(588);
+ framePic.Height = this.GetPictrueRealSize(588);
framePic.Gravity = Gravity.Center;
frameBack.AddChidren(framePic);
@@ -116,11 +118,19 @@
var btnWhiteView = new IconViewControl(30);
btnWhiteView.Visible = false;
btnWhiteView.BackgroundColor = UserCenterColor.Current.White;
- btnWhiteView.Radius = (uint)Application.GetMinRealAverage(30) / 2;
+ btnWhiteView.Radius = (uint)this.GetPictrueRealSize(30) / 2;
framePic.AddChidren(btnWhiteView);
+ bool pointIsRight = false;
+ //鍦嗙殑鍗婂緞
+ int circleR = framePic.Width / 2 - this.GetPictrueRealSize(35);
colorPic.ColorChaged += (sender, eColor) =>
{
+ if (pointIsRight == false)
+ {
+ //鐐圭殑鍖哄煙涓嶆槸鍦嗙洏鍐�
+ return;
+ }
listRGB = new List<int>();
listRGB.Add(Convert.ToInt32(Convert.ToString(eColor[0])));
listRGB.Add(Convert.ToInt32(Convert.ToString(eColor[1])));
@@ -132,19 +142,30 @@
nowSelectIcon1.BorderColor = UserCenterColor.Current.White;
}
wheelSelectIcon2.BackgroundColor = this.GetColorByRGB(eColor[0], eColor[1], eColor[2]);
- wheelSelectIcon1.BorderColor = wheelSelectIcon2.BackgroundColor;
+ wheelSelectIcon1.BorderColor = 0xffcccccc;
wheelSelectIcon1.Name = listRGB[0] + "-" + listRGB[1] + "-" + listRGB[2];
nowSelectIcon1 = wheelSelectIcon1;
};
colorPic.MouseDownEventHandler += (sender, e) =>
{
+ pointIsRight = this.CheckPoint(circleR, framePic.Width / 2, framePic.Height / 2, (int)e.X, (int)e.Y);
+ if (pointIsRight == false)
+ {
+ //鐐圭殑鍖哄煙涓嶆槸鍦嗙洏鍐�
+ return;
+ }
//鏄剧ず鐧界偣
- btnWhiteView.X = (int)e.X;
- btnWhiteView.Y = (int)e.Y;
+ btnWhiteView.X = (int)e.X - btnWhiteView.Width / 2;
+ btnWhiteView.Y = (int)e.Y - btnWhiteView.Height / 2;
if (btnWhiteView.Visible == false)
{
btnWhiteView.Visible = true;
}
+ };
+ colorPic.MouseMoveEventHandler += (sender, e) =>
+ {
+ //褰撻紶鏍囩偣涓嬩簨浠跺鐞�
+ colorPic.MouseDownEventHandler(sender, e);
};
}
@@ -163,26 +184,28 @@
//鎺т欢鏁�
var listColor = this.InitSpareDefultColor();
//X杞村垵濮嬪潗鏍�
- int Xdefult = (bodyFrameLayout.Width - Application.GetMinRealAverage(80 + 24) * (listColor.Count - 1) - Application.GetMinRealAverage(80)) / 2;
+ int Xdefult = (bodyFrameLayout.Width - this.GetPictrueRealSize(80 + 24) * (listColor.Count - 1) - this.GetPictrueRealSize(80)) / 2;
for (int i = 0; i < listColor.Count; i++)
{
var dataColor = listColor[i];
- var btnFrame = new FrameLayoutControl();
- btnFrame.Height = Application.GetMinRealAverage(80);
- btnFrame.Width = Application.GetMinRealAverage(80);
- btnFrame.Radius = (uint)Application.GetMinRealAverage(80) / 2;
- btnFrame.X = Xdefult + i * Application.GetMinRealAverage(80 + 24);
+ var btnFrame = new FrameLayoutStatuControl();
+ btnFrame.Height = this.GetPictrueRealSize(80);
+ btnFrame.Width = this.GetPictrueRealSize(80);
+ btnFrame.Radius = (uint)this.GetPictrueRealSize(80) / 2;
+ btnFrame.X = Xdefult + i * this.GetPictrueRealSize(80 + 24);
btnFrame.Y = Application.GetRealHeight(1054);
btnFrame.BackgroundColor = UserCenterColor.Current.White;
- btnFrame.BorderWidth = 2;
+ btnFrame.BorderWidth = 1;
btnFrame.BorderColor = UserCenterColor.Current.White;
bodyFrameLayout.AddChidren(btnFrame);
- var btnIcon = new IconViewControl(60);
+ //鍒嗕袱姝ヨ绠楋紝涓嶇劧鏈夊彲鑳藉畠寰楀嚭鐨勭粨鏋滄湁璇樊瀵艰嚧涓嶅眳涓�
+ int iconWidth = btnFrame.Height - this.GetPictrueRealSize(10) - this.GetPictrueRealSize(10);
+ var btnIcon = new IconViewControl(iconWidth, false);
btnIcon.Gravity = Gravity.Center;
- btnIcon.Radius = (uint)btnIcon.IconSize;
- btnFrame.AddChidren(btnIcon, ChidrenBindMode.BindEventOnly);
+ btnIcon.Radius = (uint)btnIcon.IconSize / 2;
+ btnFrame.AddChidren(btnIcon, ChidrenBindMode.BindEvent);
if (dataColor != null)
{
@@ -193,8 +216,8 @@
else
{
//鍘熸潵鐨勯鑹�
- btnFrame.BorderColor = this.GetColorByRGB((byte)i_R, (byte)i_G, (byte)i_B);
- btnIcon.BackgroundColor = btnFrame.BorderColor;
+ btnFrame.BorderColor = 0xffcccccc;
+ btnIcon.BackgroundColor = this.GetColorByRGB((byte)i_R, (byte)i_G, (byte)i_B);
wheelSelectIcon1 = btnFrame;
wheelSelectIcon2 = btnIcon;
nowSelectIcon1 = btnFrame;
@@ -207,7 +230,7 @@
{
nowSelectIcon1.BorderColor = UserCenterColor.Current.White;
}
- btnFrame.BorderColor = btnIcon.BackgroundColor;
+ btnFrame.BorderColor = 0xffcccccc;
nowSelectIcon1 = btnFrame;
if (btnFrame.Name != null)
@@ -227,6 +250,35 @@
#region 鈻� 涓�鑸柟娉昣__________________________
/// <summary>
+ /// 妫�娴嬬偣鍑荤偣
+ /// </summary>
+ /// <param name="circleR">鍦嗙殑鍗婂緞</param>
+ /// <param name="circleX">鍦嗗績X杞�</param>
+ /// <param name="circleY">鍦嗗績Y杞�</param>
+ /// <param name="pointX">鐐瑰嚮鐐圭殑X杞�</param>
+ /// <param name="pointY">鐐瑰嚮鐐圭殑Y杞�</param>
+ /// <returns></returns>
+ private bool CheckPoint(int circleR, int circleX, int circleY, int pointX, int pointY)
+ {
+ int dwidth = circleX - pointX;
+ if (dwidth < 0) { dwidth *= -1; }
+
+ int dHeight = circleY - pointY;
+ if (dHeight < 0) { dHeight *= -1; }
+
+ //鏍规嵁涓夎鍑芥暟,姹備笁瑙掑舰鐨勬枩杈归暱
+ int dlength = dwidth * dwidth + dHeight * dHeight;
+ //鍗婂緞闀垮害(涓嶅紑鏂�,鎵�浠ユ槸鎸夊钩鏂圭畻)
+ circleR *= circleR;
+ if (dlength < circleR)
+ {
+ //濡傛灉缁勬垚鐨勪笁瑙掑舰骞舵病鏈夐暱杩囧崐寰�,鍒欎唬琛ㄨ繕鍦ㄥ渾鍐�(涓嶅厑璁哥偣杈圭晫)
+ return true;
+ }
+ return false;
+ }
+
+ /// <summary>
/// 鍒濆鍖栧鐢ㄩ鑹茬殑榛樿鍊�
/// </summary>
/// <returns></returns>
--
Gitblit v1.8.0