How do I create graphics are same in different areas
-
::Example code here: -------------------------------------------------------------------------------------------------------------- Private Function draw(ByVal g As Graphics) As Integer Dim sf As New SizeF g.MeasureString("hello world!", New Font("Arial", 9), sf) Return sf.Width End Function Private Sub pd_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles pd.PrintPage draw(e.Graphics) End Sub Private Sub mySub() Dim g As Graphics ' What should I do here with g in order to get equal results from draw() functions ' in pd_PrintPage() and in mySub()? draw(g) End Sub Tell me please if it is possible.
-
::Example code here: -------------------------------------------------------------------------------------------------------------- Private Function draw(ByVal g As Graphics) As Integer Dim sf As New SizeF g.MeasureString("hello world!", New Font("Arial", 9), sf) Return sf.Width End Function Private Sub pd_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles pd.PrintPage draw(e.Graphics) End Sub Private Sub mySub() Dim g As Graphics ' What should I do here with g in order to get equal results from draw() functions ' in pd_PrintPage() and in mySub()? draw(g) End Sub Tell me please if it is possible.
mySub should call Invalidate() to force a paint event. Although, I see that neither of your other blocks of code is a paint event. What are you trying to do ?
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
mySub should call Invalidate() to force a paint event. Although, I see that neither of your other blocks of code is a paint event. What are you trying to do ?
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
Oh, OK. You can use a scale transform to make everything you draw, bigger. There may also be a DPI setting, but I'm not sure what that would achieve.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )