袁绍伦
路人甲
路人甲
  • 注册日期2003-08-08
  • 发帖数654
  • QQ164646905
  • 铜币1336枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1158回复:0

Example in Visual Basic

楼主#
更多 发布于:2003-09-03 21:44
Private Sub btnPrintLegend_Click()
    Dim Legend as MapXLib.Legend
    ' there is no Printer.StartDoc method, it is done
    ' implicitly when you use one of the printer.print methods
    ' so we need to print something before we print our legend
    ' to start the page
    Printer.CurrentX = 0
    Printer.CurrentY = 0
    Printer.Print " "
    Set Legend = Map1.Datasets(1).Themes(1).Legend
    ' Print legend same width and height as is shown on the map
    ' coords must be in himetric

    ' Assumes a screen device with 96 pixels per inch (most are)
    ' There are 2540 himetric units per inch
    ' Legend.Width and Height are returned in Screen units
  '(pixels)
    ' so conversion from pixels to himetric is
     ' pixels/pixelsperinch * himetricperinch
    Legend.PrintLegend Printer.hDC, 0, 0, Legend.Width / _
  96 * 2540,          Legend.Height / 96 * 2540
    ' This example prints a legend in the upper left that
      ' is 4 by 3 inches
    ' 4 by 3 inches (2540 himetric units per inch)

    'Map1.Datasets(1).Themes(1).Legend.PrintLegend Printer.hDC,
  '0,        '0, 10160, 7620
    ' VB4 needed an explicit NewPage before the EndDoc,
    ' but VB5 doesn't
    'Printer.NewPage ' Send new page.
    Printer.EndDoc  ' Printing is finished.
End Sub
喜欢0 评分0
愿意和大家交朋友! QQ:47559983 MSN:shaolun_yuan@hotmail.com eMail:shaolun-yuan@163.com
游客

返回顶部