--------------------------------------------------------------------------------

1、父窗体Form1中调用子窗体Form2代码:

Form2 fr = new Form2();

this.hide();

fr.ShowDialog(this);

2、子窗体的FormClosed事件代码:

private void Form2_FormClosed(object sender, FormClosedEventArgs e)

{

Login login = (Login)this.Owner;

login.Dispose();

login.Close();

}

--------------------------------------------------------------------------------

winform无边框拖动窗体

private Point mPoint = new Point();

private void Form1_MouseDown(object sender, MouseEventArgs e)

{

mPoint.X = e.X;

mPoint.Y = e.Y;

}

private void Form1_MouseMove(object sender, MouseEventArgs e)

{

if (e.Button == MouseButtons.Left)

{

Point myPosittion = MousePosition;

myPosittion.Offset(-mPoint.X, -mPoint.Y);

Location = myPosittion;

}

}

--------------------------------------------------------------------------------

读取datatable 几种方法

,for (int i = ; i< dt.rows.count; i++)

{

    string strname = dt.rows[i]["字段名"].tostring();

}

, foreach(datarow myrow in mydataset.tables["temp"].rows)

{

    var str = myrow[].tostring();

}

,foreach(datarow dr in dt.rows)

{

    object value = dr["columnsname"];

}

,

Datatable.select("kymd>'2011-11-5' or kymd is null")

----------------------------------------------------------------------------------

datatable 合并

//前提:dt1和dt2表结构相同

foreach (DataRow dr in dt2.Rows)

dt1.Rows.Add(dr.ItemArray);

//绑定表格

dataGridView1.DataSource = dt1;

----------------------------------------------------------------------------------

修改datatable中的列名称

MyDt.Columns["xx"].ColumnName = "aa";

----------------------------------------------------------------------------------

用dictionary写键值对添加到datatable中 绑定combox显示值与属性值

//初始化下拉框值

Dictionary<string, string> dic = new Dictionary<string, string>();

dic.Add("气压", "AIRP");

dic.Add("气温", "ATMP");

dic.Add("湿度", "RHU");

dic.Add("降水", "ACCP");

dic.Add("风速", "WIN");

dic.Add("日照", "SSD");

dic.Add("地温", "GST");

dic.Add("蒸发", "ACCE");

DataTable dt = new DataTable();

dt.Columns.Add("key");

dt.Columns.Add("name");

foreach (var item in dic)

{

DataRow dr = dt.NewRow();

dr["key"] = item.Key;

dr["name"] = item.Value;

dt.Rows.Add(dr);

}

this.cmbType.DataSource = dt;

this.cmbType.DisplayMember = "key";

this.cmbType.ValueMember = "name";

----------------------------------------------------------------------------------

Dev

1、 如何解决单击记录整行选中的问题

View->OptionsBehavior->EditorShowMode 设置为:Click

4、如何让行只能选择而不能编辑(或编辑某一单元格)

(1)、View->OptionsBehavior->EditorShowMode 设置为:Click

(2)、View->OptionsBehavior->Editable 设置为:false

5、如何禁用 GridControl 中单击列弹出右键菜单

设置 Run Design->OptionsMenu->EnableColumnMenu 设置为:false

6、如何隐藏 GridControl 的 GroupPanel 表头

设置 Run Design->OptionsView->ShowGroupPanel 设置为:false

----------------------------------------------------------------------------------

Winfrom 与flash交互

//获取自定义事件

axShockwaveFlash1.FlashCall += new AxShockwaveFlashObjects._IShockwaveFlashEvents_FlashCallEventHandler(axShockwaveFlash1_FlashCall);

//鼠标点击弹出信息

public void axShockwaveFlash1_FlashCall(object sender, AxShockwaveFlashObjects._IShockwaveFlashEvents_FlashCallEvent e)

{

XmlDocument document = new XmlDocument();

document.LoadXml(e.request);

XmlAttributeCollection attributes = document.FirstChild.Attributes;

string command = attributes.Item().InnerText;

MessageBox.Show(command);

}

----------------------------------------------------------------------------------

WinForm设置全局皮肤 skin

//设置skin皮肤全局

string path = Application.StartupPath + @"\skin\Warm\WarmColor3.ssk";

se = new Sunisoft.IrisSkin.SkinEngine();

se.SkinAllForm = true;

se.SkinFile = path;

this.StartPosition = FormStartPosition.CenterScreen;

修改界面图标

string iconPath = Application.StartupPath + @"\image\a.ico";

this.Icon = new Icon(iconPath);

----------------------------------------------------------------------------------

Winform窗体淡入淡出效果

(百度来的)

[System.Runtime.InteropServices.DllImport("user32.dll")]

private static extern bool AnimateWindow(IntPtr whnd, int dwtime, int dwflag);

//dwflag的取值如下

public const Int32 AW_HOR_POSITIVE = 0x00000001;

//从左到右显示

public const Int32 AW_HOR_NEGATIVE = 0x00000002;

//从右到左显示

public const Int32 AW_VER_POSITIVE = 0x00000004;

//从上到下显示

public const Int32 AW_VER_NEGATIVE = 0x00000008;

//从下到上显示

public const Int32 AW_CENTER = 0x00000010;

//若使用了AW_HIDE标志,则使窗口向内重叠,即收缩窗口;否则使窗口向外扩展,即展开窗口

public const Int32 AW_HIDE = 0x00010000;

//隐藏窗口,缺省则显示窗口

public const Int32 AW_ACTIVATE = 0x00020000;

//激活窗口。在使用了AW_HIDE标志后不能使用这个标志

public const Int32 AW_SLIDE = 0x00040000;

//使用滑动类型。缺省则为滚动动画类型。当使用AW_CENTER标志时,这个标志就被忽略

public const Int32 AW_BLEND = 0x00080000;
//透明度从高到低 private void MainFM_Load(object sender, EventArgs e) { //淡入效果 AnimateWindow(this.Handle, , AW_BLEND | AW_ACTIVATE); } private void MainFM_FormClosing(object sender, FormClosingEventArgs e) { //淡出 AnimateWindow(this.Handle, , AW_BLEND | AW_HIDE); }

----------------------------------------------------------------------------------

Dev中的 GridControl

固定某一列始终显示

BandedGridView view = advBandedGridView1 as AdvBandedGridView;

GridBand bindSTCD = view.Bands.AddBand("站点信息");

bindSTCD.Fixed = FixedStyle.Left;

设置某列的Fixed 的属性为Left即可

----------------------------------------------------------------------------------

保留小数

string result = String.Format("{0:N2}", 0.55555);//N几就几位

注意:后面必须跟数字类型的变量不能是string等字符串

----------------------------------------------------------------------------------

指定DateTime显示时间

this.xxx.DateTime = New DateTime(2004,1,1);

----------------------------------------------------------------------------------

获得文件夹下的所有文件名称

string btopPath = Application.StartupPath + @"\SaveData\BTOP";

DirectoryInfo mydir = new DirectoryInfo(btopPath);

foreach (FileInfo item in mydir.GetFiles())

{

MessageBox.Show(item.FullName);

}

----------------------------------------------------------------------------------

遍历文件夹下所有文件,并读取三行,匹配xxx是个数字组成的项

private static void LoadTime(int time1, int time2)

{

string btopPath = Application.StartupPath + @"\SaveData\BTOP";

DirectoryInfo mydir = new DirectoryInfo(btopPath);

string data = "";

foreach (FileInfo item in mydir.GetFiles())

{

using (StreamReader sr = new StreamReader(item.FullName))

{

for (int i = ; i < ; i++)

{

data += sr.ReadLine() + " ";

}

string rege = @"\d{10}";

bool b = true;

foreach (Match mm in Regex.Matches(data, rege, RegexOptions.IgnoreCase))

{

if (b == true)

{

b = false;

time1 = int.Parse(mm.Value);

time1 = int.Parse(time1.ToString().Substring(, ));

}

else

{

time2 = int.Parse(mm.Value);

time2 = int.Parse(time2.ToString().Substring(, ));

}

}


}


//MessageBox.Show(mydir.FullName);


}


}


WinForm&&DEV知识小结的更多相关文章

  1. Android app开发知识小结

    Android知识小结 这是一个知识的总结,所以没有详解的讲解. 一.分辨率Android中dp长度.sp字体使用.px像素.in英寸.pt英寸1/72.mm毫米 了解dp首先要知道density,d ...

  2. C/C++ 位域知识小结

    C/C++ 位域知识小结 几篇较全面的位域相关的文章: http://www.uplook.cn/blog/9/93362/ C/C++位域(Bit-fields)之我见 C中的位域与大小端问题 内存 ...

  3. JAVA 变量 数据类型 运算符 知识小结

    ---------------------------------------------------> JAVA 变量 数据类型 运算符 知识小结 <------------------ ...

  4. html5-基本知识小结及补充

    <!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8&qu ...

  5. HTTPS知识小结

    HTTPS知识小结 背景1:TCP握手 internet上的两台机器A,B要建立起HTTP连接了,在这之前要先建立TCP连接,情景大概是这样子的: A:你好,我跟你建立一个TCP好吗? B:好啊. A ...

  6. shell 环境变量的知识小结

    环境变量的知识小结:·变量名通常要大写.·变量可以在自身的Shell及子Shell中使用.·常用export来定义环境变量.·执行env默认可以显示所有的环境变量名称及对应的值.·输出时用“$变量名” ...

  7. 180531-Spring中JavaConfig知识小结

    原文链接:Spring中JavaConfig知识小结/ Sring中JavaConfig使用姿势 去掉xml的配置方式,改成用Java来配置,最常见的就是将xml中的 bean定义, scanner包 ...

  8. javascript之正则表达式基础知识小结

    javascript之正则表达式基础知识小结,对于学习正则表达式的朋友是个不错的基础入门资料.   元字符 ^ $ . * + ? = ! : | \ / ( ) [ ] { } 在使用这些符号时需要 ...

  9. Dev GridControl 小结3

    Dev GridControl 小结 时间 2014-03-26 19:24:01  CSDN博客 原文  http://blog.csdn.net/jiankunking/article/detai ...

随机推荐

  1. LocalDateTime json格式化

    参考https://www.cnblogs.com/xiaozhang9/p/jackson.html?utm_source=itdadao&utm_medium=referral <d ...

  2. VirtualBox中的虚拟机在Ubuntu 下无法启动之问题解决

    我通过重新安装box解决的.发现,box安装,直接apt install有可能会出现虚拟机无法启动的问题. 一.添加VirtualBox的源并安装5.1版本virtualbox官网:https://w ...

  3. acceleration

    acceleration - Bing dictionary US[ək.selə'reɪʃ(ə)n]UK[ək.selə'reɪʃ(ə)n] n.加速度:加快:(车辆)加速能力 网络促进:加速力:加 ...

  4. Codeforces Beta Round #12 (Div 2 Only)

    Codeforces Beta Round #12 (Div 2 Only) http://codeforces.com/contest/12 A 水题 #include<bits/stdc++ ...

  5. HttpClient(一)

    package com.cmy.httpClient; import org.apache.commons.httpclient.HttpClient; import org.apache.commo ...

  6. 最近公共祖先 · Lowest Common Ancestor

    [抄题]: Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. “Th ...

  7. 粘性Service

    粘性Service就是一种服务 把他删去他又会马上创建 原理是在这个服务中去开启线程不断检测此服务是否存在如果不存在,咋就会重新创建 import android.app.Activity; impo ...

  8. PHP-GTK的demo在windows下运行出现的问题

    I am trying to use Firebird 2.5.2.26539 with wamp,When i enable the extensions of firebird in php: - ...

  9. db2 查看表空间使用率

    1. 统计所有节点表空间使用率 select substr(TABLESPACE_NAME,1,20) as TBSPC_NAME,bigint(TOTAL_PAGES * PAGE_SIZE)/10 ...

  10. Codeforces 691C. Exponential notation 模拟题

    C. Exponential notation time limit per test: 2 seconds memory limit per test:256 megabytes input: st ...