Home > Software engineering >  For DC's many questions, hope to master advice, thank you!
For DC's many questions, hope to master advice, thank you!

Time:10-02

Just beginner Vb, see the following code in a blog post,
The original address: http://blog.csdn.net/dzweather/article/details/8973506

20. Private Type POINTAPI
21. X As Long
22. The y As Long
23.
24. The End Type
25.
26. The Private Sub Command1_Click ()
'text box on the drawing27.
28. Dim point (2) the As POINTAPI
29.
30. Point (0). X=10
31. Point (0). The y=10
32. Point (1)=30 x
33. Point (1) y=30
34. Point (2) x=30
35 in point (2) y=10
36.
37. Dim HDC As Long
38.
39. The HDC=GetDC (Text1. HWND) 'using the text box handle, handle and obtain the corresponding DC object;
40. Polygon HDC, point (0), ByVal 3 & amp; 'in a text box on the DC drawing
41. The ReleaseDC Text1. HWND, HDC
42.
43. The End Sub
44.
45. Private Sub Command2_Click () 'in the client area drawing
46.
47. The Dim point (2) the As POINTAPI
48.
49. Point (0).=50 x
50. Point (0). The y=50
51. The point (1) x=100
52. The point (1) y=100
53. The point (2) x=100
54. The point (2) y=50
55. The Polygon Form1. HDC, point (0), ByVal 3 & amp;

For the above code, because it is beginner VB, saw this after so many questions, hope can down, be obliged!

Use the Form handles can be obtained the corresponding DC?
In front of the text box has its corresponding DC, here's the Form also has its corresponding DC, so my question is:
1. Every object has a corresponding DC first?
2. To create these DC, is how?
3. In addition, each object in the API had a corresponding one handle (handle)?
4. Assume that every object has a corresponding DC, each object has its corresponding handle, so the DC
Handle with a handle to the object are the same, or different?
5. The corresponding DC is attached to the object? They are independent relationship or affiliated relationship?
If they are affiliated relationship, so why don't handle the same??
DC is independent of the object of the object??

CodePudding user response:

Common to each and every one is to say, usually has a handle, DC like canvas, to show you need to draw on DC, but a few may not handle, like the label shape of image and so on, it is possible that share the DC with the form
  •  Tags:  
  • API
  • Related