2013年9月11日星期三

* Copyright (C) 2012 Ming Zhen Lay copyright, any copying and use, but the use of any consequences assumes no responsibility , influence each other open-source and common progress

DataGridViewEx The latest version adds three functions 10,11,12 important , modify the export and print deep bug, for everyone to share all the source code and examples .
Download : http://download.csdn.net/detail/ireenter/4086911


/ ********************************************* ************************************************** *****
* Copyright (C) 2012 Ming Zhen Lay copyright, any copying and use, but the use of any consequences assumes no responsibility , influence each other open-source and common progress
* File Name : DataGridViewEx.cs
* created by: Ming Zhen lay
* Email: nzj.163 @ 163.com qq: 342155124
* Created :2010 -06-01
* Last Modified: 2012.2.24 added custom summary control properties , see Function Description 12
* 2012.2.23 too many columns to modify the parent does not show the title question , re-write the algorithm , modifying the title of the first overlap and can not wrap problems, refer to Note 11 .
* 2012-1-19 shown to increase the function of Article 10 ; modified the column headers more than 26 errors , export excel as an array of ways , faster, derived cell formatted as text .
* Title : User -defined DataGridView control
* Description : Extended DataGridView control function
* Extensions:
* 1, search Search (); There are two methods with clear , with different parameters for the shortcut key F3 to continue down the search
* 2, to set up complex with TreeView HeadSource heading styles , if a node corresponding display hidden columns , please Tag this node is set to hide, hide the columns are in place and binding column position corresponding data element , leaves the sequence of nodes need the same result set column order
* 3, by reflecting export Excel, without reference to com components, methods ExportExcel (), without limiting the number of columns , the first table can also be exported , AutoFit property settings adjust automatically after export excel cell width
* export content supports custom : Title List Header List Footer, support in the design of a time when the settings window closes automatically when Excel completely release resources
* 4, it can be arbitrarily set the display and not display those columns , by calling the method SetColumnVisible () implementation.
* 5, set the column headings SetHeader (), set the column is always visible AlwaysShowCols (), set the column temporarily invisible HideCols ()
* Note that when using the TreeView as complex Header , do not use this method , Header displays the contents of the display content according to treeview
* 6, column width and order preservation SaveGridView (), load LoadGridView ()
* 7, support for WYSIWYG printing capabilities, for example as follows
* private void button5_Click (object sender, EventArgs e)
{
DGVPrinter printer = new DGVPrinter ();
printer.PrintPreviewDataGridView (DataGridViewEx1);
}
* 8, customize merge rows and columns, rows, combined with MergeRowColumn attributes , combined with MergeColumnNames attribute columns , you can define multiple columns
* 9, line label settings bool ShowRowNumber;
* 10, the last line of the summary line to increase support columns aggregate functions , see http://msdn.microsoft.com/zh-cn/library/system.data.datacolumn.expression (v = VS.100). aspx
* assumptions on the id column shows the " total " character , avgPrice conduct averages , total column shows together, then add three lines on ComputeColumns attributes : id, total: ; avgPrice, Avg (avgPrice); total, Sum (total)
* If you need to format the control value , implement beforeShow event
* increase export and print the corresponding support the alignment of WYSIWYG is derived and applied to print .
* 11, column headings head wrap , the default settings for each column header header row height is 22 , if you set the font bigger will be automatically calculated. If you need multi-line display , please be adjusted according to ColumnHeaderHeight property values ​​,
* its estimation method for the title of the first layer is expected to multiply 22 , or set the font height multiplied by the number of layers .
* 12, for the first 10 function, increased aggregate information custom control properties , summary font SummaryFont, summary font color SummaryFontColor, summarizes the background color SummaryBGColor, borders consistent with the entire table border
******************************************** ************************************************** ****** /

------ Solution ------------------------------------ --------
cc ...
------ Solution ------------------------- -------------------
get points , huh uh
------ Solution ------------ --------------------------------
top.
------ Solution ---------------------------------------- ----
come and collect points
------ Solution ------------------------------ --------------
good collection
------ Solution -------------------- ------------------------
access points ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
------ Solution --------------------------------------------
access points ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
------ Solution ----------- ---------------------------------
catch ----

------ Solution ------------------------------------ --------
has initially seen the code, test and found that the code is a lot of problems , can only study , not used in the project .
problem exemplified :
First, export Excel error, the machine installed OFFICE2010, arguably should not be a problem, but the error message is " abnormal ...... call target ", where you need to modify error mode , display the internal error message ( or full error stack ) to see the root of the problem .
two , printing error, when the machine does not start when you install the printer or print service , will certainly be a mistake, but the program did not catch the error , the direct program crashes .
three , multi- position dragging the column header does not limit your multi- meter is painted patterns, but when the column position changes, the pattern on the mess .
Fourth, the summary line can not be fixed at the bottom and can not see that view is very convenient. Then at least in the first line is a compromise approach.
------ Solution ---------------------------------------- ----
feeling pretty good, incidentally, supports what access points ! ~
------ Solution --------------------------------------- -----
passing , strong support , get points
------ Solution ------------------------- -------------------
have not exported PDF?
------ Solution ------------- -------------------------------
mark to save
------ Solution ---- ----------------------------------------
landlord is quite creative .
------ Solution ------------------------------------------- -


dataGridview achieve summary is not very realistic to imagine Crystal Reports as strong , then it will use Crystal Reports Microsoft do
------ Solution ---------- ----------------------------------
high scores . . Enlivened
------ Solution -------------------------------------- ------
Thank you to share
a bug we work together to solve
------ Solution ------------------------------- -------------

some people use two DataGridView splicing way to achieve this effect , the actual effect is still very good , there are three-dimensional. The above summary row without DataGridView , the following DataGridView only one line ( fixed ) , provides summary line functions , colors and fonts can highlight the following .
In this way horizontal scroll bar handle synchronization issues , as well as the synchronization of the column position changes to their settings in the corresponding event in ( To disable the built-in scroll bars, scroll bars added externally ) . To achieve these externally added , you must use the UserControl as a container that contains multiple controls .
Also, if WCF development, will be a lot easier , because WCF is ideal for custom development of various controls.
------ Solution ---------------------------------------- ----
with Shau Kei to pick points up .....
------ Solution ----------------- ---------------------------
strongly suggest that the landlord put github go above . . csdn also divided. .
------ Solution - -------------------------------------------
access points slightly ~
good things
------ For reference only -------------------------------- -------
  This reply was moderator deleted at 2012-02-26 09:17:52

------ For reference only ---------------------------------- -----
  This reply was moderator deleted at 2012-02-26 09:16:19

------ For reference only ---------------------------------- -----

Yes, some bug or need to perfect what
------ For reference only ----------------- ----------------------
can print to pdf
------ For reference only --------- ------------------------------
  This reply was moderator deleted at 2012-02-26 14:13:28

------ For reference only ---------------------------------- -----
  This reply was moderator deleted at 2012-02-27 09:17:21

------ For reference only ---------------------------------- -----


say well , the first three issues have been fixed , so the next release date , it would not modify another one bug. There can be directly downloaded I want to find the latest , csdn not update source.
The fourth question I do not have a good solution , I hope to give a good suggestion .
As can be applied in the project , and that was his assessment , and apply that sentence , whether you dare to use, anyway, I was used.
------ For reference only -------------------------------------- -
  This reply was moderator deleted at 2012-02-27 11:22:49

------ For reference only ---------------------------------- -----
can find a bug like change , as fixed -line summary , I really no better solution , and we hope to provide a good program .
------ For reference only -------------------------------------- -
wrong , grassland , and the last line "WCF" changed to "WPF"
------ For reference only ---------------- -----------------------
two DataGridView and bottom add a panel similar to the scroll bar is not easy to deal with , so that the two DataGridView stack up , always feel uncomfortable.
------ For reference only -------------------------------------- -
Hello , I have downloaded it. Also points up . Your updated version , send one to me please ? My mailbox gogls@qq.com
------ For reference only ------------------------------ ---------
I found the problem ,
1 when the printer is not installed or not enabled print service, dot printing , the program will get stuck , and then collapse feedback.

2 My computer installed office2007, point of export on the error . There will be no error when installing office software .
The best way is not to transfer office software interface. Computer software did not install the office can also lead .

Finally, thank you to the selfless sharing. I think this mutual sharing the spirit of learning , too. Later I became powerful, and will share with each other so that we learn to talk . We will progress faster

没有评论:

发表评论