src/Misc/EFTools/EntityDesignPackage/CustomCode/MicrosoftDataEntityDesignDocView_PanZoom.cs
/// <summary>
///     Create and return a new panel displaying the
///     image in the specified resource as a background
///     image.
/// </summary>
Create and return a new panel displaying the
image in the specified resource as a background
image.
Create and return a new panel displaying the image in the specified resource as a background image .
[SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
        private Panel CreatePanel(
            int left,
            int top,
            int width,
            int height,
            string imageResourceName,
            string accessibleName,
            string accessibleDescription,
            EventHandler mouseClickHandler = null,
            MouseEventHandler mouseDownHandler = null)
        {
            var panel = new Panel
                {
                    Left = left,
                    Top = top,
                    Height = height,
                    Width = width,
                    Anchor = AnchorStyles.Bottom | AnchorStyles.Right
                };
            Debug.Assert(imageResourceName != null, "imageResourceName != null");
            var bitmap = new Bitmap(GetType(), imageResourceName);
            var pictureBox = new PictureBox
                {
                    AccessibleName = accessibleName,
                    AccessibleDescription = accessibleDescription,
                    AccessibleRole = AccessibleRole.PushButton
                };
            _themeChangedActions.Add(
                ()
                => pictureBox.Image
                   = ThemeUtils.GetThemedButtonImage(
                       bitmap,
                       EnvironmentColors.ScrollBarBackgroundColorKey));
            if (mouseClickHandler != null)
            {
                pictureBox.Click += mouseClickHandler;
            }
            if (mouseDownHandler != null)
            {
                pictureBox.MouseDown += mouseDownHandler;
            }
            _toolTip.SetToolTip(pictureBox, accessibleDescription);
            panel.Controls.Add(pictureBox);
            panel.BringToFront();
            return panel;
        }
[ SuppressMessage ( " " , " " ) ] private Panel CreatePanel ( int left , int top , int width , int height , string imageResourceName , string accessibleName , string accessibleDescription , EventHandler mouseClickHandler = null , MouseEventHandler mouseDownHandler = null ) { var panel = new Panel { Left = left , Top = top , Height = height , Width = width , Anchor = AnchorStyles . Bottom | AnchorStyles . Right } ; Debug . Assert ( imageResourceName != null , " " ) ; var bitmap = new Bitmap ( GetType ( ) , imageResourceName ) ; var pictureBox = new PictureBox { AccessibleName = accessibleName , AccessibleDescription = accessibleDescription , AccessibleRole = AccessibleRole . PushButton } ; _themeChangedActions . Add ( ( ) => pictureBox . Image = ThemeUtils . GetThemedButtonImage ( bitmap , EnvironmentColors . ScrollBarBackgroundColorKey ) ) ; if ( mouseClickHandler != null ) { pictureBox . Click += mouseClickHandler ; } if ( mouseDownHandler != null ) { pictureBox . MouseDown += mouseDownHandler ; } _toolTip . SetToolTip ( pictureBox , accessibleDescription ) ; panel . Controls . Add ( pictureBox ) ; panel . BringToFront ( ) ; return panel ; }
Create and return a new panel displaying the
image in the specified resource as a background
image.
Create and return a new panel displaying the image in the specified resource as a background image .
// Create a new panel to draw the image on
left
int
top
int
width
int
height
int
imageResourceName
string
accessibleName
string
accessibleDescription
string
mouseClickHandler
EventHandler
mouseDownHandler
MouseEventHandler