| | |
| | | /// <summary>
|
| | | /// 当前选择的控件(外框)
|
| | | /// </summary>
|
| | | private FrameLayoutControl nowSelectIcon1 = null;
|
| | | private FrameLayoutStatuControl nowSelectIcon1 = null;
|
| | | /// <summary>
|
| | | /// 圆盘选择的颜色显示控件(外框)
|
| | | /// </summary>
|
| | | private FrameLayoutControl wheelSelectIcon1 = null;
|
| | | private FrameLayoutStatuControl wheelSelectIcon1 = null;
|
| | | /// <summary>
|
| | | /// 圆盘选择的颜色显示控件(内框)
|
| | | /// </summary>
|
| | |
| | | /// <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));
|
| | |
|
| | |
| | | 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);
|
| | |
|
| | |
| | | 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])));
|
| | |
| | | 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);
|
| | | };
|
| | | }
|
| | |
|
| | |
| | | //控件数
|
| | | 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)
|
| | | {
|
| | |
| | | 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;
|
| | |
| | | {
|
| | | nowSelectIcon1.BorderColor = UserCenterColor.Current.White;
|
| | | }
|
| | | btnFrame.BorderColor = btnIcon.BackgroundColor;
|
| | | btnFrame.BorderColor = 0xffcccccc;
|
| | | nowSelectIcon1 = btnFrame;
|
| | |
|
| | | if (btnFrame.Name != null)
|
| | |
| | | #endregion
|
| | |
|
| | | #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>
|
| | | /// 界面关闭
|
| | | /// </summary>
|
| | | public override void CloseForm()
|
| | | public override void CloseFormBefore()
|
| | | {
|
| | | this.FinishSelectColorEvent = null;
|
| | |
|
| | | base.CloseForm();
|
| | | base.CloseFormBefore();
|
| | | }
|
| | |
|
| | | #endregion
|