Gdi 代码绘图动态滚动文字演示例程
代码中有详细注释说明。 Dim TempStrGraphics As Graphics Dim TempStrBit As New Bitmap(Panel1.Width, 50) TempStrGraphics = Graphics.FromImage(TempStrBit) 'TempStrGraphics.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias TempStrGraphics.DrawImage(TempBit, New Rectangle(0, 0, Panel1.Width, 50), New Rectangle(0, (Panel1.Height - 50) / 2, Panel1.Width, 50), GraphicsUnit.Pixel) TempStrGraphics.DrawString(DrawStr, TextBox1.Font, IIf(CheckBox1.Checked = True, Brushes.White, Brushes.Black), New Point((Panel1.Width - StrWidth) / 2, CurrentTop)) TempGraphics.DrawImage(TempStrBit, New Point(0, (Panel1.Height - 50) / 2)) TempStrGraphics.Dispose() TempStrBit.Dispose() Else If CheckBox3.Checked = True Then TempGraphics.DrawString(DrawStr, TextBox1.Font, IIf(CheckBox1.Checked = True, Brushes.White, Brushes.Black), New Point(CurrentLeft, (Panel1.Height - StrHeight) / 2)) Else TempGraphics.DrawString(DrawStr, TextBox1.Font, IIf(CheckBox1.Checked = True, Brushes.White, Brushes.Black), New Point((Panel1.Width - StrWidth) / 2, CurrentTop)) End If
评论