How can I trigger a button click event
Use the button’s public method PerformClick. button1.PerformClick();
How do I programmatically load, modify and save a bitmap
You can download a working project. Below are VB code snippets showing how you might do these tasks. ’load a bitmap from an embedded resource Dim Bmp As Bitmap ’ from an embedded resource Dim curName As String = ”BitmapVB.sync.bmp” Dim strm As System.IO.Stream = Me.GetType().Assembly.GetManifestResourceStream(curName) Bmp = New Bitmap(strm) PictureBox1.Image = Bmp ….. ….. ’load a bitmap from a file Dim Bmp As Bitmap = Image.FromFile(”c:\sync.bmp”) PictureBox1.Image = Bmp ….. ….. ’modify a bitmap Dim Bmp As Bitmap = PictureBox1.Image.Clone Dim g As Graphics = Graphics.FromImage(Bmp) Dim brush1 As SolidBrush = New SolidBrush(Color.Red) g.DrawString(TextBox1.Text, TextBox1.Font, brush1, 10, 10) PictureBox2.Image = Bmp g.Dispose() …. …. ’save a bitmap as a file Dim dlg As SaveFileDialog = New SaveFileDialog() dlg.Title = ”Save BMP file” dlg.InitialDirectory = ”c:\” dlg.Filter = ”bmp files (*.bmp)|*.bmp|All files (*.*)|*.*” If dlg.ShowDialog = DialogResult.OK Then PictureBox2.Image.Save(dlg.FileName End If
What are the steps to compiling and using multiple language resources
Localization Sample illustrates how to load different language resources depending upon a parameter passed in when you run the program from a command line. The sample can display English, French, Spanish and German words using the same exe. For example, typing Test de on the command line will count to three in German. Typing Test fr will count to three in French. The argument passed in is used to determine the culture setting for the resources. In each folder is a batch file that handles compiling the single exe and multiple resources. The tools RESGEN and AL are used in these batch files to generate the resources and resource DLL’s. Notice the naming conventions used by the subfolders containing the foreign resource DLLs.
How to add an extern reference to a Win32 API
We have two suggestions with sample projects how you host a WebBrowser control inside a form and display HTML contents and listen to events such as NavigateComplete or BeforeNavigate. Of course there are many other ways to do this. Download htmlviewer.zip for two sample projects for the suggestions discussed below. 1) The first suggestion is to generate an ActiveX wrapper for shdocvw using the aximp tool. The command line for this tool should be as follows: aximp c:\windows\system32\shdocvw.dll This will generate the following assemblies. Generated Assembly: D:\Syncfusion\faq\HtmlBrowser\HtmlViewer2\SHDocVw.dll Generated Assembly: D:\Syncfusion\faq\HtmlBrowser\HtmlViewer2\AxSHDocVw.dll Now you can reference these dlls in your project and use AxWebBrowser. In the attached HtmlViewer2 sample we have derived a HtmlControl class from AxWebBrowser and added some properties that let you specify a CSS Stylesheet and the Html content as a string. 2) Our second sample lets you bypass the generation of a ActiveX wrapper. You don’t have to include and ship shdocvw.dll and axshdocvw.dll. In the attached HtmlViewer sample, we derived from AxHost and attached our own IWebBrowserEvents interface by overriding the CreateSink, AttachInterfaces and DetachSink methods. You can use HtmlControl in your form and specify HTML content by assigning a HTML string to HtmlControl. A cascading style sheet can be specified by assigning a path name to the CascadingStyleSheet property. The sample demonstrates how to use a CSS style sheet that has been embedded as a resource in the assembly.
How do you prevent serialization of certain child controls in your Composite Control
One solution is to use a panel that has a picturebox placed on it with DockStyle.Fill. This will make the picturebox assume the size of the panel. In addition, set the DockPadding.All property to the width of the desired border. Then in the Panel’s OnPaint method, call the baseclass and then paint the desired borders. Here are both VB and C# projects that illustrate how you might go about this. The derived PicturePanel class has properties that allow you to set the bordersize and color as well as the image that is to be displayed. This sample retrieves the image from an embedded