zoukankan      html  css  js  c++  java
  • ShowBitMap

    static FormWindowControl showBitmap(FormWindowControl _control, Bitmap _bitmap,
                                       int _width=0, int _height=0)
    {
        real    ratio;
        Image   _image;
        ;
        if (_bitmap != connull())
            {
            _image = new Image();
            _image.setData(_bitmap);

            if (_width == 0 && _height == 0) // use default image hxw if no width or height pass in
                {
                _width = _image.width();
                _height = _image.height();
                }
            else // max width or height in not 0 is passed in
                {
                ratio = _image.width() > _image.height() ? _image.width() / _width : _image.height() / _height;

                _width = real2int(_image.width()/ratio);
                _height = real2int(_image.height()/ratio);

                _image.resize(_width, _height, InterpolationMode::InterpolationModeHighQuality);
                }

            _control.width(_width);
            _control.height(_height);
            _control.imagemode(0);
            _control.image(_image);
            }
        else
            {
            _control.imageResource(0);
            }

        return _control;
    }

  • 相关阅读:
    WPF Margin和Padding
    WPF Tab切换顺序设置
    WPF DataGrid DataGridTemplateColumn
    WPF CheckBox IsHitTestVisible
    WPF Tag
    WPF RadioButton
    WPF 用户控件(UserControl)
    WPF ToolTip
    Style Lessons in Clarity and Grace (11th Edition)中文翻译
    AI for AI
  • 原文地址:https://www.cnblogs.com/perock/p/2375293.html
Copyright © 2011-2022 走看看