Delphi

delphi 设置win10 dpi 缩放规则

半腔热情 提交于 2020-01-17 21:50:44
一、dpi介绍 dpi是“Dots Per Inch”的缩写,表示每英寸的像素点个数,也就是像素点的密集度。 dpi = 总像素点 / 总面积 比如一个32寸的显示,但分辨率只有1920*1440,而一个24寸的显示器,分辨率却达到3840*2160,很明显后面这个显示器的每英寸的像素点的个数多,显示的画面更加细腻。 所以:高分辨率不等于高dpi。 苹果的视网膜屏幕的核心就是高dpi:屏幕面积小,却分辨率高达5k,每英寸的像素点(dpi)固然多,画面自然细腻。 二、高dpi显示器如何导致软件显示异常 随着2K、4K显示器的普及,在使用这些高dpi显示器时,为了保证系统软件界面看起来不至于太小,导致视觉疲劳,一般会在系统中设置缩放比例。Windows操作系统对高dpi显示器缩放支持最好的是windows 10,建议使用高dpi显示器时使用Windows 10操作系统。 假设现在有一个软件界面(宽为950像素,高为700像素),该软件在24寸、分辨率为1900*1400的显示器上显示正常,但放到高dpi显示器(同样是24寸,但分辨率为3800*2800)上显示效果会如何? 从上图可以看到,同样尺寸的软件界面,在高dpi显示器上会显得非常小,会造成严重的视觉疲劳。 所以我们的软件需要针对高dpi进行缩放。 三、Windows 10 DPI缩放规则 Windows

深入delphi编程理解之消息(一)WINDOWS原生窗口编写及消息处理过程

ⅰ亾dé卋堺 提交于 2020-01-17 19:45:16
  通过以sdk方式编制windows窗口程序,对理解windows消息驱动机制和delphi消息编程有很大的帮助。 sdk编制windows窗口程序的步骤: 1、对TWndClass对象进行赋值; 2、向系统注册wndclass对象(RegisterClass); 3、CreateWindow创建窗口,获得窗口句柄Hwnd; 4、显示窗口(ShowWindow); 5、通过GetMessage函数不断获取系统消息,交给程序处理,程序过通回调函数(wndproc)处理系统消息。(消息处理部分)程序代码如下: program Project2; //{$APPTYPE CONSOLE} uses Windows, Messages; //============================================================================== // 定义回调函数 Wndproc(),处理windows消息; // 参数说明: // HWND 可以理解为窗口句柄 // AMessage 可理解为消息的编号 // Wparam 消息的高位 // Lparam 消息的低位 //==============================================================================

Why Application.OnException never runs?

前提是你 提交于 2020-01-17 17:15:03
问题 Problem summary: The method assigned to Application.OnException never runs when an unhandled exception occurs. I create a blank project with only this unit and place a single button on Unit.dfm (this is based on an official example) : // Unit1.pas // ********* type TForm1 = class(TForm) Button1: TButton; procedure FormCreate(Sender: TObject); procedure AppException(Sender: TObject; E: Exception); procedure Button1Click(Sender: TObject); end; var Form1: TForm1; implementation {$R *.dfm}

Why Application.OnException never runs?

萝らか妹 提交于 2020-01-17 17:14:28
问题 Problem summary: The method assigned to Application.OnException never runs when an unhandled exception occurs. I create a blank project with only this unit and place a single button on Unit.dfm (this is based on an official example) : // Unit1.pas // ********* type TForm1 = class(TForm) Button1: TButton; procedure FormCreate(Sender: TObject); procedure AppException(Sender: TObject; E: Exception); procedure Button1Click(Sender: TObject); end; var Form1: TForm1; implementation {$R *.dfm}

Procedure Parameter Error on MSXML

ε祈祈猫儿з 提交于 2020-01-17 15:27:33
问题 Below is the code that I am running and I am getting an error: I already checked the uses and it's fine. I think it is a problem with the parameter of my AddSimpleElement() procedure. unit Unit9; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.OleServer, QBXMLRP2Lib_TLB, MSXML, XMLDoc; type TForm9 = class(TForm) btnSubscribe: TButton; btnUnsubscribe: TButton; rp21:

Procedure Parameter Error on MSXML

若如初见. 提交于 2020-01-17 15:27:13
问题 Below is the code that I am running and I am getting an error: I already checked the uses and it's fine. I think it is a problem with the parameter of my AddSimpleElement() procedure. unit Unit9; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.OleServer, QBXMLRP2Lib_TLB, MSXML, XMLDoc; type TForm9 = class(TForm) btnSubscribe: TButton; btnUnsubscribe: TButton; rp21:

Screenshot of Webbrowser

纵然是瞬间 提交于 2020-01-17 14:07:07
问题 I have a TwebBrowser on a form, of which I need to take a Screenshot. Some may think Isn't this a dublicate. But it's not, because the solutions in the orter answers doesn't work, thay all just gives med a black screen. Så I try to get my pixels from DC(0) First some source code: Place a TWebBrowser and a TButton on a form, and add the following code to a OnCreate Event: procedure TForm1.FormCreate(Sender: TObject); var Doc: Variant; begin Width := 1350; Height := 860; with WebBrowser1 do

Is there an FMX function to set a TImage's transparent color at runtime?

笑着哭i 提交于 2020-01-17 10:57:57
问题 I have a TImage on a form in FMX (FireMonkey). I want to load a bitmap into the TImage at runtime, where the bitmap should have a transparent background defined by the first pixel's color in the bitmap. This color might be different from bitmap to bitmap. I know how to do this at design time, by using the MultiResBitmap editor for a TImage. However, I can't find any examples of how to do this at runtime. Do I have to do this manually (get the color of the first pixel in the bitmap, then

Is there an FMX function to set a TImage's transparent color at runtime?

元气小坏坏 提交于 2020-01-17 10:54:52
问题 I have a TImage on a form in FMX (FireMonkey). I want to load a bitmap into the TImage at runtime, where the bitmap should have a transparent background defined by the first pixel's color in the bitmap. This color might be different from bitmap to bitmap. I know how to do this at design time, by using the MultiResBitmap editor for a TImage. However, I can't find any examples of how to do this at runtime. Do I have to do this manually (get the color of the first pixel in the bitmap, then

How to create gradient button for mobile using Delphi XE7?

空扰寡人 提交于 2020-01-17 08:16:13
问题 I'm using Delphi XE7 for creating Android / iOS mobile application And how can I create the gradient button (Sample Gradient button)using FireMonkey Mobile application. Or should I need to use Style Book for applying the Gradient Colour in the Buttons? 回答1: There's nothing wrong with the tutorial you posted. With Firemonkey everything (visually) is composed of primitive shapes and animations, so using the skills learned in that post, you could create your buttons in gimp, then create a style