def CreateItem(self, argb, text):
     item = forms.ImageListItem()
     item.Text = text
     size = drawing.Size(20, 14) * int(forms.Screen.PrimaryScreen.LogicalPixelSize)
     bitmap = drawing.Bitmap(size, drawing.PixelFormat.Format32bppRgb)
     with drawing.Graphics(bitmap) as g:
         g.Clear(drawing.Color.FromArgb(argb))
     item.Image = bitmap
     return item
示例#2
0
    def __init__(self):
        # Initialize dialog box
        self.Title = 'Dynamis'
        self.Padding = drawing.Padding(5)
        self.Resizable = False

        self.m_image_view = forms.ImageView()
        self.m_image_view.Size = drawing.Size(400, 225)
        self.m_image_view.Image = drawing.Bitmap("D:\AnimazioneBot\Vect.PNG")
        # Create layout

        self.m_button = forms.Button(Text='Esporta')
        self.m_button.Click += self.LanciaBotton

        self.m_textbox = forms.TextBox()
        self.m_label = forms.Label(Text='Indica il nome del progetto:')
        self.m_textbox.Text = "untitled"

        self.m_foronumero = forms.TextBox()
        self.m_forolabel = forms.Label(Text='Indica la dimensione del foro')
        self.m_foronumero.Text = "10"
        layout = forms.DynamicLayout()
        layout.Padding = drawing.Padding(5)
        layout.Spacing = drawing.Size(5, 5)
        layout.BeginVertical()
        layout.AddSeparateRow(None, self.m_image_view, None)
        layout.EndVertical()
        layout.AddRow(None)
        layout.BeginVertical()
        layout.AddRow(None, self.m_label, None, self.m_textbox, None)
        layout.EndVertical()
        layout.AddRow(None)
        layout.BeginVertical()
        layout.AddRow(None, self.m_forolabel, None, self.m_foronumero, None)
        layout.EndVertical()
        layout.AddRow(None)
        layout.BeginVertical()
        layout.AddRow(None, self.m_button, None, self.CloseButton(), None)
        layout.EndVertical()
        # Set the dialog content
        self.Content = layout
示例#3
0
文件: image.py 项目: irfanirw/compas
def image_from_local(source):
    """Construct an image from a local source.

    Parameters
    ----------
    source : str
        The path to the local source file.

    Returns
    -------
    System.Drawing.Image
        Representation of an miage in memory.

    Examples
    --------
    .. code-block:: python

        image = image_from_local('theblock.jpg')

    """
    return drawing.Bitmap(source)
示例#4
0
文件: image.py 项目: irfanirw/compas
def image_from_remote(source):
    """Construct an image from a remote source.

    Parameters
    ----------
    source : str
        The url of the remote source.

    Returns
    -------
    System.Drawing.Image
        Representation of an miage in memory.

    Examples
    --------
    .. code-block:: python

        image = image_from_remote('http://block.arch.ethz.ch/brg/images/cache/dsc02360_ni-2_cropped_1528706473_624x351.jpg')

    """
    w = WebClient()
    d = w.DownloadData(source)
    m = MemoryStream(d)
    return drawing.Bitmap(m)