winforms 添加链接不一致存在RPC

u7up0aaq  于 2022-11-16  发布在  其他
关注(0)|答案(1)|浏览(85)

我有这个代码在C#和我试图添加url按钮能够添加一个网页url,但我不知道如何添加它,这是我的代码:

this.handlers = default(DiscordRpc.EventHandlers);
DiscordRpc.Initialize("xxx", ref this.handlers, true, null);
this.handlers = default(DiscordRpc.EventHandlers);
DiscordRpc.Initialize("xxx", ref this.handlers, true, null);
this.presence.details = "Barcelona";
this.presence.state = "Barcelona";
this.presence.startTimestamp = (long)(DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds;
this.presence.largeImageKey = "https://media.tenor.com/Y_bfmgZ2sZ0AAAAM/aubameyang-fc-barcelona.gif";
this.presence.smallImageKey = "https://media.tenor.com/Y_bfmgZ2sZ0AAAAM/aubameyang-fc-barcelona.gif";
this.presence.largeImageText = "HI";

this.presence.smallImageText = "FCB";
DiscordRpc.UpdatePresence(ref this.presence);

这就是我想补充的。

aoyhnmkz

aoyhnmkz1#

只需创建System.Windows.Forms.Button类的示例并将其添加到forms Controls集合中,如下所示

private void InitializeComponent()
{
    this.twitterButton = new System.Windows.Forms.Button();

    // 
    // twitterButton
    // 
    this.twitterButton.Location = new System.Drawing.Point(44, 111);
    this.twitterButton.Name = "twitterButton";
    this.twitterButton.Size = new System.Drawing.Size(89, 23);
    this.twitterButton.TabIndex = 1;
    this.twitterButton.Text = "twitter";
    this.twitterButton.UseVisualStyleBackColor = true;
    this.twitterButton.Click += new System.EventHandler(this.twitterButton_Click);

    this.Controls.Add(this.twitterButton);
}

相关问题