示例#1
0
        private GradientInfo AddDefaultGradient()
        {
            GradientInfo gradientInfo = new GradientInfo();

            gradientInfo.Type = LinearGradientMode.Horizontal;

            switch (RandomFast.Next(0, 2))
            {
            case 0:
                gradientInfo.Colors.Add(new GradientStop(Color.FromArgb(0, 187, 138), 0f));
                gradientInfo.Colors.Add(new GradientStop(Color.FromArgb(0, 105, 163), 100f));
                break;

            case 1:
                gradientInfo.Colors.Add(new GradientStop(Color.FromArgb(255, 3, 135), 0f));
                gradientInfo.Colors.Add(new GradientStop(Color.FromArgb(255, 143, 3), 100f));
                break;

            case 2:
                gradientInfo.Colors.Add(new GradientStop(Color.FromArgb(184, 11, 195), 0f));
                gradientInfo.Colors.Add(new GradientStop(Color.FromArgb(98, 54, 255), 100f));
                break;
            }

            return(gradientInfo);
        }
示例#2
0
        /// <summary>
        /// 更新线路坡度表
        /// </summary>
        /// <param name="dao">数据对象</param>
        /// <returns>成功/失败</returns>
        public bool Update(GradientInfo dao)
        {
            SqlStatement stmt = _session.CreateSqlStatement();

            stmt.AppendString("update GradientInfo set ");
            stmt.AppendString("GroupID=");
            stmt.AppendParameter(_session.MakeInParameter("GroupID", dao.GroupID, SqlDbType.UniqueIdentifier));
            stmt.AppendString(",StartStationName=");
            stmt.AppendParameter(_session.MakeInParameter("StartStationName", dao.StartStationName, SqlDbType.NVarChar));
            stmt.AppendString(",EndStationName=");
            stmt.AppendParameter(_session.MakeInParameter("EndStationName", dao.EndStationName, SqlDbType.NVarChar));
            stmt.AppendString(",Category=");
            stmt.AppendParameter(_session.MakeInParameter("Category", dao.Category, SqlDbType.Int));
            stmt.AppendString(",Gradient=");
            stmt.AppendParameter(_session.MakeInParameter("Gradient", dao.Gradient, SqlDbType.Decimal));
            stmt.AppendString(",Length=");
            stmt.AppendParameter(_session.MakeInParameter("Length", dao.Length, SqlDbType.Int));
            stmt.AppendString(",EndMileage=");
            stmt.AppendParameter(_session.MakeInParameter("EndMileage", dao.EndMileage, SqlDbType.NVarChar));
            stmt.AppendString(",Remark=");
            stmt.AppendParameter(_session.MakeInParameter("Remark", dao.Remark, SqlDbType.NVarChar));
            stmt.AppendString(" where ");
            stmt.AppendString("ID=");
            stmt.AppendParameter(_session.MakeInParameter("ID", dao.ID, SqlDbType.Int));
            stmt.StatementType = SqlStatementType.Update;
            return(_session.Excecute(stmt).RowsAffected > 0);
        }
示例#3
0
 public DrawTextEx()
 {
     this.ApplyDefaultPropertyValues();
     Gradient        = AddDefaultGradient();
     OutlineGradient = AddDefaultGradient();
     ShadowGradient  = AddDefaultGradient();
 }
示例#4
0
        public void SetToDefaults()
        {
            this.antiAliasing   = true;
            this.fontSmoothing  = FontSmoothing.Smooth;
            this.primaryColor   = ColorBgra.FromBgra(0, 0, 0, 255);
            this.secondaryColor = ColorBgra.FromBgra(255, 255, 255, 255);
            this.gradientInfo   = new GradientInfo(GradientType.LinearClamped, false);
            this.penInfo        = new PenInfo(PenInfo.DefaultDashStyle, 2.0f, PenInfo.DefaultLineCap, PenInfo.DefaultLineCap, PenInfo.DefaultCapScale);
            this.brushInfo      = new BrushInfo(BrushType.Solid, HatchStyle.BackwardDiagonal);

            try
            {
                this.fontInfo = new FontInfo(new FontFamily("Arial"), 12, FontStyle.Regular);
            }

            catch (Exception)
            {
                this.fontInfo = new FontInfo(new FontFamily(GenericFontFamilies.SansSerif), 12, FontStyle.Regular);
            }

            this.textAlignment = TextAlignment.Left;
            this.shapeDrawType = ShapeDrawType.Outline;
            this.alphaBlending = true;
            this.tolerance     = 0.5f;

            this.colorPickerClickBehavior = ColorPickerClickBehavior.NoToolSwitch;
            this.resamplingAlgorithm      = ResamplingAlgorithm.Bilinear;
            this.selectionCombineMode     = CombineMode.Replace;
            this.floodMode             = FloodMode.Local;
            this.selectionDrawModeInfo = SelectionDrawModeInfo.CreateDefault();
        }
示例#5
0
        /// <summary>
        /// 新增线路坡度表
        /// </summary>
        /// <param name="dao">数据对象</param>
        /// <returns>成功/失败</returns>
        public bool Insert(GradientInfo dao)
        {
            SqlStatement stmt = _session.CreateSqlStatement();

            stmt.AppendString("insert into GradientInfo(GroupID,StartStationName,EndStationName,Category,Gradient,Length,EndMileage,Remark) values (");
            stmt.AppendParameter(_session.MakeInParameter("GroupID", dao.GroupID, SqlDbType.UniqueIdentifier));
            stmt.AppendString(",");
            stmt.AppendParameter(_session.MakeInParameter("StartStationName", dao.StartStationName, SqlDbType.NVarChar));
            stmt.AppendString(",");
            stmt.AppendParameter(_session.MakeInParameter("EndStationName", dao.EndStationName, SqlDbType.NVarChar));
            stmt.AppendString(",");
            stmt.AppendParameter(_session.MakeInParameter("Category", dao.Category, SqlDbType.Int));
            stmt.AppendString(",");
            stmt.AppendParameter(_session.MakeInParameter("Gradient", dao.Gradient, SqlDbType.Decimal));
            stmt.AppendString(",");
            stmt.AppendParameter(_session.MakeInParameter("Length", dao.Length, SqlDbType.Int));
            stmt.AppendString(",");
            stmt.AppendParameter(_session.MakeInParameter("EndMileage", dao.EndMileage, SqlDbType.NVarChar));
            stmt.AppendString(",");
            stmt.AppendParameter(_session.MakeInParameter("Remark", dao.Remark, SqlDbType.NVarChar));
            stmt.AppendString(");select SCOPE_IDENTITY();");
            stmt.StatementType = SqlStatementType.Identity;
            SqlResult result = _session.Excecute(stmt);

            if (result.Data != null)
            {
                dao.ID = int.Parse(result.Data.ToString());
                return(true);
            }
            return(false);
        }
示例#6
0
文件: DrawText.cs 项目: tanjil/ShareX
 private void AddDefaultGradient()
 {
     Gradient = new GradientInfo();
     Gradient.Colors.Add(new GradientStop(Color.FromArgb(68, 120, 194), 0f));
     Gradient.Colors.Add(new GradientStop(Color.FromArgb(13, 58, 122), 50f));
     Gradient.Colors.Add(new GradientStop(Color.FromArgb(6, 36, 78), 50f));
     Gradient.Colors.Add(new GradientStop(Color.FromArgb(23, 89, 174), 100f));
 }
示例#7
0
        public DrawTextEx()
        {
            this.ApplyDefaultPropertyValues();

            Gradient = new GradientInfo();
            AddDefaultGradient(Gradient);
            OutlineGradient = new GradientInfo();
            AddDefaultGradient(OutlineGradient);
            ShadowGradient = new GradientInfo();
            AddDefaultGradient(ShadowGradient);
        }
示例#8
0
        /// <summary>
        /// 获取指定大小的一页线路坡度表集合
        /// </summary>
        /// <param name="pageIndex">当前页码</param>
        /// <param name="pageSize">分页大小</param>
        /// <param name="rowsCount">总记录条数</param>
        /// <returns>分页数据</returns>
        public ObservableCollection <GradientInfo> SelectAllCollection(int pageIndex, int pageSize, int rowsCount)
        {
            ObservableCollection <GradientInfo> datas = new ObservableCollection <GradientInfo>();
            GenDataReader reader = Session.ExcecuteReader(_dal.SelectAllSqlStatement(), pageIndex, pageSize, rowsCount);

            while (reader.Read())
            {
                GradientInfo dao = new GradientInfo();
                _dal.DataReaderToEntity(reader, dao);
                datas.Add(dao);
            }
            reader.Close();
            return(datas);
        }
示例#9
0
        /// <summary>
        /// 获取指定的线路坡度表
        /// </summary>
        /// <param name="iD">顺序号</param>
        /// <returns>线路坡度表</returns>
        public GradientInfo SelectOne(int iD)
        {
            SqlStatement stmt = _session.CreateSqlStatement();

            stmt.AppendString("select * from GradientInfo where ID=");
            stmt.AppendParameter(_session.MakeInParameter("ID", iD, SqlDbType.Int));
            stmt.StatementType = SqlStatementType.Select;
            SqlResult    result       = _session.Excecute(stmt);
            GradientInfo gradientInfo = new GradientInfo();

            if (result.RowsAffected > 0)
            {
                DataRowToEntity(result.Tables[0].Rows[0], gradientInfo);
            }
            return(gradientInfo);
        }
示例#10
0
        /// <summary>
        /// 获取所有的线路坡度表集合
        /// </summary>
        /// <returns>所有信息</returns>
        public ObservableCollection <GradientInfo> SelectAllCollection()
        {
            ObservableCollection <GradientInfo> datas = new ObservableCollection <GradientInfo>();
            SqlStatement stmt = _session.CreateSqlStatement();

            stmt.AppendString("select * from GradientInfo");
            stmt.StatementType = SqlStatementType.Select;
            GenDataReader reader = _session.ExcecuteReader(stmt);

            while (reader.Read())
            {
                GradientInfo dao = new GradientInfo();
                DataReaderToEntity(reader, dao);
                datas.Add(dao);
            }
            reader.Close();
            return(datas);
        }
示例#11
0
 public void LoadFrom(ToolEnvironment toolEnvironment)
 {
     this.textAlignment            = toolEnvironment.textAlignment;
     this.gradientInfo             = toolEnvironment.gradientInfo.Clone();
     this.fontSmoothing            = toolEnvironment.fontSmoothing;
     this.fontInfo                 = toolEnvironment.fontInfo.Clone();
     this.penInfo                  = toolEnvironment.penInfo.Clone();
     this.brushInfo                = toolEnvironment.brushInfo.Clone();
     this.primaryColor             = toolEnvironment.primaryColor;
     this.secondaryColor           = toolEnvironment.secondaryColor;
     this.alphaBlending            = toolEnvironment.alphaBlending;
     this.shapeDrawType            = toolEnvironment.shapeDrawType;
     this.antiAliasing             = toolEnvironment.antiAliasing;
     this.colorPickerClickBehavior = toolEnvironment.colorPickerClickBehavior;
     this.resamplingAlgorithm      = toolEnvironment.resamplingAlgorithm;
     this.tolerance                = toolEnvironment.tolerance;
     this.selectionCombineMode     = toolEnvironment.selectionCombineMode;
     this.floodMode                = toolEnvironment.floodMode;
     this.selectionDrawModeInfo    = toolEnvironment.selectionDrawModeInfo.Clone();
     PerformAllChanged();
 }
示例#12
0
        /// <summary>
        /// 新增线路坡度表
        /// </summary>
        /// <param name="dao">数据对象</param>
        /// <returns>成功/失败</returns>
        public bool Insert(GradientInfo dao)
        {
            bool ret = false;

            try
            {
                Session.Open();
                Session.BeginTransaction();
                ret = _dal.Insert(dao);
                Session.CommitTransaction();
            }
            catch (Exception err)
            {
                ret = false;
                Log.Error(dao, err);
                Session.RollBackTransaction();
            }
            finally
            {
                Session.Close();
            }
            return(ret);
        }
示例#13
0
        /// <summary>
        /// 获取指定的IDataReader中的GradientInfo
        /// </summary>
        /// <param name="reader">IDataReader对象</param>
        /// <param name="dao">GradientInfo实体类</param>
        public void DataReaderToEntity(IDataReader reader, GradientInfo dao)
        {
            object data;

            data = reader["ID"];
            if (data == null || data == DBNull.Value)
            {
                dao.ID = int.MinValue;
            }
            else
            {
                dao.ID = int.Parse(data.ToString());
            }
            data = reader["GroupID"];
            if (data == null || data == DBNull.Value)
            {
                dao.GroupID = Guid.NewGuid();
            }
            else
            {
                dao.GroupID = Guid.Parse(data.ToString());
            }
            data = reader["StartStationName"];
            if (data == null || data == DBNull.Value)
            {
                dao.StartStationName = null;
            }
            else
            {
                dao.StartStationName = data.ToString();
            }
            data = reader["EndStationName"];
            if (data == null || data == DBNull.Value)
            {
                dao.EndStationName = null;
            }
            else
            {
                dao.EndStationName = data.ToString();
            }
            data = reader["Category"];
            if (data == null || data == DBNull.Value)
            {
                dao.Category = int.MinValue;
            }
            else
            {
                dao.Category = int.Parse(data.ToString());
            }
            data = reader["Gradient"];
            if (data == null || data == DBNull.Value)
            {
                dao.Gradient = decimal.MinValue;
            }
            else
            {
                dao.Gradient = decimal.Parse(data.ToString());
            }
            data = reader["Length"];
            if (data == null || data == DBNull.Value)
            {
                dao.Length = int.MinValue;
            }
            else
            {
                dao.Length = int.Parse(data.ToString());
            }
            data = reader["EndMileage"];
            if (data == null || data == DBNull.Value)
            {
                dao.EndMileage = null;
            }
            else
            {
                dao.EndMileage = data.ToString();
            }
            data = reader["Remark"];
            if (data == null || data == DBNull.Value)
            {
                dao.Remark = null;
            }
            else
            {
                dao.Remark = data.ToString();
            }
        }
示例#14
0
 /// <summary>
 /// 获取指定的数据行DataRow转换成GradientInfo
 /// </summary>
 /// <param name="dr">DataRow数据</param>
 /// <param name="dao">GradientInfo实体类</param>
 public void DataRowToEntity(DataRow dr, GradientInfo dao)
 {
     if (dr["ID"] == null || dr["ID"] == DBNull.Value)
     {
         dao.ID = int.MinValue;
     }
     else
     {
         dao.ID = int.Parse(dr["ID"].ToString());
     }
     if (dr["GroupID"] == null || dr["GroupID"] == DBNull.Value)
     {
         dao.GroupID = Guid.NewGuid();
     }
     else
     {
         dao.GroupID = Guid.Parse(dr["GroupID"].ToString());
     }
     if (dr["StartStationName"] == null || dr["StartStationName"] == DBNull.Value)
     {
         dao.StartStationName = null;
     }
     else
     {
         dao.StartStationName = dr["StartStationName"].ToString();
     }
     if (dr["EndStationName"] == null || dr["EndStationName"] == DBNull.Value)
     {
         dao.EndStationName = null;
     }
     else
     {
         dao.EndStationName = dr["EndStationName"].ToString();
     }
     if (dr["Category"] == null || dr["Category"] == DBNull.Value)
     {
         dao.Category = int.MinValue;
     }
     else
     {
         dao.Category = int.Parse(dr["Category"].ToString());
     }
     if (dr["Gradient"] == null || dr["Gradient"] == DBNull.Value)
     {
         dao.Gradient = decimal.MinValue;
     }
     else
     {
         dao.Gradient = decimal.Parse(dr["Gradient"].ToString());
     }
     if (dr["Length"] == null || dr["Length"] == DBNull.Value)
     {
         dao.Length = int.MinValue;
     }
     else
     {
         dao.Length = int.Parse(dr["Length"].ToString());
     }
     if (dr["EndMileage"] == null || dr["EndMileage"] == DBNull.Value)
     {
         dao.EndMileage = null;
     }
     else
     {
         dao.EndMileage = dr["EndMileage"].ToString();
     }
     if (dr["Remark"] == null || dr["Remark"] == DBNull.Value)
     {
         dao.Remark = null;
     }
     else
     {
         dao.Remark = dr["Remark"].ToString();
     }
 }