我目前正在实现一个工具提示,其中至少有两个句子值得,所以我需要以某种方式创建一个大矩形来容纳它。
我的问题是矩形的高度。
剪辑:
如您所见,绿色矩形没有所需的大小。
代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Discounting.Module
{
public partial class Benefits : UserControl
{
public Benefits()
{
InitializeComponent();
}
private void ToolTip1_Draw(object sender, DrawToolTipEventArgs e)
{
var newEventArgs = new DrawToolTipEventArgs(
e.Graphics,
e.AssociatedWindow,
e.AssociatedControl,
e.Bounds, e.ToolTipText,
this.BackColor,
this.ForeColor,
Font);
DrawToolTip(e);
}
private void DrawToolTip(DrawToolTipEventArgs e)
{
using (var sf = new StringFormat())
{
sf.LineAlignment = StringAlignment.Center;
sf.Alignment = StringAlignment.Center; …Run Code Online (Sandbox Code Playgroud) 我对 common lisp 相当陌生,并且一直在做练习来进入它。
我在 Windows 10 上的 wsl2 上使用 debian。
我有 sbcl 2.1.1 和 Quicklisp
这是我尝试加载的文件
(defpackage :lillys-lasagna-leftovers
(:use :cl)
(:export
:preparation-time
:remaining-minutes-in-oven
:split-leftovers))
(in-package :lillys-lasagna-leftovers)
(defun preparation-time (&rest rest)
(* 19 (length rest)))
(defun remaining-minutes-in-oven (&optional (opt :normal opt-provided))
(if opt-provided (cond
((eql opt :shorter) 337)
((eql opt :very-short) 137)
((eql opt :longer) 437)
((eql opt :very-long) 537)
(t nil))
opt))
Run Code Online (Sandbox Code Playgroud)
除了第二个函数不正确可能出现的问题之外。我尝试通过两种方式加载上述文件
通过输入 sbcl 并使用
(load "test-file-name")
(preparation-time 1 2 3)
Run Code Online (Sandbox Code Playgroud)
通过将文件加载到 sbcl
sbcl --load "test-file-name"
(preparation-time 1 …Run Code Online (Sandbox Code Playgroud)