再学 GDI+[60]: TGPGraphics.SetSmoothingMode - 绘图质量
生活随笔
收集整理的這篇文章主要介紹了
再学 GDI+[60]: TGPGraphics.SetSmoothingMode - 绘图质量
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
本例效果圖:
代碼文件:
unit Unit1;interfaceusesWindows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs, StdCtrls;typeTForm1 = class(TForm)ListBox1: TListBox;procedure FormCreate(Sender: TObject);procedure FormPaint(Sender: TObject);procedure ListBox1Click(Sender: TObject);end;varForm1: TForm1;implementation{$R *.dfm}uses GDIPOBJ, GDIPAPI;procedure TForm1.FormCreate(Sender: TObject); beginListBox1.Align := alRight;with ListBox1.Items dobeginAdd('SmoothingModeInvalid '); Add('SmoothingModeDefault ');Add('SmoothingModeHighSpeed '); Add('SmoothingModeHighQuality'); Add('SmoothingModeNone ');Add('SmoothingModeAntiAlias '); end; end;procedure TForm1.FormPaint(Sender: TObject); varg: TGPGraphics;p: TGPPen; beging := TGPGraphics.Create(Canvas.Handle);p := TGPPen.Create(aclRed, 2);g.SetSmoothingMode(ListBox1.ItemIndex - 1);g.DrawEllipse(p, 10, 10, ClientWidth - ListBox1.Width - 20, ClientHeight - 20);g.DrawLine(p, 0, 0, ClientWidth - ListBox1.Width, ClientHeight);g.DrawLine(p, ClientWidth - ListBox1.Width, 0, 0, ClientHeight);p.Free;g.Free; end;procedure TForm1.ListBox1Click(Sender: TObject); beginRepaint; end;end. 窗體文件:
object Form1: TForm1Left = 0Top = 0Caption = 'Form1'ClientHeight = 108ClientWidth = 286Color = clBtnFaceFont.Charset = DEFAULT_CHARSETFont.Color = clWindowTextFont.Height = -11Font.Name = 'Tahoma'Font.Style = []OldCreateOrder = FalsePosition = poDesktopCenterOnCreate = FormCreateOnPaint = FormPaintPixelsPerInch = 96TextHeight = 13object ListBox1: TListBoxLeft = 133Top = 8Width = 145Height = 73ItemHeight = 13TabOrder = 0OnClick = ListBox1Clickend end 繪圖質量參數:
SmoothingModeInvalid = -1; {指定一個無效模式} SmoothingModeDefault = 0; {指定不消除鋸齒} SmoothingModeHighSpeed = 1; {指定高速度、低質量呈現} SmoothingModeHighQuality = 2; {指定高質量、低速度呈現} SmoothingModeNone = 3; {指定不消除鋸齒} SmoothingModeAntiAlias = 4; {指定消除鋸齒的呈現}
代碼文件:
unit Unit1;interfaceusesWindows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs, StdCtrls;typeTForm1 = class(TForm)ListBox1: TListBox;procedure FormCreate(Sender: TObject);procedure FormPaint(Sender: TObject);procedure ListBox1Click(Sender: TObject);end;varForm1: TForm1;implementation{$R *.dfm}uses GDIPOBJ, GDIPAPI;procedure TForm1.FormCreate(Sender: TObject); beginListBox1.Align := alRight;with ListBox1.Items dobeginAdd('SmoothingModeInvalid '); Add('SmoothingModeDefault ');Add('SmoothingModeHighSpeed '); Add('SmoothingModeHighQuality'); Add('SmoothingModeNone ');Add('SmoothingModeAntiAlias '); end; end;procedure TForm1.FormPaint(Sender: TObject); varg: TGPGraphics;p: TGPPen; beging := TGPGraphics.Create(Canvas.Handle);p := TGPPen.Create(aclRed, 2);g.SetSmoothingMode(ListBox1.ItemIndex - 1);g.DrawEllipse(p, 10, 10, ClientWidth - ListBox1.Width - 20, ClientHeight - 20);g.DrawLine(p, 0, 0, ClientWidth - ListBox1.Width, ClientHeight);g.DrawLine(p, ClientWidth - ListBox1.Width, 0, 0, ClientHeight);p.Free;g.Free; end;procedure TForm1.ListBox1Click(Sender: TObject); beginRepaint; end;end. 窗體文件:
object Form1: TForm1Left = 0Top = 0Caption = 'Form1'ClientHeight = 108ClientWidth = 286Color = clBtnFaceFont.Charset = DEFAULT_CHARSETFont.Color = clWindowTextFont.Height = -11Font.Name = 'Tahoma'Font.Style = []OldCreateOrder = FalsePosition = poDesktopCenterOnCreate = FormCreateOnPaint = FormPaintPixelsPerInch = 96TextHeight = 13object ListBox1: TListBoxLeft = 133Top = 8Width = 145Height = 73ItemHeight = 13TabOrder = 0OnClick = ListBox1Clickend end 繪圖質量參數:
SmoothingModeInvalid = -1; {指定一個無效模式} SmoothingModeDefault = 0; {指定不消除鋸齒} SmoothingModeHighSpeed = 1; {指定高速度、低質量呈現} SmoothingModeHighQuality = 2; {指定高質量、低速度呈現} SmoothingModeNone = 3; {指定不消除鋸齒} SmoothingModeAntiAlias = 4; {指定消除鋸齒的呈現}
轉載于:https://www.cnblogs.com/del/archive/2008/06/23/1228119.html
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的再学 GDI+[60]: TGPGraphics.SetSmoothingMode - 绘图质量的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Cesium源码剖析---Post Pr
- 下一篇: flutter中的生命周期函数