<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="https://syndication.webwiz.net/rss_namespace/">
 <channel>
  <title>Codejock Developer Community : Problem: Repaint MdiClient</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Command Bars : Problem: Repaint MdiClient]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Sat, 13 Jun 2026 18:08:56 +0000</pubDate>
  <lastBuildDate>Mon, 29 Nov 2010 02:25:49 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 12.04</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>forum.codejock.com/RSS_post_feed.asp?TID=17613</WebWizForums:feedURL>
  <image>
   <title><![CDATA[Codejock Developer Community]]></title>
   <url>http://forum.codejock.com/forum_images/codejock-logo.gif</url>
   <link>http://forum.codejock.com/</link>
  </image>
  <item>
   <title><![CDATA[Problem: Repaint MdiClient :   I&amp;#039;m developing a MdiForm...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=17613&amp;PID=61580&amp;title=problem-repaint-mdiclient#61580</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6471">ws0411101</a><br /><strong>Subject:</strong> 17613<br /><strong>Posted:</strong> 29 November 2010 at 2:25am<br /><br /><div>I'm developing a MdiForm programm, I want to paint some text on the MdiClient.</div><div><br></div><div>first, i get the client of the form:</div><div>--------------------------------------------------</div><div><div>&nbsp;&nbsp; &nbsp;Function FindMDIClient() As MdiClient</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Dim i As Integer = 0</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;While i &lt; Me.Controls.Count</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;If TypeOf Me.Controls(i) Is MdiClient Then</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Return CType(Me.Controls(i), MdiClient)</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End If</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;i = i + 1</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;End While</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Return Nothing</div><div>&nbsp;&nbsp; &nbsp;End Function</div></div><div><br></div><div>&nbsp;&nbsp;&nbsp;Private WithEvents myMdiClient As MdiClient</div><div>&nbsp;&nbsp;&nbsp;myMdiClient=FindMDIClient()</div><div>----------------------------------------------------</div><div><br></div><div>second, &nbsp;i define two functions:</div><div>----------------------------------------------------</div><div><div>&nbsp;&nbsp;Private Sub Mdi_OnPaint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs)</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Dim c As Control = CType(sender, Control)</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Dim r1 As Rectangle = c.ClientRectangle</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;r1.Width -= 4</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;r1.Height -= 4</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Dim r2 As Rectangle = r1</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;r2.Width -= 1</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;r2.Height -= 1</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Dim f As Font = New Font("Tahoma", 50)</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Dim str As String = "my test string"</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Dim sf As New StringFormat</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;sf.Alignment = StringAlignment.Far</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;sf.LineAlignment = StringAlignment.Far</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;e.Graphics.DrawString(str, f, New SolidBrush(Color.Blue), r1, sf)</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;e.Graphics.DrawString(str, f, New SolidBrush(Color.Yellow), r2, sf)</div><div>&nbsp;&nbsp; &nbsp;End Sub</div><div><br></div><div>&nbsp;&nbsp; &nbsp;Private Sub Mdi_OnResize(ByVal sender As System.Object, ByVal e As System.EventArgs)</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Dim c As Control = CType(sender, Control)</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;c.Invalidate()</div><div>&nbsp;&nbsp; &nbsp;End Sub</div></div><div>--------------------------------------------------------------------</div><div><br></div><div>then, add handler to&nbsp;MdiClient object&nbsp;"myMdiClient"</div><div>------------------------------------------------------------------</div><div><div>&nbsp;&nbsp; AddHandler myMdiClient.Paint, AddressOf Mdi_OnPaint</div><div>&nbsp;&nbsp; AddHandler myMdiClient.Resize, AddressOf Mdi_OnResize</div></div><div>----------------------------------------------------------------------</div><div><br></div><div>but, when&nbsp;I use xtremeCommandBars control,&nbsp;i use this code&nbsp;to bound the handle of&nbsp;MDIClient to&nbsp;myCmdManager:</div><div><div><div>---------------------------------------------------------------------------</div><div>myCmdManager.SetMDIClient(FindMDIClient.Handle.ToInt32)&nbsp;</div><div>note:&nbsp;&nbsp;myCmdManager is axCommandBars</div><div>---------------------------------------------------------------------------</div><div><br></div><div>now, the event handler seems&nbsp;failure, the function "Mdi_OnPaint" "Mdi_OnResize" don't&nbsp;respond</div><span ="ph&#111;netic"=""> </span><div>&nbsp;the event “Paint” and “Resize”.</div><div><br></div><div>but before i&nbsp;&nbsp;bound the handle of&nbsp;MDIClient to&nbsp;myCmdManager, the program is run well.</div><div><br></div><div>how can i solve this problem, thank you!!!</div><div><br></div></div></div>]]>
   </description>
   <pubDate>Mon, 29 Nov 2010 02:25:49 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=17613&amp;PID=61580&amp;title=problem-repaint-mdiclient#61580</guid>
  </item> 
 </channel>
</rss>