亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? dbgrid.htm

?? 對(duì)于學(xué)習(xí)很有幫助
?? HTM
?? 第 1 頁 / 共 4 頁
字號(hào):
    if (Field.FieldName = DBCheckBox1.DataField) then
    begin
     if TableGridDataCheckBox.AsBoolean then
       DBGrid1.Canvas.Draw(Rect.Left,Rect.Top,ImageTrue.Picture.Bitmap)
     else
       DBGrid1.Canvas.Draw(Rect.Left,Rect.Top,ImageFalse.Picture.Bitmap)
    end
  end;</PRE>
<P><HR></P>
<P>It's the very last part we're most interested in. 
If the state is not gdFocused and the column in CheckBox then this last bit executes. 
All it does is check the value of the data in the field and if it's true it shows the TRUE.BMP 
otherwise it shows the FALSE.BMP. 
I created the bit maps so they are indented so you can tell the difference between a focused and unfocused cell. Make onColExit look like this;</P>
<P><HR></P>
<PRE>procedure TForm1.DBGrid1ColExit(Sender: TObject);
begin
  If DBGrid1.SelectedField.FieldName = DBLookupCombo1.DataField then
    DBLookupCombo1.Visible := false
  else If DBGrid1.SelectedField.FieldName = DBCheckBox1.DataField then
    DBCheckBox1.Visible := false
  else If DBGrid1.SelectedField.FieldName = DBComboBox1.DataField then
    DBComboBox1.Visible := false;
end;</PRE>
<P><HR></P>
<P>Edit onKeyPress to;</P>
<P><HR></P>
<PRE>procedure TForm1.DBGrid1KeyPress(Sender: TObject; var Key: Char);
begin
  if (key &lt;&gt; chr(9)) then
  begin
    if (DBGrid1.SelectedField.FieldName = DBLookupCombo1.DataField) then
    begin
      DBLookupCombo1.SetFocus;
      SendMessage(DBLookupCombo1.Handle, WM_Char, word(Key), 0);
    end
    else if (DBGrid1.SelectedField.FieldName = DBCheckBox1.DataField)
then
    begin
      DBCheckBox1.SetFocus;
      SendMessage(DBCheckBox1.Handle, WM_Char, word(Key), 0);
    end
    else if (DBGrid1.SelectedField.FieldName = DBComboBox1.DataField)
then
    begin
      DBComboBox1.SetFocus;
      SendMessage(DBComboBox1.Handle, WM_Char, word(Key), 0);
    end;
  end;
end;</PRE>
<P><HR></P>
<P>Finally, here's the last trick. The caption of the checkbox needs to change as the user checks or unchecks the box. 
My first thought was to do this in the TDBCheckBox's onChange event, the only problem is that it doesn't have one. 
So I had to go back to the Windows API and send another message. &quot;SendMessage(DBCheckBox1.Handle, BM_GetCheck, 0, 0)&quot; 
which returns a 0 if the box is unchecked, otherwise it's checked.</P>
<P><HR></P>
<PRE>procedure TForm1.DBCheckBox1Click(Sender: TObject);
begin
  if SendMessage(DBCheckBox1.Handle, BM_GetCheck, 0, 0) = 0 then
     DBCheckBox1.Caption := '  ' + 'False'
  else
     DBCheckBox1.Caption := '  ' + 'True'
end;</PRE>
<P><HR></P>
<P>That's it. Hopefully you learned something. 
I've tried this technique with dialog boxes. It works and it's simple. Have fun with it. 
You don't really need to completely understand it as long as you know how to edit the code and replace the above component names 
with with the name of the component you want to drop into the grid.</P>
<H2>REVISED - 7/11/95</H2>
<P>Fred Dalgleish was nice enough to point out 2 stichy points about the Original grid demo. 
First, once a component in the grid has the focus it takes 2 Tab presses to move to the next grid cell. 
The other has to do with adding new records.</P>
<H3>Problem # 1 - Two Tab Presses Required.</H3>
<P>A component installed in the grid is actually floating over the top of the grid and not part of the grid it self. 
So when that component has the focus it takes two tab presses to move to the next cell. 
The first tab moves from the floating component to the Grid cell underneath and the second to move to the next grid cell. If this behavior bugs you heres how to fix it.</P>
<P>First in the form that contains grid add private variable called WasInFloater of type boolean, like so.</P>
<P><HR></P>
<PRE>type
  TForm1 = class(TForm)
   ...
   ...
  private
    { Private declarations }
     WasInFloater : Boolean;
   ...
   ...
   end;</PRE>
<P><HR></P>
<P>Next create an onEnter event for the LookupCombo where WasInFloater is set to true. 
Then point the onEnter event for each component that goes into the grid at this same single onEnter event.</P>
<P><HR></P>
<PRE>procedure TForm1.DBLookupCombo1Enter(Sender: TObject);
begin
  WasInFloater := True;
end;</PRE>
<P><HR></P>
<P>Finally, and here's the tricky part, define the following onKeyUp event for the grid.</P>
<P><HR></P>
<PRE>procedure TForm1.DBGrid1KeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if (Key in [VK_TAB]) and WasInFloater then
  begin
    SendMessage(DBGrid1.Handle, WM_KeyDown, Key, 0);
    WasInFloater := False;
  end;
end;</PRE>
<P><HR></P>
<P>What's happening here is that the grid's onKeyUp is sending it self a KeyDown when the focus just switched from one of the floating controls. 
This solution handles both tab and shift-tab.</P>
<H3>Problems #2 - New record disappears when component gets focus</H3>
<P>The second problem is that if you press add record on the navigator in the demo a new record is added but then when you click on one 
of the components installed in the grid the new record disappears. The reason for this is that there is a strange grid option called dgCancelOnExit which is 
True by default. Set it to False and the above problem goes away.</P>
<P>In my opinion Borland should have had this default set to False to begin with
. I find it getting in the way all the time and based on forum messages I'm not alone. 
The option is basically saying that if the grid looses focus then cancel and current edit's! Anyway I've got it 
turned off in just about every grid I've ever installed.</P>
<P>Note: This was written by Alec Bergamini, at 75664,1224. His companyis Out &amp; About Productions.</P>

<H1><A NAME="dbgrid2">Sorting Columns in a DBGrid</A></H1>
<I><P>Robert Vivrette - 76416.1373@compuserve.com</P>
</I><P>Many professional applications will display data in grid fields and allow you to sort on any one of the columns simply by clicking on the column header. 
Although what is proposed here is not the best way to accomplish this, it is a fairly simple way to mimic the same behavior.</P>
<P>The key hurdle in this problem is the DBGrid itself. 
It has no OnClick or OnMouseDown events, so it really was not designed to capture this kind of input. 
It does provide an OnDoubleClick, but this really doesn't work too well. What we need is a way to make the column headers clickable. 
Enter the THeaderControl component.</P>
<P>THeaderControl is a component that comes in Delphi 2.0 and provides the basic functions that we want. 
It can detect clicks on its individual panels, and the panels even go up and down when pressed (like a button). 
The key is to connect the THeaderControl to the DBGrid. Here is how it is done:</P>
<P>First, start a new application. Drop a THeaderControl on the form. 
It will automatically align to the top edge of the form. Now drop a DBGrid on the form and set its Align property to alClient. 
Next, add a TTable, and TDataSource component. 
Set the Tables DatabaseName property to DBDEMOS and its TableName to EVENTS.DB. 
Set the DataSource's DataSet property to point at Table1 and the DBGrid's DataSource property to point to DataSource1. 
Set Table's Active property to False in case it has been turned on. Now the fun begins!</P>
<P>Now we need to setup the THeaderControl component to look like the DBGrid's column headers. 
his will be done in code in the Form's FormCreate method. DoubleClick on Form1's OnCreate event and enter the following code:</P>
<P><HR></P>
<PRE>procedure TForm1.FormCreate(Sender: TObject);
var
  TheCap : String;
  TheWidth,a : Integer;
begin
  DBGrid1.Options := DBGrid1.Options - [dgTitles];
  HeaderControl1.Sections.Add;
  HeaderControl1.Sections.Items[0].Width := 12;
  Table1.Exclusive := True;
  Table1.Active := True;
  For a := 1 to DBGrid1.Columns.Count do
    begin
      with DBGrid1.Columns.Items[a-1] do
        begin
          TheCap := Title.Caption;
          TheWidth := Width;
        end;
      with HeaderControl1.Sections do
        begin
          Add;
          Items[a].Text := TheCap;
          Items[a].Width := TheWidth+1;
          Items[a].MinWidth := TheWidth+1;
          Items[a].MaxWidth := TheWidth+1;
        end;
      try
        Table1.AddIndex(TheCap,TheCap,[]);
      except
        HeaderControl1.Sections.Items[a].AllowClick := False;
      end;
    end;
  Table1.Active := False;
  Table1.Exclusive := False;
  Table1.Active := True;
end;</PRE>
<P><HR></P>
<P>Since the THeaderControl will be taking the place of the Grid's column headers, we first remove (set to False) the dgTitles option in the DBGrid's Options property. 
Then, we add a column to the HeaderControl and set its width to 12. This will be a blank column that is the same width as the Grid's status area on the left.</P>
<P>Next we need to make sure the Table is opened for Exclusive use (no other users can be using it). I will explain why in just a bit.</P>
<P>Now we add the HeaderControl sections. For each one we add, we will be giving it the same text as the caption of that column in the DBGrid. 
We loop through the DBGrid columns, and for each one we copy over the column's caption and width. We also set the HeaderControl's MinWidth and
 MaxWidth properties to the same as the column width. This will prevent the column from being resized. If you need resizeable columns, 
you will need a bit more code, and I wanted to keep this short and sweet.</P>
<P>Now comes the interesting part. We are going to create an index for each column in the DBGrid. The name of the index will be the same as the columns title.
 This step is in a try..finally structure because there are some fields that cannot be indexed (Blobs &amp; Memos for example). When it tries to index on these fields, 
it will generate an exception. We catch this exception and turn off the ability to click that column. This means that non-indexed columns will not respond to mouse clicks.
 The creation of these indexes is why we had to open the table in Exclusive mode. After we are all done, we close the table, set Exclusive off and reopen then table.</P>
<P>One last step. When the HeaderControl is clicked, we need to turn on the correct index for the Table. The HeaderControl's OnSectionClick method should be as follows:</P>
<P><HR></P>
<PRE>procedure TForm1.HeaderControl1SectionClick(
                HeaderControl: THeaderControl; 
                Section: THeaderSection);
begin
  Table1.IndexName := Section.Text;
end;</PRE>
<P><HR></P>
<P>That's it! When the column is clicked, the Table's IndexName property is set to the same as the HeaderControl's caption.</P>
<P>Pretty simple, huh? There is a lot of room for improvement however. It would be nice if clicking on a column a second time would reverse the sort order.
 Also, column resizing would be a nice added touch. I am going to leave these to you folks!</P>

<H2>Improvements</H2>
<I><P>The Graphical Gnome &lt;rdb@ktibv.nl&gt;</P>
</I><P>The improvement over the previous version is in the usage of the fieldname as indexname instead of the caption. </P>
<P>This improves the flexibility. Changes are indicated as italics </P>
<P><HR></P>
<PRE>    
procedure TfrmDoc.FormCreate(Sender: TObject);
Var
   TheCap    : String;
   TheFn     : String;
   TheWidth  : Integer;
   a         : Integer;
begin
     Dbgrid1.Options := DBGrid1.Options - [DGTitles];
     Headercontrol1.sections.Add;
     Headercontrol1.Sections.Items[0].Width := 12;
     For a := 1 to DBGRID1.Columns.Count do
     begin
        with DBGrid1.Columns.Items[ a - 1 ] do
        begin
           TheFn    := FieldName;
           TheCap   := Title.Caption;
           TheWidth := Width;
        end;
        With Headercontrol1.Sections DO
        BEGIN
          Add;
          Items[a].Text     := TheCap;
          Items[a].Width    := TheWidth + 1;
          Items[a].MinWidth := TheWidth + 1;
          Items[a].MaxWidth := TheWidth + 1;
        END; (* WITH Headercontrol1.Sections *)
        try (* except *)
           { Use indexes with the same name as the fieldname }
 <I>          (DataSource1.Dataset as TTable).IndexName := TheFn;   { Try to set the index name }
</I>        except
           HeaderControl1.Sections.Items[a].AllowClick := False; { Index not Available }
        end; (* EXCEPT *)
     END; (* FOR *)
END; (* PROCEDURE *)</PRE>
<P><HR></P>
<P>Use the fieldname property of the DBGrid to set an index with the same name as the fieldname. </P>
<P><HR></P>
<PRE>
procedure TfrmDoc.HeaderControl1SectionClick(HeaderControl: THeaderControl;
  Section: THeaderSection);
begin
<I>     (DataSource1.Dataset as TTable).IndexName :=
           DBGrid1.Columns.Items[ Section.Index - 1 ].FieldName;
</I>
end;</PRE>
<P><HR></P>

<P><H1><A NAME="dbgrid3">A Dbgrid with colored cells ?</P></A></H1>
<P><I>Ed_P._Hillmann@mail.amsinc.com (Ed Hillmann)</I></P>

I don't know if this helps, but I could color individual cells in a
DBGrid without having to make a new DBGrid component.  This is what I
just tested.... <p>

I created a form, dropped a TTable component it, and pointed it to the
EMPLOYEE.DB database in the DBDEMOS database.  I dropped a Datasource
and DBGrid on the form so that it showed on the form.<p>

I thought a simple test would be, for the employee number in the
EMPLOYEE.DB table, check if it's an odd number.  If it's an odd
number, then turn that cell green.<p>

Then, the only code I attached was to the DBGrid's OnDrawColumnCell
event, which looks as follows....<p>

<HR><PRE>procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect:
TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);
var
  holdColor: TColor;
begin
  holdColor := DBGrid1.Canvas.Brush.Color; {store the original color}
  if Column.FieldName = 'EmpNo' then {only do for the cell displaying
EmpNo}
    if (Column.Field.AsInteger mod 2 <> 0) then begin
      DBGrid1.Canvas.Brush.Color := clGreen;
      DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
      DBGrid1.Canvas.Brush.Color := holdColor;
    end;
end;
</PRE><HR>
This uses the DefaultDrawColumnCell method that is defined with the
TCustomDBGrid component, of which TDBGrid is a child.  This turned
each cell green of an employee whose emp no was odd. <p>


<P><H1><A NAME="dbgrid4">DBGrid that shows images</P></A></H1>
<P><I>From: sraike@iconz.co.nz (Bill Raike)</I></P>

I've had second thoughts and decided to post my DBGrid descendant that
shows images, since it's such a small amount of code.<P>

Here it is: <P>

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
不卡在线视频中文字幕| 欧美三级在线视频| 亚洲综合成人在线视频| 欧美成人一区二区三区在线观看| 波多野结衣中文一区| 奇米一区二区三区av| 中文字幕一区二区三中文字幕| 欧美丰满少妇xxxbbb| 不卡高清视频专区| 韩国三级中文字幕hd久久精品| 一区二区久久久| 国产精品私房写真福利视频| 日韩精品一区二区三区中文不卡 | 国产精品美女www爽爽爽| 欧美亚洲丝袜传媒另类| 成人黄色在线网站| 久久精品国产亚洲5555| 亚洲成人黄色小说| **欧美大码日韩| 国产亚洲精品bt天堂精选| 欧美一级片免费看| 欧美精品久久一区| 欧美主播一区二区三区美女| 99久久精品情趣| 成人永久免费视频| 国产精品亚洲午夜一区二区三区| 日韩电影在线观看电影| 亚洲成人午夜影院| 亚洲国产美女搞黄色| 最新欧美精品一区二区三区| 欧美激情一区在线| 国产亚洲欧洲997久久综合 | 国产精品视频yy9299一区| 日韩欧美一级精品久久| 欧美午夜免费电影| 欧美在线你懂得| 在线观看视频一区二区| 色婷婷av一区二区三区之一色屋| 97se亚洲国产综合在线| 91麻豆精品在线观看| av一二三不卡影片| www.日韩大片| 99在线精品观看| 91丨九色丨国产丨porny| av一区二区久久| 色婷婷精品大在线视频| 色菇凉天天综合网| 在线免费av一区| 精品视频999| 69堂精品视频| 精品日韩一区二区| 久久久久久久久蜜桃| 国产精品素人视频| 亚洲欧美电影一区二区| 亚洲精品国产视频| 无码av免费一区二区三区试看 | 成人丝袜18视频在线观看| 成人久久18免费网站麻豆| 成年人网站91| 在线视频欧美区| 4438成人网| 精品国产一区二区亚洲人成毛片 | 欧美精品日韩精品| 日韩免费视频一区| 国产亚洲综合性久久久影院| 最新中文字幕一区二区三区 | 欧美日韩久久一区| 日韩视频在线你懂得| 久久亚洲精品国产精品紫薇| 国产网站一区二区三区| 亚洲欧美福利一区二区| 天天综合日日夜夜精品| 久久精品免费观看| 成人性色生活片免费看爆迷你毛片| 91视频www| 91.成人天堂一区| 久久蜜桃一区二区| 亚洲精品中文在线观看| 美国十次了思思久久精品导航| 国产精品香蕉一区二区三区| 色狠狠av一区二区三区| 精品国产乱码久久久久久图片 | 国产欧美日韩视频一区二区 | 亚洲高清中文字幕| 韩国女主播一区| 日本高清不卡aⅴ免费网站| 欧美一区二视频| 中文字幕欧美一区| 秋霞午夜鲁丝一区二区老狼| 福利一区在线观看| 欧美乱妇23p| 中文字幕一区二区三区色视频| 午夜精品久久久久久| 国产成人欧美日韩在线电影| 欧美嫩在线观看| 中文字幕一区二区三区不卡在线| 免费久久99精品国产| 91在线一区二区三区| 日韩视频中午一区| 亚洲美腿欧美偷拍| 国产剧情一区二区| 欧美美女一区二区三区| 国产精品成人一区二区三区夜夜夜| 日韩不卡一区二区三区 | 成人午夜激情视频| 日韩亚洲欧美在线观看| 亚洲精品菠萝久久久久久久| 国产一区二区三区日韩| 欧美一级专区免费大片| 一区二区三区美女| 成人精品视频网站| 久久午夜免费电影| 日韩在线一区二区| 欧洲一区二区三区免费视频| 国产精品国产三级国产a| 国产一区二区在线视频| 91精品久久久久久久久99蜜臂| 一区二区三区在线免费视频 | 在线综合视频播放| 亚洲精品成人精品456| 成人小视频在线观看| 欧美精品一区二区三区蜜桃视频| 日韩在线播放一区二区| 欧美日韩精品电影| 亚洲卡通动漫在线| 成人av网站在线观看免费| 精品国产乱码久久久久久浪潮| 日韩av一二三| 欧美一区二区视频在线观看 | 欧美国产激情二区三区 | 成人午夜在线视频| 国产欧美日韩视频一区二区| 国产美女视频一区| 久久久久久久久久久久久久久99 | 色狠狠av一区二区三区| 亚洲三级理论片| 91麻豆123| 亚洲乱码一区二区三区在线观看| 成人国产电影网| 欧美激情在线一区二区| 成人短视频下载| 国产精品天干天干在线综合| 成人精品视频一区| 中文字幕五月欧美| 色94色欧美sute亚洲13| 亚洲成av人片www| 欧美精品亚洲一区二区在线播放| 午夜精品久久久久影视| 6080yy午夜一二三区久久| 日韩电影免费一区| 精品国产精品网麻豆系列| 国内精品伊人久久久久av影院 | 成人午夜激情片| 亚洲欧洲99久久| 欧洲激情一区二区| 午夜精品久久久久久久99樱桃| 制服丝袜一区二区三区| 男人操女人的视频在线观看欧美| 欧美大片在线观看| 国产成人免费在线视频| 亚洲天堂成人网| 51午夜精品国产| 激情综合色综合久久| 国产片一区二区三区| 99久久99久久精品国产片果冻| 亚洲欧美精品午睡沙发| 欧美二区在线观看| 国产一二精品视频| 亚洲欧美日韩国产另类专区| 欧美嫩在线观看| 国产主播一区二区| 亚洲美女一区二区三区| 91精品国产综合久久久久久| 激情欧美日韩一区二区| 中文字幕日韩av资源站| 91精品国产综合久久久蜜臀粉嫩| 国产一区不卡精品| 一区二区在线观看视频在线观看| 欧美一级日韩免费不卡| 成人激情图片网| 日韩精品欧美精品| 国产精品五月天| 91精品国产综合久久小美女| 成人黄色av网站在线| 日韩国产欧美在线播放| 国产日产亚洲精品系列| 日本电影亚洲天堂一区| 国模一区二区三区白浆| 一区二区三区蜜桃| 久久精品在这里| 欧美精品一级二级| 成人激情校园春色| 美女任你摸久久| 一区二区在线观看免费| 久久新电视剧免费观看| 欧美人牲a欧美精品| 成人av综合在线| 麻豆91免费观看| 亚洲午夜久久久久久久久久久 | 日韩一区二区三区四区五区六区 |