为什么设计期mdichildform的大小和运行期不同(50分)

  • 主题发起人 主题发起人 baby2321
  • 开始时间 开始时间
B

baby2321

Unregistered / Unconfirmed
GUEST, unregistred user!
不知为何 <br>原理是什么呢?<br>...<br>谢谢
 
请参考如下代码<br>procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;<br>&nbsp; DataCol: Integer; Column: TColumn; State: TGridDrawState);<br>var<br>&nbsp; Bmp: TBitmap;<br>&nbsp; OutRect: TRect;<br>&nbsp; BmpWidth: Integer;<br>begin<br>&nbsp; // default output rectangle<br>&nbsp; OutRect := Rect;<br><br>&nbsp; if Column.Field = Table1Common_Name then<br>&nbsp; begin<br>&nbsp; &nbsp; // draw the image<br>&nbsp; &nbsp; Bmp := TBitmap.Create;<br>&nbsp; &nbsp; try<br>&nbsp; &nbsp; &nbsp; Bmp.Assign (Table1Graphic);<br>&nbsp; &nbsp; &nbsp; BmpWidth := (Rect.Bottom - Rect.Top) * 2;<br>&nbsp; &nbsp; &nbsp; OutRect.Right := Rect.Left + BmpWidth;<br>&nbsp; &nbsp; &nbsp; DBGrid1.Canvas.StretchDraw (OutRect, Bmp);<br>&nbsp; &nbsp; finally<br>&nbsp; &nbsp; &nbsp; Bmp.Free;<br>&nbsp; &nbsp; end;<br>&nbsp; &nbsp; // reset output rectangle, leaving space for the graphic<br>&nbsp; &nbsp; OutRect := Rect;<br>&nbsp; &nbsp; OutRect.Left := OutRect.Left + BmpWidth;<br>&nbsp; end;<br><br>&nbsp; // red font color if length &gt; 100<br>&nbsp; if (Column.Field = Table1Lengthcm) and<br>&nbsp; &nbsp; &nbsp; (Table1Lengthcm.AsInteger &gt; 100) then<br>&nbsp; &nbsp; DBGrid1.Canvas.Font.Color := clRed;<br><br>&nbsp; // default drawing<br>&nbsp; DBGrid1.DefaultDrawDataCell (OutRect, Column.Field, State);<br>end;
 
楼上的,好像不是使用 DBGRIDEH吧????
 
...是要在QuickReport的Detail中显示
 
TMS 有简化 html 呈现控件,支持 [/b] 之类的
 
晕,QuickReport不太了解,我一直用fastreport[:(!]
 
"TMS 有简化 html 呈现控件,支持 [/b] 之类的 &nbsp;"?
 
其实根据DBGrid的数据源“部门级别”等于2时就设置字体加粗,否则就不加。<br>DBGrid.Canvas.Font.Style := [fsBold];
 
TO:bbscom <br>“‘部门级别’等于2时就设置字体加粗,否则就不加。” &nbsp; 我也是这么想的<br>我用的QReport 直接用ADO从数据表读过来的数据 这个判断应该写在哪呢?这个判断 该怎么写?<br>我没有用DBGrid
 
顶<br>谢谢大家
 
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;<br>&nbsp; DataCol: Integer; Column: TColumn; State: TGridDrawState);<br>begin<br>&nbsp; if (Sender as TDBGrid).DataSource.DataSet.FieldByName('部门级别').AsString='2' then<br>&nbsp; begin<br>&nbsp; &nbsp; (Sender as TDBGrid).Canvas.Font.Style := [fsBold];<br>&nbsp; &nbsp; (Sender as TDBGrid).Canvas.Brush.Color := clRed;<br>&nbsp; end;<br>&nbsp; (Sender as TDBGrid).DefaultDrawColumnCell(Rect, DataCol, Column, State);<br>end;
 
谢谢bbscom的回复<br><br>我这里没有用DBGrid<br>我用的QReport 直接用ADO从数据表读过来的数据<br><br>(Sender as TDBGrid).DataSource.DataSet.FieldByName('部门级别').AsString='2' &nbsp;这一句应该如何转换?<br><br>谢谢
 
后退
顶部