15476.html

来自「以电子书的形式收集了VB一些常见问题解决方法,可以很方便的查找自己需要解决的问题」· HTML 代码 · 共 27 行

HTML
27
字号
<html>
  <head>
    <title>Re: 有关sstab上的绘图问题</title>
  </head>
  <body bgcolor="#FFFFFF" vlink="#808080">
    <center>
      <h1>Re: 有关sstab上的绘图问题</h1>
    </center>
<hr size=7 width=75%>

<hr size=7 width=75%><p>
Posted by <a href="mailto:luo570@ms31.hinet.net">小琳</a> on July 10, 1999 at 17:41:43:<p>
In Reply to: <a href="15472.html">有关sstab上的绘图问题</a> posted by lool on July 10, 1999 at 13:11:43:<p>
: 各位好<br>: 小地有个问题想请大家帮忙<br>: 我写了一个程式有用到sstab控制项,在其中一个页签上放了<br>: picture box和一个commandbuttom ,只要按下commandbuttom 程式就会在picture box上绘图,而我的问题为可以在picture box上绘图,但是只要切换sstab上的页签,原本画好的图就会消失,想请问这有无方法可解决    谢谢<p>:::在Form里面放入一个SSTab,Command Button及二个Picture<br>Box物件,至于程式则如下:<br>Option Explicit<p>Private Sub Command1_Click()<br>    Picture2.AutoRedraw = True<br>    BitBlt Picture2.hdc, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, Picture1.hdc, 0, 0, vbSrcCopy<br>    Picture2.AutoRedraw = False<br>    Picture2.Refresh<br>End Sub<p>Private Sub Form_Load()<br>    Picture1.ScaleMode = vbPixels<br>    Picture2.ScaleMode = vbPixels<br>    Picture2.Height = Picture1.Height<br>    Picture2.Width = Picture1.Width<br>End Sub<p>Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)<br>    If Button = 1 Then<br>        Picture1.PSet (x, y)<br>    End If<br>End Sub<p>Private Sub SSTab1_Click(PreviousTab As Integer)<br>    If SSTab1.Caption = "Tab 1" Then<br>        Picture1.AutoRedraw = True<br>        BitBlt Picture1.hdc, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, Picture2.hdc, 0, 0, vbSrcCopy<br>        Picture1.AutoRedraw = False<br>        Picture1.Refresh<br>    End If<br>End Sub<p>新增一个模组,内容如下:<br>Public Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long<br>
<br>
<br><hr size=7 width=75%><p>
<a name="followups">Follow Ups:</a><br>
<ul><!--insert: 15476-->
<!--top: 15534--><li><a href="15534.html">小琳的做法不错, 但有更快的方式</a> <b>Sephiroth</b> <i>14:26:13 7/12/99</i>
(<!--responses: 15534-->0)
<ul><!--insert: 15534-->
</ul><!--end: 15534-->
</ul><!--end: 15476-->
<br><hr size=7 width=75%><p>

</body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?