问两个小问题,关于TableScope与HDC的。

Snakeguo 2002-08-16 03:24:28
1.TTableScope = (tsSynonym, tsSysTable, tsTable, tsView);请问其中的tsSynonym是什么意思?代表什么?
2.请解释一下以下代码中的DC以及GetDC(),ReleaseDC()是做什么的?HELP里面查不到,谢谢!

procedure TForm1.Button1Click(Sender: TObject);
const
YPos = 100;
var
DC: HDC;
i: Integer;
Shapes: Array[0..4] of TShape;
begin
FXSpot := 5;
DC := GetDC(Handle);
Shapes[0] := TShape.Create(DC, FXSpot, YPos);
Shapes[1] := TRectangle.Create(DC, FXSpot + 100, YPos);
Shapes[2] := TEllipse.Create(DC, FXSpot + 200, YPos);

for i := 0 to 2 do begin
Shapes[i].Draw;
Shapes[i].Free;
end;

ReleaseDC(Handle, DC);
end;
...全文
35 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
robinhunter 2002-08-17
  • 打赏
  • 举报
回复
The GetDC function retrieves a handle of a display device context (DC) for the client area of the specified window. The display device context can be used in subsequent GDI functions to draw in the client area of the window.

This function retrieves a common, class, or private device context depending on the class style specified for the specified window. For common device contexts, GetDC assigns default attributes to the device context each time it is retrieved. For class and private device contexts, GetDC leaves the previously assigned attributes unchanged.

HDC GetDC(

HWND hWnd // handle of window
);


Parameters

hWnd

Identifies the window whose device context is to be retrieved.



Return Values

If the function succeeds, the return value identifies the device context for the given window's client area.
If the function fails, the return value is NULL. The ReleaseDC function releases a device context (DC), freeing it for use by other applications. The effect of the ReleaseDC function depends on the type of device context. It frees only common and window device contexts. It has no effect on class or private device contexts.

int ReleaseDC(

HWND hWnd, // handle of window
HDC hDC // handle of device context
);


Parameters

hWnd

Identifies the window whose device context is to be released.

hDC

Identifies the device context to be released.



Return Values

The return value specifies whether the device context is released. If the device context is released, the return value is 1.
If the device context is not released, the return value is zero.
Snakeguo 2002-08-17
  • 打赏
  • 举报
回复
请问是在什么地方查到的?谢谢!

5,391

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧