DelphiFan Magazine

Top Menu

Main Menu

  • DELPHI
  • CODE SAMPLES
  • FIREMONKEY
  • DATABASE
  • RELEASES
  • VIDEOS
  • REVIEW
  • TECH NEWS

logo

DelphiFan Magazine

  • DELPHI
  • CODE SAMPLES
  • FIREMONKEY
  • DATABASE
  • RELEASES
  • VIDEOS
  • REVIEW
  • TECH NEWS
  • How to add a server application written in UNIGUI to startup?

  • UniGUI Expiry Link Anonymizer

  • UniGUI Add CAPTCHA to the WEB project

  • UniGui. Unique hybrid of Delphi and JS

  • How to transform a blob field into string lines (varchar) in SQL Firebird?

CODE SAMPLESDELPHI
Home›CODE SAMPLES›DBGrid beautification and SQLite display problem

DBGrid beautification and SQLite display problem

By admin
November 24, 2020
1962
0
Share:

1 .The memo type in the DBGrid of Delphi 10.3 displays content instead of (WIDEMEMO)

a) Connect to the database and display; (the connection at design time and the connection at runtime are two independent connections, which should be distinguished)

procedure TForm1.FormCreate(Sender: TObject); begin FDQuery1.Connection := FDConnection1; FDConnection1.LoginPrompt:=false; //Cancel login prompt FDConnection1.Open(‘DriverID=SQLite;Database=test1.Sqlite3.db’); end;

b) Increase all fields;

c) Add event;

//    FDQuery1UserName: TWideMemoField

procedure TForm1.FDQuery1UserNameGetText(Sender: TField; var Text: string; DisplayText: Boolean); begin Text := Copy(FDQuery1UserName.AsString, 1, 50); end;

d) Effect;

 

2 )DBGrid beautification

procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
  DataCol: Integer; Column: TColumn; State: TGridDrawState);
var
  i: Integer;
begin
  if gdSelected in State then
    Exit;
  // Define the font and background color of the header:
  for i := 0 to (Sender as TDBGrid).Columns.Count - 1 do
  begin
    (Sender as TDBGrid).Columns[i].Title.Font.Name := 'Roboto '; // Font
    (Sender as TDBGrid).Columns[i].Title.Font.Size := 9; // font size
    (Sender as TDBGrid).Columns[i].Title.Font.Color := $000000FF; // Font color (red)
    (Sender as TDBGrid).Columns[i].Title.Color := $0000FF00; // Background color (green)
  end;
  // Change grid background color alternately:
  if (Sender as TDBGrid).DataSource.DataSet.RecNo mod 2 = 0 then
    (Sender as TDBGrid).Canvas.Brush.Color := clInfoBk // Define background color
  else
    (Sender as TDBGrid).Canvas.Brush.Color := RGB(191, 255, 223); // Define background color
  // Define the color of the grid lines:
  TDBGrid(Sender).DefaultDrawColumnCell(Rect, DataCol, Column, State);
  with (Sender as TDBGrid).Canvas do // Draw the border of the cell
  begin
    Pen.Color := $00FF0000; // Define the pen color (blue)
    MoveTo(Rect.Left, Rect.Bottom); // Pen positioning
    LineTo(Rect.Right, Rect.Bottom); // Draw blue horizontal lines
    Pen.Color := $0000FF00; // Define the pen color (green)
    MoveTo(Rect.Right, Rect.Top); // Pen positioning
    LineTo(Rect.Right, Rect.Bottom); // Draw a green vertical line
  end;
end;
Tagsdbgriddbgrid beautydbgrid sqlite problemdelphisqlite problem
Previous Article

Several Delphi programs for obtaining Windows system ...

Next Article

Work with External program or Files in ...

0
Shares
  • 0
  • +
  • 0
  • 0
  • 0
  • 0

admin

Related articles More from author

  • Uncategorized

    Delphi Android microphone and camera operation

    December 11, 2020
    By admin
  • DELPHIFIREMONKEY

    Opening a Pdf File With Delphi (Android)

    October 6, 2020
    By admin
  • CODE SAMPLESDELPHI

    How to select a printer installed in Windows?

    January 7, 2021
    By admin
  • DELPHIFIREMONKEY

    Setting up the IDE for your first Android Application in Delphi

    September 7, 2020
    By admin
  • CODE SAMPLESDELPHI

    Customize the height of uniGUI Grid header

    October 1, 2020
    By admin
  • CODE SAMPLESDELPHI

    Delphi’s multicast listener mode (observer mode) based on the interface (IInterface)

    November 3, 2020
    By admin

Leave a reply Cancel reply

You may interested

  • CODE SAMPLESDELPHI

    Two ways to improve the efficiency of unigui development

  • CODE SAMPLESDELPHI

    How does Delphi install and configure third-party controls and deal with file not found

  • CODE SAMPLESDELPHI

    Delphi calls .net WebService and parameter transfer

  • LATEST REVIEWS

  • TOP REVIEWS

Timeline

  • January 27, 2021

    How to add a server application written in UNIGUI to startup?

  • January 27, 2021

    UniGUI Expiry Link Anonymizer

  • January 26, 2021

    UniGUI Add CAPTCHA to the WEB project

  • January 26, 2021

    UniGui. Unique hybrid of Delphi and JS

  • January 13, 2021

    How to transform a blob field into string lines (varchar) in SQL Firebird?

Latest Comments

Find us on Facebook

Follow Us on Instagram

logo

Our website, law, laws, copyright and aims to be respectful of individual rights. Our site, as defined in the law of 5651 serves as a provider of space. According to the law, contrary to the law of site management has no obligation to monitor content. Therefore, our site has adopted the principle of fit and remove. Works are subject to copyright laws and is shared in a manner that violated their legal rights, or professional associations, rights holders who, adsdelphi@gmail.com I can reach us at e-mail address. Complaints considered to be infringing on the examination of the content will be removed from our site.

About us

  • 660 Pennsylvania Avenue Southeast #100 Washington, DC 20003
  • 0123456789
  • adsdelphi@gmail.com
  • Recent

  • Popular

  • Comments

  • How to add a server application written in UNIGUI to startup?

    By admin
    January 27, 2021
  • UniGUI Expiry Link Anonymizer

    By admin
    January 27, 2021
  • UniGUI Add CAPTCHA to the WEB project

    By admin
    January 26, 2021
  • UniGui. Unique hybrid of Delphi and JS

    By admin
    January 26, 2021
  • How to add a server application written in UNIGUI to startup?

    By admin
    January 27, 2021
  • Amazing Cross Platform Email App Sample In Delphi 10.4.1 FireMonkey For Android And IOS

    By admin
    August 13, 2020
  • Critical Update Available For Delphi FireMonkey 10.4.1 On Android, IOS, OSX, Windows, And Linux

    By admin
    September 4, 2020
  • Setting up the IDE for your first Android Application in Delphi

    By admin
    September 7, 2020

Follow us

Find us on Facebook

© Copyright Delphifan Forum. All rights reserved.