diff --git a/Bin/Debug/VSoft/UserDb/Setting.xml b/Bin/Debug/VSoft/UserDb/Setting.xml
index db7fd3a..3c49682 100644
--- a/Bin/Debug/VSoft/UserDb/Setting.xml
+++ b/Bin/Debug/VSoft/UserDb/Setting.xml
@@ -1,3 +1,3 @@
-
+
\ No newline at end of file
diff --git a/Bin/Debug/VSoft/UserDb/Softs.dat b/Bin/Debug/VSoft/UserDb/Softs.dat
index f600768..a51fdb4 100644
Binary files a/Bin/Debug/VSoft/UserDb/Softs.dat and b/Bin/Debug/VSoft/UserDb/Softs.dat differ
diff --git a/Bin/Debug/VSoft/UserDb/Win.dat b/Bin/Debug/VSoft/UserDb/Win.dat
index 0279e4a..e3f71fb 100644
--- a/Bin/Debug/VSoft/UserDb/Win.dat
+++ b/Bin/Debug/VSoft/UserDb/Win.dat
@@ -1,4 +1,4 @@
[VSoft]
hwnd=2889742
-width=742
-height=572
+width=738
+height=564
diff --git a/Bin/Debug/VSoft/VSoft.dll b/Bin/Debug/VSoft/VSoft.dll
index a599114..33a3ed5 100644
Binary files a/Bin/Debug/VSoft/VSoft.dll and b/Bin/Debug/VSoft/VSoft.dll differ
diff --git a/Bin/Debug/VSoft/VSoftBox.exe b/Bin/Debug/VSoft/VSoftBox.exe
index ce4f3b1..a225bc4 100644
Binary files a/Bin/Debug/VSoft/VSoftBox.exe and b/Bin/Debug/VSoft/VSoftBox.exe differ
diff --git a/Bin/Debug/VSoft/cUpdate.dat b/Bin/Debug/VSoft/cUpdate.dat
index 728368d..b0d51bb 100644
--- a/Bin/Debug/VSoft/cUpdate.dat
+++ b/Bin/Debug/VSoft/cUpdate.dat
@@ -1,3 +1,3 @@
-
+
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 16a8d5e..206b8be 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,11 @@
### 2020-12-27 dev更新
------
+#### VSoft V1.0.2012.2702
+- *.[修复]修复按热键或鼠标显示主界面,有时无法获得焦点的BUG。
+- *.[改进]默认分类支持删除。
+
+### 2020-12-27 dev更新
+------
#### VSoft V1.0.2012.2701
- *.[新增]新增支持通过双击鼠标中键、侧键的方式来显示主界面。
- *.[改进]当多次最小化后,不再显示最小化通知。
diff --git a/Source/.vs/VSoft/v16/.suo b/Source/.vs/VSoft/v16/.suo
index 8f0e1cd..f597a9f 100644
Binary files a/Source/.vs/VSoft/v16/.suo and b/Source/.vs/VSoft/v16/.suo differ
diff --git a/Source/VSoftBox/Properties/AssemblyInfo.cs b/Source/VSoftBox/Properties/AssemblyInfo.cs
index 6521475..92c8a8d 100644
--- a/Source/VSoftBox/Properties/AssemblyInfo.cs
+++ b/Source/VSoftBox/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.2012.2701")]
-[assembly: AssemblyFileVersion("1.0.2012.2701")]
\ No newline at end of file
+[assembly: AssemblyVersion("1.0.2012.2702")]
+[assembly: AssemblyFileVersion("1.0.2012.2702")]
\ No newline at end of file
diff --git a/Source/VSoft_Dll/FrmAddColumn.cs b/Source/VSoft_Dll/FrmAddColumn.cs
index 309fbc9..2641056 100644
--- a/Source/VSoft_Dll/FrmAddColumn.cs
+++ b/Source/VSoft_Dll/FrmAddColumn.cs
@@ -57,6 +57,7 @@ namespace VSoft
mySQL.AddField("Name", TxtName.Text);
mySQL.AddField("Des", TxtDes.Text);
mySQL.AddField("editTime", DateTime.Now);
+ DataProvider mydb = new DataProvider();
IDbInterface db = Itrycn_Db.CreateDataProvider(Itrycn_Db.dataType);
if (db.ConnDb(SQLConnStr) == 1)
{
@@ -64,7 +65,19 @@ namespace VSoft
{
mySQL.AddField("sortindex", Itrycn_Db.GetColumnCount(db, 0) + 1);
mySQL.AddField("addTime", DateTime.Now);
- db.ExecuteNonQuery(mySQL.GetInsertSQL(), mySQL);
+ var ds= db.ReadData(mySQL.GetInsertSQL()+ ";select last_insert_rowid();", mySQL);
+ if(mydb.HaveData(ds))
+ {
+ var ParentId = mydb.GetValue(ds);
+ RyQuickSQL mySQL2 = new RyQuickSQL(tableName);
+ mySQL2.AddField("Name","默认分类");
+ mySQL2.AddField("Des", "");
+ mySQL2.AddField("editTime", DateTime.Now);
+ mySQL2.AddField("sortindex", Itrycn_Db.GetColumnCount(db, ParentId) + 1);
+ mySQL2.AddField("parentId", ParentId);
+ mySQL2.AddField("addTime", DateTime.Now);
+ db.ExecuteNonQuery(mySQL2.GetInsertSQL(), mySQL2);
+ }
}
else
{
diff --git a/Source/VSoft_Dll/FrmInCMD.cs b/Source/VSoft_Dll/FrmInCMD.cs
index d7fb9e1..7e31054 100644
--- a/Source/VSoft_Dll/FrmInCMD.cs
+++ b/Source/VSoft_Dll/FrmInCMD.cs
@@ -248,6 +248,7 @@ namespace VSoft
private void BtnAddColumn_Click(object sender, EventArgs e)
{
FrmAddColumn frm = new FrmAddColumn();
+ frm.TopMost = TopMost;
frm.SQLConnStr = SQLConnStr;
if (frm.ShowDialog() == DialogResult.OK)
{
@@ -278,6 +279,7 @@ namespace VSoft
if (TabList_Column.SelectedItems.Count == 0) { return; }
var info = (ColumnInfo)TabList_Column.SelectedItems[0].Tag;
FrmAddColumn frm = new FrmAddColumn();
+ frm.TopMost = TopMost;
frm.SQLConnStr = SQLConnStr;
frm.IsAdd = 0;
frm.GetInfo(info.Id);
@@ -370,7 +372,8 @@ namespace VSoft
FrmAddType frm = new FrmAddType
{
ParentId = id,
- SQLConnStr = SQLConnStr
+ SQLConnStr = SQLConnStr,
+ TopMost=TopMost
};
if (frm.ShowDialog() == DialogResult.OK)
{
@@ -417,7 +420,8 @@ namespace VSoft
FrmAddType frm = new FrmAddType
{
IsAdd = 0,
- SQLConnStr = SQLConnStr
+ SQLConnStr = SQLConnStr,
+ TopMost=TopMost
};
frm.GetInfo(info.Id);
if (frm.ShowDialog() == DialogResult.OK)
@@ -520,7 +524,8 @@ namespace VSoft
FrmAddSoft frm = new FrmAddSoft
{
SQLConnStr = SQLConnStr,
- ColumnId = ColumnId
+ ColumnId = ColumnId,
+ TopMost=TopMost
};
if (frm.ShowDialog() == DialogResult.OK)
{
@@ -536,7 +541,8 @@ namespace VSoft
{
SelectId = info.Id,
SQLConnStr = SQLConnStr,
- IsAdd = 0
+ IsAdd = 0,
+ TopMost=TopMost
};
frm.GetInfo(info.Id);
if (frm.ShowDialog() == DialogResult.OK)
@@ -1106,7 +1112,8 @@ namespace VSoft
FrmAddSoft frm = new FrmAddSoft
{
SQLConnStr = SQLConnStr,
- ColumnId = ColumnId
+ ColumnId = ColumnId,
+ TopMost=TopMost
};
frm.GetInfo(info.Id);
frm.Text = "复制并新增软件";
diff --git a/Source/VSoft_Dll/FrmVSoft.cs b/Source/VSoft_Dll/FrmVSoft.cs
index 33e8538..844835a 100644
--- a/Source/VSoft_Dll/FrmVSoft.cs
+++ b/Source/VSoft_Dll/FrmVSoft.cs
@@ -141,6 +141,7 @@ namespace VSoft
private void LoadColumn()
{
TabList_Column.Items.Clear();
+ DataProvider mydb = new DataProvider();
IDbInterface db = Itrycn_Db.CreateDataProvider(Itrycn_Db.dataType);
if (db.ConnDb(SQLConnStr) == 1)
{
@@ -160,7 +161,20 @@ namespace VSoft
mySQL.AddField("sortindex", 1);
mySQL.AddField("parentId", 0);
mySQL.AddField("addTime", DateTime.Now);
- db.ExecuteNonQuery(mySQL.GetInsertSQL(), mySQL);
+ var ds_c = db.ReadData(mySQL.GetInsertSQL() + ";select last_insert_rowid();", mySQL);
+ if (mydb.HaveData(ds_c))
+ {
+ var ParentId = mydb.GetValue(ds_c);
+ RyQuickSQL mySQL2 = new RyQuickSQL("Columns");
+ mySQL2.AddField("Name", "默认分类");
+ mySQL2.AddField("Des", "");
+ mySQL2.AddField("editTime", DateTime.Now);
+ mySQL2.AddField("sortindex", Itrycn_Db.GetColumnCount(db, ParentId) + 1);
+ mySQL2.AddField("parentId", ParentId);
+ mySQL2.AddField("addTime", DateTime.Now);
+ db.ExecuteNonQuery(mySQL2.GetInsertSQL(), mySQL2);
+ }
+ ds_c.Dispose();
DataSet ds2 = db.ReadData("select * from Columns where parentId=0 order by sortindex asc");
for (int i = 0; i < ds2.Tables[0].Rows.Count; i++)
{
@@ -182,7 +196,7 @@ namespace VSoft
private void LoadTypeColumn(int id)
{
TabList_Type.Items.Clear();
- TabList_Type.Items.Add("默认分类").Tag = 0;
+ //TabList_Type.Items.Add("默认分类").Tag = 0;
IDbInterface db = Itrycn_Db.CreateDataProvider(Itrycn_Db.dataType);
if (db.ConnDb(SQLConnStr) == 1)
{
@@ -209,6 +223,51 @@ namespace VSoft
LblEmpty.Left =((panelEx1.Width - LblEmpty.Width) / 2);
Config.Soft_Info.UserDataFolder = ryCommon.RyFiles.GetRealPath(Config.Soft_Info.UserDataFolder);
VSoft.Prams.Itrycn_Db.CreateTable();
+ var dbver = Itrycn_Db.GetDbVer();
+ if (dbver == 2) //当前要求的数据库
+ {
+
+ }
+ else //不是符合的数据库
+ {
+ DataProvider mydb = new DataProvider();
+ IDbInterface db = Itrycn_Db.CreateDataProvider(Itrycn_Db.dataType);
+ if (db.ConnDb(SQLConnStr) == 1)
+ {
+ if (dbver == 1)
+ {
+ DataSet ds = db.ReadData("select * from Columns where parentId=0 order by sortindex asc");
+ for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
+ {
+ DataRow row = ds.Tables[0].Rows[i];
+ #region 新建一个默认分类
+ RyQuickSQL mySQL2 = new RyQuickSQL("Columns");
+ mySQL2.AddField("Name", "默认分类");
+ mySQL2.AddField("Des", "");
+ mySQL2.AddField("editTime", DateTime.Now);
+ mySQL2.AddField("sortindex", Itrycn_Db.GetColumnCount(db, row["id"].ToInt()) + 1);
+ mySQL2.AddField("parentId", row["id"].ToInt());
+ mySQL2.AddField("addTime", DateTime.Now);
+ var ds_id = db.ReadData(mySQL2.GetInsertSQL() + ";select last_insert_rowid();", mySQL2);
+ var type_id = mydb.GetValue(ds_id);
+ #endregion
+ RyQuickSQL mySQL3 = new RyQuickSQL("Softs");
+ mySQL3.AddField("ColumnId", type_id);//将直属分类修改为默认分类
+ db.ExecuteNonQuery(mySQL3.GetUpdateSQL()+ " where ColumnId="+ row["id"].ToInt(), mySQL3);
+ }
+ ds.Dispose();
+ Itrycn_Db.SetDbVer(2);
+ }
+ else
+ {
+ db.Free();
+ MessageBox.Show("不支持当前数据库版本,这可能是以下原因导致的:\r\n1.数据库已损坏;'\r\n2.当前数据库是由新版软件创建的(请更新软件后重试)。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ Application.Exit();
+ return;
+ }
+ }
+ db.Free();
+ }
VSoft.Config.Soft_Config.LoadSetting();
LoadColumn();
//rySearch1.PerformClick();
@@ -246,6 +305,8 @@ namespace VSoft
break;
}
}
+ [System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "SetForegroundWindow")]
+ public static extern bool SetF(IntPtr hWnd); //设置此窗体为活动窗体
///
/// 显示或隐藏UI
///
@@ -257,12 +318,30 @@ namespace VSoft
}
else
{
- 显示主窗体ToolStripMenuItem.PerformClick();
+ this.WindowState = FormWindowState.Normal;
+ var topmost = this.TopMost;
+ this.TopMost = true;
+ this.Show();
+ //this.TopMost = topmost;
this.BringToFront();
this.Select();
this.Focus();
- RyForm.BringToTop(Handle);
+ //RyForm.BringToTop(Handle);
+ RyForm.SetActiveWindow(Handle);
+ //this.TopMost = topmost;
rySearch1.Focus();
+ using (var bg = new BackgroundWorker())
+ {
+ bg.DoWork += delegate { System.Threading.Thread.Sleep(100); };//1秒后
+ bg.RunWorkerCompleted += delegate {
+ this.Invoke(new Action(() =>
+ {
+ this.TopMost = topmost;
+ SetF(Handle);
+ }));
+ }; // 线程执行完成后会执行 RunWorkerCompleted 事伯的代码块
+ bg.RunWorkerAsync();
+ }
}
}
protected override void WndProc(ref System.Windows.Forms.Message msg)
@@ -340,6 +419,7 @@ namespace VSoft
private void BtnAddColumn_Click(object sender, EventArgs e)
{
FrmAddColumn frm = new FrmAddColumn();
+ frm.TopMost = TopMost;
if (frm.ShowDialog() == DialogResult.OK)
{
IDbInterface db = Itrycn_Db.CreateDataProvider(Itrycn_Db.dataType);
@@ -362,6 +442,7 @@ namespace VSoft
{
if (TabList_Column.SelectedItems.Count == 0) { return; }
FrmAddColumn frm = new FrmAddColumn();
+ frm.TopMost = TopMost;
frm.IsAdd = 0;
frm.GetInfo(TabList_Column.SelectedItems[0].Tag.ToInt());
if (frm.ShowDialog() == DialogResult.OK)
@@ -447,6 +528,7 @@ namespace VSoft
}
var id = TabList_Column.SelectedItems[0].Tag.ToInt();
FrmAddType frm = new FrmAddType();
+ frm.TopMost = TopMost;
frm.ParentId = id;
if (frm.ShowDialog() == DialogResult.OK)
{
@@ -485,6 +567,7 @@ namespace VSoft
return;
}
FrmAddType frm = new FrmAddType();
+ frm.TopMost = TopMost;
frm.IsAdd = 0;
frm.GetInfo(id);
if (frm.ShowDialog() == DialogResult.OK)
@@ -603,6 +686,7 @@ namespace VSoft
return;
}
FrmAddSoft frm = new FrmAddSoft();
+ frm.TopMost = TopMost;
frm.ColumnId = ColumnId;
if (frm.ShowDialog() == DialogResult.OK)
{
@@ -615,6 +699,7 @@ namespace VSoft
if (IconViewEx1.SelectedItems.Count == 0) { return; }
var info = (SoftInfo)IconViewEx1.SelectedItems[0].Tag;
FrmAddSoft frm = new FrmAddSoft();
+ frm.TopMost = TopMost;
frm.SelectId = info.Id;
frm.IsAdd = 0;
frm.GetInfo(info.Id);
@@ -785,10 +870,15 @@ namespace VSoft
{
if (TabList_Column.SelectedItems.Count > 0)
{
- ColumnId = TabList_Column.SelectedItems[0].Tag.ToInt();
+ IDbInterface db2 = Itrycn_Db.CreateDataProvider(Itrycn_Db.dataType);
+ if (db2.ConnDb(SQLConnStr) == 1)
+ {
+ ColumnId = Itrycn_Db.GetFirstColumnId(db2, TabList_Column.SelectedItems[0].Tag.ToInt());
+ }
+ db2.Free();
}
}
- if(ColumnId==0)
+ if(ColumnId<=0)
{
MessageBox.Show("当前模式下不支持添加软件。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
@@ -906,21 +996,22 @@ namespace VSoft
{
#region 从软件列表里拖放
var info = (SoftInfo)lvi.Tag;
- RyQuickSQL mySQL = new RyQuickSQL("Softs");
- mySQL.AddField("ColumnId", columnid);
- mySQL.AddField("editTime", DateTime.Now);
IDbInterface db = Itrycn_Db.CreateDataProvider(Itrycn_Db.dataType);
if (db.ConnDb(SQLConnStr) == 1)
{
- mySQL.AddField("sortindex", Itrycn_Db.GetSoftCount(db, columnid) + 1);
+ var id = Itrycn_Db.GetFirstColumnId(db, columnid);
+ if(id<=0)
+ {
+ return;
+ }
+ RyQuickSQL mySQL = new RyQuickSQL("Softs");
+ mySQL.AddField("ColumnId", id);
+ mySQL.AddField("editTime", DateTime.Now);
+ mySQL.AddField("sortindex", Itrycn_Db.GetSoftCount(db, id) + 1);
db.ExecuteNonQuery(mySQL.GetUpdateSQL() + " where id=" + info.Id, mySQL);
if (TabList_Column.SelectedItems.Count > 0)
{
- if (TabList_Column.SelectedItems[0].Tag.ToInt() != columnid)
- {
- lvi.Remove();
- }
- else if (TabList_Type.SelectedItems.Count > 0 && TabList_Type.SelectedItems[0].Tag.ToInt() > 0)
+ if (TabList_Type.SelectedItems.Count > 0 && TabList_Type.SelectedItems[0].Tag.ToInt() > 0 && TabList_Type.SelectedItems[0].Tag.ToInt()!=id)
{
lvi.Remove();
}
@@ -987,10 +1078,7 @@ namespace VSoft
var columnid = item.Tag.ToInt();
if (columnid == 0)
{
- if (TabList_Column.SelectedItems.Count>0)
- {
- columnid = TabList_Column.SelectedItems[0].Tag.ToInt();
- }
+ return;
}
//获得拖放中的项
var drag_item = e.Data.GetData(typeof(ListViewItem));
@@ -1023,7 +1111,7 @@ namespace VSoft
}
else if (lvi.ListView == TabList_Type)
{
- if (lvi.Index == item.Index || item.Index==0 || lvi.Index==0) { return; }
+ if (lvi.Index == item.Index) { return; }
TabList_Type.BeginUpdate();
TabList_Type.View = View.List;
TabList_Type.Items.RemoveAt(lvi.Index);
@@ -1034,11 +1122,11 @@ namespace VSoft
if (db.ConnDb(SQLConnStr) == 1)
{
db.BeginTransaction();
- for (int i = 1; i < TabList_Type.Items.Count; i++)
+ for (int i = 0; i < TabList_Type.Items.Count; i++)
{
var id = TabList_Type.Items[i].Tag.ToInt();
RyQuickSQL mySQL = new RyQuickSQL("Columns");
- mySQL.AddField("sortindex", i);
+ mySQL.AddField("sortindex", i+1);
db.ExecuteNonQuery(mySQL.GetUpdateSQL() + " where id=" +id, mySQL);
}
db.Commit();
@@ -1111,6 +1199,7 @@ namespace VSoft
if (Config.Soft_Info.DonateVisabled)
{
FrmAbout frm = new FrmAbout();
+ frm.TopMost = TopMost;
frm.ShowDialog();
frm.Dispose();
}
@@ -1124,7 +1213,8 @@ namespace VSoft
{
hotkey.Enabled = false;
FrmSetting frm = new FrmSetting();
- if(frm.ShowDialog()==DialogResult.OK)
+ frm.TopMost = TopMost;
+ if (frm.ShowDialog()==DialogResult.OK)
{
VSoft.Config.Soft_Config.LoadSetting();
hotkey.UnHotKey();
@@ -1209,7 +1299,7 @@ namespace VSoft
TabList_Column.SelectedStartBackColor = Color.LightYellow;
using (var bg = new BackgroundWorker())
{
- bg.DoWork += delegate { System.Threading.Thread.Sleep(500); };//180秒后,3分钟
+ bg.DoWork += delegate { System.Threading.Thread.Sleep(500); };//0.5秒
bg.RunWorkerCompleted += delegate {
this.Invoke(new Action(() =>
{
@@ -1238,19 +1328,13 @@ namespace VSoft
ColumnId = TabList_Type.SelectedItems[0].Tag.ToInt();
}
if (ColumnId == 0)
- {
- if (TabList_Column.SelectedItems.Count > 0)
- {
- ColumnId = TabList_Column.SelectedItems[0].Tag.ToInt();
- }
- }
- if (ColumnId == 0)
{
MessageBox.Show("当前模式下不支持添加软件。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
FrmInCMD frm = new FrmInCMD();
- if(frm.ShowDialog()==DialogResult.OK)
+ frm.TopMost = TopMost;
+ if (frm.ShowDialog()==DialogResult.OK)
{
var info = frm.SelectedInfo;
RyQuickSQL mySQL = new RyQuickSQL("Softs");
@@ -1308,16 +1392,8 @@ namespace VSoft
}
else
{
- if (TabList_Type.SelectedItems[0].Index == 0)
- {
- Menu修改分类.Enabled = false;
- Menu删除分类.Enabled = false;
- }
- else
- {
- Menu修改分类.Enabled = true;
- Menu删除分类.Enabled = true;
- }
+ Menu修改分类.Enabled = true;
+ Menu删除分类.Enabled = true;
}
}
diff --git a/Source/VSoft_Dll/Prams/Itrycn_Db.cs b/Source/VSoft_Dll/Prams/Itrycn_Db.cs
index b998cca..b69e9ea 100644
--- a/Source/VSoft_Dll/Prams/Itrycn_Db.cs
+++ b/Source/VSoft_Dll/Prams/Itrycn_Db.cs
@@ -36,7 +36,7 @@ namespace VSoft.Prams
///
///
///
- public static void SetSetting(string _SQLConnStr, string name, string value)
+ public static int SetSetting(string _SQLConnStr, string name, string value)
{
IDbInterface db = CreateDataProvider(dataType);
if (db.ConnDb(_SQLConnStr) == 1)
@@ -44,21 +44,24 @@ namespace VSoft.Prams
RyQuickSQL mySQL = new RyQuickSQL("Setting");
mySQL.AddField("sName", name);
mySQL.AddField("sValue", value);
- if (db.ExecuteNonQuery(mySQL.GetUpdateSQL() + " where sName=@sName", mySQL) == 0)
+ var result = db.ExecuteNonQuery(mySQL.GetUpdateSQL() + " where sName=@sName", mySQL);
+ if (result == 0)
{
- db.ExecuteNonQuery(mySQL.GetInsertSQL(), mySQL);
+ result = db.ExecuteNonQuery(mySQL.GetInsertSQL(), mySQL);
}
+ return result;
}
db.Free();
+ return -1000;
}
///
/// 写入设置
///
///
///
- public static void SetSetting(string name, string value)
+ public static int SetSetting(string name, string value)
{
- SetSetting(SQLConnStr, name, value);
+ return SetSetting(SQLConnStr, name, value);
}
///
/// 读取设置
@@ -109,6 +112,40 @@ namespace VSoft.Prams
ds.Dispose();
return icount;
}
+ ///
+ /// 获取指定栏目的第一个分类id
+ ///
+ ///
+ ///
+ ///
+ public static int GetFirstColumnId(IDbInterface db, int ColumnId)
+ {
+ var ds = db.ReadData("select id from Columns where parentId=" + ColumnId+ " order by sortindex asc limit 1");
+ if (ds.Tables[0].Rows.Count == 0)
+ { return -1; }
+ else
+ {
+ var icount = ds.Tables[0].Rows[0][0].ToInt();
+ ds.Dispose();
+ return icount;
+ }
+ }
+ ///
+ /// 获取数据库版本
+ ///
+ ///
+ public static int GetDbVer()
+ {
+ return GetSetting("dbVer", "1").ToInt();
+ }
+ ///
+ /// 设置数据库版本
+ ///
+ ///
+ public static int SetDbVer(int DbVer)
+ {
+ return SetSetting("dbVer", DbVer.ToString());
+ }
public static void CreateTable(DataProvider.DataProviderType dataType, string ConnStr)
{
IDbInterface db = CreateDataProvider(dataType);
diff --git a/Source/VSoft_Dll/Properties/AssemblyInfo.cs b/Source/VSoft_Dll/Properties/AssemblyInfo.cs
index 595f001..c924df2 100644
--- a/Source/VSoft_Dll/Properties/AssemblyInfo.cs
+++ b/Source/VSoft_Dll/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.2012.2701")]
-[assembly: AssemblyFileVersion("1.0.2012.2701")]
\ No newline at end of file
+[assembly: AssemblyVersion("1.0.2012.2702")]
+[assembly: AssemblyFileVersion("1.0.2012.2702")]
\ No newline at end of file
diff --git a/Source/VSoft_Dll/TabList.cs b/Source/VSoft_Dll/TabList.cs
index 1f26748..3d079ed 100644
--- a/Source/VSoft_Dll/TabList.cs
+++ b/Source/VSoft_Dll/TabList.cs
@@ -1,98 +1,98 @@
-using System.ComponentModel;
-using System.Drawing;
+using System.ComponentModel;
+using System.Drawing;
using System.Drawing.Drawing2D;
-using System.Windows.Forms;
-
-namespace ryControls
-{
- public class TabList : ListView
- {
- private ColumnHeader columnHeader1;
-
- public TabList() :
- base()
- {
- this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
- this.OwnerDraw = true;//用于启用重绘
- this.View = View.Tile;
- this.TileSize = new Size(80,28);
- this.Scrollable = false;
- this.MultiSelect = false;
- }
-
- ///
- /// 图标
- ///
- public Image Icon { get; set; }
-
- ///
- /// 重绘图标
- ///
- public bool IsDrawIcon { get; set; }
-
- ///
- /// 重绘网格线
- ///
- public bool IsDrawGridLines { get; set; }
- private int last_selectIndex = 0;
- protected override void OnMouseUp(MouseEventArgs e)
- {
- var pt = this.PointToClient(e.Location);
- var item = this.GetItemAt(pt.X, pt.Y);
- if (item == null)
- {
- if (last_selectIndex < this.Items.Count)
- {
- this.Items[last_selectIndex].Selected = true;
- }
- }
- }
- protected override void OnItemSelectionChanged(ListViewItemSelectionChangedEventArgs e)
- {
- if(e.IsSelected)
- {
- last_selectIndex = e.ItemIndex;
- base.OnItemSelectionChanged(e);
- }
- else
- {
- if ( last_selectIndex < this.Items.Count)
- {
- //this.Items[last_selectIndex].Selected = true;
- }
- }
- }
- protected override void OnSelectedIndexChanged(System.EventArgs e)
- {
- if(this.SelectedItems.Count>0)
- {
- base.OnSelectedIndexChanged(e);
- }
- else
- {
-
- }
- }
- protected override void OnDrawItem(DrawListViewItemEventArgs e)
- {
- Rectangle r = e.Bounds;
- Graphics g = e.Graphics;
-
- DrawSelectedBackground(e, g, r);
-
- //if (IsDrawGridLines)
- //{
- // using (Pen pen = new Pen(Color.Gray))
- // {
- // g.DrawRectangle(pen, r.X, r.Y, r.Width, r.Height + 1);//高度加1使横向线条重叠
- // }
- //}
-
- if (!string.IsNullOrEmpty(e.Item.Text))
- {
- this.DrawText(e, g, r);
- }
- }
+using System.Windows.Forms;
+
+namespace ryControls
+{
+ public class TabList : ListView
+ {
+ private ColumnHeader columnHeader1;
+
+ public TabList() :
+ base()
+ {
+ this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
+ this.OwnerDraw = true;//用于启用重绘
+ this.View = View.Tile;
+ this.TileSize = new Size(80,28);
+ this.Scrollable = false;
+ this.MultiSelect = false;
+ }
+
+ ///
+ /// 图标
+ ///
+ public Image Icon { get; set; }
+
+ ///
+ /// 重绘图标
+ ///
+ public bool IsDrawIcon { get; set; }
+
+ ///
+ /// 重绘网格线
+ ///
+ public bool IsDrawGridLines { get; set; }
+ private int last_selectIndex = 0;
+ protected override void OnMouseUp(MouseEventArgs e)
+ {
+ var pt = this.PointToClient(e.Location);
+ var item = this.GetItemAt(pt.X, pt.Y);
+ if (item == null)
+ {
+ if (last_selectIndex < this.Items.Count)
+ {
+ this.Items[last_selectIndex].Selected = true;
+ }
+ }
+ }
+ protected override void OnItemSelectionChanged(ListViewItemSelectionChangedEventArgs e)
+ {
+ if(e.IsSelected)
+ {
+ last_selectIndex = e.ItemIndex;
+ base.OnItemSelectionChanged(e);
+ }
+ else
+ {
+ if ( last_selectIndex < this.Items.Count)
+ {
+ //this.Items[last_selectIndex].Selected = true;
+ }
+ }
+ }
+ protected override void OnSelectedIndexChanged(System.EventArgs e)
+ {
+ if(this.SelectedItems.Count>0)
+ {
+ base.OnSelectedIndexChanged(e);
+ }
+ else
+ {
+
+ }
+ }
+ protected override void OnDrawItem(DrawListViewItemEventArgs e)
+ {
+ Rectangle r = e.Bounds;
+ Graphics g = e.Graphics;
+
+ DrawSelectedBackground(e, g, r);
+
+ //if (IsDrawGridLines)
+ //{
+ // using (Pen pen = new Pen(Color.Gray))
+ // {
+ // g.DrawRectangle(pen, r.X, r.Y, r.Width, r.Height + 1);//高度加1使横向线条重叠
+ // }
+ //}
+
+ if (!string.IsNullOrEmpty(e.Item.Text))
+ {
+ this.DrawText(e, g, r);
+ }
+ }
private Color _SelectedStartBackColor = Color.LightSkyBlue;
///
/// 选择项的背景开始颜色
@@ -143,8 +143,8 @@ namespace ryControls
_SelectedBorderColor = value;
this.Refresh();
}
- }
- private Color _SelectedForeColor = Color.Black;
+ }
+ private Color _SelectedForeColor = Color.Black;
///
/// 选择项的字体颜色
///
@@ -160,120 +160,120 @@ namespace ryControls
_SelectedForeColor = value;
this.Refresh();
}
- }
- ///
- /// 重绘选中时背景
- ///
- private void DrawSelectedBackground(DrawListViewItemEventArgs e, Graphics g, Rectangle r)
- {
- if (e.Item.Selected)
+ }
+ ///
+ /// 重绘选中时背景
+ ///
+ private void DrawSelectedBackground(DrawListViewItemEventArgs e, Graphics g, Rectangle r)
+ {
+ if (e.Item.Selected)
{
//渐变画刷
- LinearGradientBrush brush = new LinearGradientBrush(e.Bounds, _SelectedStartBackColor,
- _SelectedEndBackColor, LinearGradientMode.Vertical);
- //填充区域
- //Rectangle borderRect = new Rectangle(r, e.Bounds.Y, e.Bounds.Width - 5, e.Bounds.Height - 2);
- e.Graphics.FillRectangle(brush, r);
- brush.Dispose();
- ////画边框
- Pen pen = new Pen(_SelectedBorderColor);
- Rectangle borderRect = r;
- borderRect.Width--;
- borderRect.Height--;
- e.Graphics.DrawRectangle(pen, borderRect);
- pen.Dispose();
- //using (SolidBrush brush = new SolidBrush(_SelectedBackColor))
- //{
- // g.FillRectangle(brush, r);
- //}
- }
- }
-
- ///
- /// 重绘图标
- ///
- private Size DrawIcon(Graphics g, Rectangle r, Image image, Color backColor)
- {
- Rectangle imageBounds = new Rectangle(new Point(r.X+10, r.Y+3), new Size(64,64));
- if (r.Width > r.Height-20)
- {
- imageBounds.Width = r.Height-20;
- imageBounds.Height = r.Height - 20;
- }
- else
- {
- imageBounds.Width = r.Width - 20;
- imageBounds.Height = r.Width - 20;
- }
- imageBounds.X = r.X + (r.Width - imageBounds.Width) / 2;
- //使图标不会紧贴着每一列的左上角
- //imageBounds.X += 1;
- //imageBounds.Y += 1;
-
- g.DrawImage(image, imageBounds);
- return imageBounds.Size;
- }
-
- ///
- /// 重绘文本
- ///
- private void DrawText(DrawListViewItemEventArgs e, Graphics g, Rectangle r)
- {
- TextFormatFlags flags = GetFormatFlags(HorizontalAlignment.Center);
- TextRenderer.DrawText(
- g,
- e.Item.Text,
- e.Item.Font,
- r,
- e.Item.Selected?SelectedForeColor: e.Item.ForeColor,
- flags);
- }
-
- ///
- /// 获取文本对齐
- ///
- private TextFormatFlags GetFormatFlags(
- HorizontalAlignment align)
- {
- TextFormatFlags flags =
- TextFormatFlags.EndEllipsis |
- TextFormatFlags.VerticalCenter;
-
- switch (align)
- {
- case HorizontalAlignment.Center:
- flags |= TextFormatFlags.HorizontalCenter;
- break;
- case HorizontalAlignment.Right:
- flags |= TextFormatFlags.Right;
- break;
- case HorizontalAlignment.Left:
- flags |= TextFormatFlags.Left;
- break;
- }
-
- return flags;
- }
-
- private void InitializeComponent()
- {
- this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
- this.SuspendLayout();
- //
- // columnHeader1
- //
- this.columnHeader1.Width = 10;
- //
- // IconViewEx
- //
- this.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
- this.columnHeader1});
- this.LabelWrap = false;
- this.ShowItemToolTips = true;
- this.TileSize = new System.Drawing.Size(60, 60);
- this.View = System.Windows.Forms.View.Tile;
- this.ResumeLayout(false);
-
- }
- }
+ LinearGradientBrush brush = new LinearGradientBrush(e.Bounds, _SelectedStartBackColor,
+ _SelectedEndBackColor, LinearGradientMode.Vertical);
+ //填充区域
+ //Rectangle borderRect = new Rectangle(r, e.Bounds.Y, e.Bounds.Width - 5, e.Bounds.Height - 2);
+ e.Graphics.FillRectangle(brush, r);
+ brush.Dispose();
+ ////画边框
+ Pen pen = new Pen(_SelectedBorderColor);
+ Rectangle borderRect = r;
+ borderRect.Width--;
+ borderRect.Height--;
+ e.Graphics.DrawRectangle(pen, borderRect);
+ pen.Dispose();
+ //using (SolidBrush brush = new SolidBrush(_SelectedBackColor))
+ //{
+ // g.FillRectangle(brush, r);
+ //}
+ }
+ }
+
+ ///
+ /// 重绘图标
+ ///
+ private Size DrawIcon(Graphics g, Rectangle r, Image image, Color backColor)
+ {
+ Rectangle imageBounds = new Rectangle(new Point(r.X+10, r.Y+3), new Size(64,64));
+ if (r.Width > r.Height-20)
+ {
+ imageBounds.Width = r.Height-20;
+ imageBounds.Height = r.Height - 20;
+ }
+ else
+ {
+ imageBounds.Width = r.Width - 20;
+ imageBounds.Height = r.Width - 20;
+ }
+ imageBounds.X = r.X + (r.Width - imageBounds.Width) / 2;
+ //使图标不会紧贴着每一列的左上角
+ //imageBounds.X += 1;
+ //imageBounds.Y += 1;
+
+ g.DrawImage(image, imageBounds);
+ return imageBounds.Size;
+ }
+
+ ///
+ /// 重绘文本
+ ///
+ private void DrawText(DrawListViewItemEventArgs e, Graphics g, Rectangle r)
+ {
+ TextFormatFlags flags = GetFormatFlags(HorizontalAlignment.Center);
+ TextRenderer.DrawText(
+ g,
+ e.Item.Text,
+ e.Item.Font,
+ r,
+ e.Item.Selected?SelectedForeColor: e.Item.ForeColor,
+ flags);
+ }
+
+ ///
+ /// 获取文本对齐
+ ///
+ private TextFormatFlags GetFormatFlags(
+ HorizontalAlignment align)
+ {
+ TextFormatFlags flags =
+ TextFormatFlags.EndEllipsis |
+ TextFormatFlags.VerticalCenter;
+
+ switch (align)
+ {
+ case HorizontalAlignment.Center:
+ flags |= TextFormatFlags.HorizontalCenter;
+ break;
+ case HorizontalAlignment.Right:
+ flags |= TextFormatFlags.Right;
+ break;
+ case HorizontalAlignment.Left:
+ flags |= TextFormatFlags.Left;
+ break;
+ }
+
+ return flags;
+ }
+
+ private void InitializeComponent()
+ {
+ this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.SuspendLayout();
+ //
+ // columnHeader1
+ //
+ this.columnHeader1.Width = 10;
+ //
+ // IconViewEx
+ //
+ this.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
+ this.columnHeader1});
+ this.LabelWrap = false;
+ this.ShowItemToolTips = true;
+ this.TileSize = new System.Drawing.Size(60, 60);
+ this.View = System.Windows.Forms.View.Tile;
+ this.ResumeLayout(false);
+
+ }
+ }
}
\ No newline at end of file