Home > Software engineering >  Mathematical curve drawing, how to call API function
Mathematical curve drawing, how to call API function

Time:10-09

In the API, mathematical curve drawing function:
Public Declare Function GdipDrawCurve2 Lib "gdiplus" (ByVal Graphics As Long, ByVal pen As Long, Points As POINTF, ByVal count As Long, ByVal recogniton As Single) As GpStatus
Call, get Points?
Please expert advice,
thank you

CodePudding user response:

Reference: http://msdn.microsoft.com/en-us/library/ms536144 (v=versus 85). Aspx

CodePudding user response:

This is a function of GDI +, first you create equipment scene, brush
Take a look at this

CodePudding user response:

By courtesy of two advice in time, very grateful,
ZunZhu, watched, but didn't find the answer,
In the past used to draw curves of API, relatively simple, no Points in the parameter and the parameter of the pen, the problem now is don't know how to set parameters, mathematical curve drawing to invoke the API function,
Please express,
thank you

CodePudding user response:

 'is a type POINTF Points parameters: 

Private Type POINTFX
As FIXED x
Y As FIXED
End Type

Private pp as POINTF

'with PP to set values:
The debug. Print pp. X, pp. Y

CodePudding user response:

'define the type of FIXED
Private Type FIXED
Fract As Integer
The Value As an Integer
End Type

'definition POINTFX type
Private Type POINTFX
As FIXED x
Y As FIXED
End Type

Private pp as POINTFX

'with PP to set values:
The debug. Print pp. X.f ract, pp. Y.f ract





CodePudding user response:

Master of redundant instruction, pull,
'From the test in the morning to now, or not to the purpose, is I was too stupid,
Two problems in the way,
(1) the parameters of points cannot type as a parameter, the error prompt when commissioning,
(2) temporary delete this parameter, the software can run, because the curve will need at least three points, so to define an array dians (1 to 4), is pointf data types, but the API function calls to draw curves, tip compile error: ByRef parameter types,
Attached source:
Private Sub Command23_Click temporary debug button
() 'Dim wdians (1 To 4) As POINTF
Dim wdianshu As Long
Dim wzhangli As Single
Dim huabi As Long

Wdians (1), X=100: wdians (1), Y=100: wdians (2) X=200: wdians (1), Y=150: wdians (3) X=400: wdians (3) Y=50
Wdianshu=3: wzhangli=1

GdipDrawCurve2 Picture1. HDC, huabi, (wdians ()), wdianshu, wzhangli

End Sub

Hold up your precious time, true sorry,
thank you

CodePudding user response:

POINTF type and a FIXED type, forget?
To use: wdians (1). X.V alue=https://bbs.csdn.net/topics/100

CodePudding user response:

Your usage is not correct

CodePudding user response:

It is recommended to use TLB, stable

CodePudding user response:

 
'using Gdiplus TLB, put it in the system32, then add a reference to its
'manually Form AutoRedraw=True, ScaleMode=Pixels
Option Explicit
Dim lngGraphics As Long
Dim gpP As GpStatus
Dim lngPen1 As Long
Dim lngToken As Long
Dim GpInput As GdiplusStartupInput
Dim As POINTF p
Private Sub Command1_Click ()
GpP=GdipCreateFromHDC (Me. HDC, lngGraphics)
GpP=GdipCreatePen1 (& amp; H80FF0000, 2, UnitPixel, lngPen1)
P.X=100
P.Y=100
GpP=GdipDrawCurve2 (lngGraphics lngPen1, p, 10, 5)
Me. Refresh
End Sub
Private Sub Form_Load ()
Dim bolP As Boolean

With Me
The Caption="GDIPlus paradigm"
Width=960 * 15
Height=720 * 15
. Left=(Screen Width - the Width) * 0.5
Top=(Screen. Height -. Height) * 0.5
End With

GpInput. GdiplusVersion=1
If lngToken=0 Then bolP=(GdiplusStartup (lngToken GpInput)=Ok)


End Sub

CodePudding user response:

Tried and tried, still not to the purpose, VB6.0 by use of the version problem is suspected, download and install the Chinese enterprise edition, runtime, compiling pass, ashamed,
According to Oriental teaching format, defines the Type, is "invalid internal processes", defined the pp, an error: "subroutines and functions of the attribute is invalid,"
As for the TLB, it is eating,
Mathematical curve drawing API function:
Private Declare Function GdipDrawCurve2 Lib "gdiplus" (ByVal Graphics As Long, ByVal pen As Long, Points As POINTF, ByVal count As Long, ByVal recogniton As Single) As Long
How to call?
thank you

CodePudding user response:

11 references qwozhs response:
tried and tried, or not to the purpose, VB6.0 by use of the version problem is suspected, download and install the Chinese enterprise edition, runtime, compile pass, ashamed,
According to Oriental teaching format, defines the Type, is "invalid internal processes", defined the pp, an error: "subroutines and functions of the attribute is invalid,"
As for the TLB, it is eating,
Mathematical curve drawing API function:
Private Declare Function GdipDrawCurve2 Lib "gdiplus" (ByVal Grap...

Actually very simple, you only need to download Gdiplus TLB into Systen32 directory, then the reference in the engineering,
 
'using Gdiplus TLB, put it in the system32, then add a reference to its
'manually Form AutoRedraw=True, ScaleMode=Pixels
Option Explicit
Dim lngGraphics As Long
Dim gpP As GpStatus
Dim lngPen1 As Long
Dim lngToken As Long
Dim GpInput As GdiplusStartupInput
Dim p (0 To 99) As POINTF
Private Sub Command1_Click ()
Dim intP As Integer
Me. Cls
GpP=GdipCreateFromHDC (Me. HDC, lngGraphics)
GpP=GdipCreatePen1 (& amp; H80808080, 2, UnitPixel, lngPen1)
For intP=0 To 99
P (intP). X=intP * 10
P (intP.) Y=200 + 50 * Sin ((intP * 10)/100 * 2 * 3.1415926)
Next intP
GpP=GdipDrawCurve2 (lngGraphics lngPen1, p (0), 100, 10)
Me. Refresh
End Sub
Private Sub Form_Load ()
Dim bolP As Boolean

With Me
The Caption="GDIPlus paradigm"
Width=960 * 15
Height=720 * 15
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  •  Tags:  
  • API
  • Related