コード例 #1
0
ファイル: frm_Main.cs プロジェクト: doksec/bykom_dahuaDotNet
        /// <summary>
        /// OSD类型选择处理
        /// </summary>
        /// <param name="encodeWidGet"></param>
        private void OSDSelectChange(DH_ENCODE_WIDGET encodeWidGet)
        {
            try
            {
                chkShow.Checked = (encodeWidGet.bShow == 1 ? true : false);
                string rgbaValue = "";
                //前景色
                rgbaValue = encodeWidGet.rgbaFrontground.ToString("X");
                rgbaValue = "00000000".Remove(0, rgbaValue.Length) + rgbaValue;
                txtFrontgroundR.Text = int.Parse(rgbaValue.Substring(0, 2), System.Globalization.NumberStyles.AllowHexSpecifier).ToString();
                txtFrontgroundG.Text = int.Parse(rgbaValue.Substring(2, 2), System.Globalization.NumberStyles.AllowHexSpecifier).ToString();
                txtFrontgroundB.Text = int.Parse(rgbaValue.Substring(4, 2), System.Globalization.NumberStyles.AllowHexSpecifier).ToString();
                txtFrontgroundA.Text = int.Parse(rgbaValue.Substring(6, 2), System.Globalization.NumberStyles.AllowHexSpecifier).ToString();
                //背景色
                rgbaValue = encodeWidGet.rgbaBackground.ToString("X");
                rgbaValue = "00000000".Remove(0, rgbaValue.Length) + rgbaValue;
                txtBackgroundR.Text = int.Parse(rgbaValue.Substring(0, 2), System.Globalization.NumberStyles.AllowHexSpecifier).ToString();
                txtBackgroundG.Text = int.Parse(rgbaValue.Substring(2, 2), System.Globalization.NumberStyles.AllowHexSpecifier).ToString();
                txtBackgroundB.Text = int.Parse(rgbaValue.Substring(4, 2), System.Globalization.NumberStyles.AllowHexSpecifier).ToString();
                txtBackgroundA.Text = int.Parse(rgbaValue.Substring(6, 2), System.Globalization.NumberStyles.AllowHexSpecifier).ToString();
                //边距
                txtLeft.Text = encodeWidGet.rcRect.left.ToString();
                txtRight.Text = encodeWidGet.rcRect.right.ToString();
                txtTop.Text = encodeWidGet.rcRect.top.ToString();
                txtBottom.Text = encodeWidGet.rcRect.bottom.ToString();
            }
            catch
            {
                MessageBox.Show("赋值错误!", pMsgTitle);
            }

        }
コード例 #2
0
ファイル: frm_Main.cs プロジェクト: doksec/bykom_dahuaDotNet
        /// <summary>
        /// OSD类型选择前的数据保存处理
        /// </summary>
        /// <param name="encodeWidGet"></param>
        private void OSDSaveData(ref DH_ENCODE_WIDGET encodeWidGet)
        {
            encodeWidGet.bShow = (byte)(chkShow.Checked == true ? 1 : 0);
            encodeWidGet.rcRect.left = int.Parse(txtLeft.Text);
            encodeWidGet.rcRect.top = int.Parse(txtTop.Text);
            encodeWidGet.rcRect.right = int.Parse(txtRight.Text);
            encodeWidGet.rcRect.bottom = int.Parse(txtBottom.Text);
            encodeWidGet.rgbaBackground = uint.Parse(StringToHexString(txtBackgroundR.Text) + 
                                                     StringToHexString(txtBackgroundG.Text) + 
                                                     StringToHexString(txtBackgroundB.Text) + 
                                                     StringToHexString(txtBackgroundA.Text), 
                                                     System.Globalization.NumberStyles.AllowHexSpecifier);
            encodeWidGet.rgbaFrontground = uint.Parse(StringToHexString(txtFrontgroundR.Text) +
                                                      StringToHexString(txtFrontgroundG.Text) +
                                                      StringToHexString(txtFrontgroundB.Text) +
                                                      StringToHexString(txtFrontgroundA.Text),
                                                      System.Globalization.NumberStyles.AllowHexSpecifier);

        }