| RMC_CreateChartOnDC function. | ||
| Create a new chart on a device context (DC). | ||
| Syntax | ||
| nResult (LONG) = RMC_CreateChartOnDC( ByVal nParentDC (LONG), ByVal nCtrlId (LONG), ByVal nX (LONG), ByVal nY (LONG), ByVal nWidth (LONG), ByVal nHeight (LONG), Optional ByVal nBackColor (LONG), Optional ByVal nCtrlStyle (LONG), Optional ByVal nExportOnly (LONG), Optional ByRef sBgImage (ASCIIZ), Optional ByRef sFontName (ASCIIZ), Optional ByVal nBitmapBKColor (LONG) ) |
||
| Parameter | ||
| nParentDC (LONG) | ||
| Device context, on which the chart shall be painted. See Remarks | ||
| nCtrlId (LONG) | ||
| Unique ID of the control. | ||
| nX (LONG) | ||
| Upper left corner of the chart in the parent DC (in Pixel). | ||
| nY (LONG) | ||
| Top corner of the chart in the parent DC (in Pixel). | ||
| nWidth (LONG) | ||
| Width of the chart (in Pixel). | ||
| nHeight (LONG) | ||
| Height of the chart (in Pixel). | ||
| nBackColor (LONG) | ||
| Backcolor of the chart (as a Color... constant). If omitted or 0: %ColorAliceBlue. | ||
| nCtrlStyle (LONG) | ||
| Style of the chart as a control style constant. If omitted or 0: RMC_CTRLSTYLEFLAT. | ||
| nExportOnly (LONG) | ||
| If TRUE the chart cannot be displayed on the screen, it must be drawn with either RMC_Draw2File(), RMC_Draw2Printer() or RMC_Draw2Clipboard(). If omitted or 0: FALSE. | ||
| sBgImage (ASCIIZ) | ||
| The full name of the file for the background image, if
you choose as nCtrlStyle %RMC_CTRLSTYLEIMAGE or %RMC_CTRLSTYLEIMAGETILED. With %RMC_CTRLSTYLEIMAGE the image will be scaled accordingly the size of your chart, therefore you should choose an image size which has the same or a similar ratio of width and height as your chart and which should be rather bigger than smaller than your chart, if it has not the same size. Load file bars with image.rmc into the Designer for an example. %RMC_CTRLSTYLEIMAGETILED will not scale the image, but repeat it until the whole chart is filled with the image. This style is convenient if you want to use a small GIF or BMP to create a pattern or texture as background for your chart. Load file grouped bars.rmc into the Designer for an example. If you use an image as background for your chart you normally should choose as nBackColor the constant %ColorTransparent (which you also should choose for the background of the grid in grid-based and XY charts, otherwise it covers your image). But you als could choose a color as background additional to the image: in this case the color will be painted semi-transparent over the image to generate a special effect. Load file donut with image.rmc into the Designer for an example of this case. | ||
| sFontName (ASCIIZ) | ||
| Name of a TrueType font, which shall be used. If omitted or 0: "Tahoma" is used. | ||
| nBitmapBKColor (LONG) | ||
| Sets the color for the bitmap, which is the "canvas" for
all drawing routines. If omitted or 0: the same color is used as the background color of the window or control,
whose DC is used for creating the chart.
This parameter is very useful in three cases:
| ||
| Return value | ||
| 0 | ||
| No error, function succeeded. | ||
| RMC_ERROR_PARENTHANDLE | ||
| Parent DC is 0. | ||
| RMC_ERROR_CTRLID | ||
| Wrong control ID (0). | ||
| RMC_ERROR_MAXINST | ||
| The maximum count of control instances (20) within one programm is exceeded. | ||
| RMC_ERROR_NOGDIP | ||
| No GDIPLUS.DLL was found. | ||
| Remarks | ||
| This way of creating a chart is intended for use with Visual Basic. You can use the DC of the Form or the DC of a PictureBox. You must always include in the Form_Paint event of the Form a call to RMC_Paint(), and in the Form_Unload event a call to RMC_DeleteChart(). | ||