如何从紧凑框架中的链接标签中删除下划线(windows ce)

时间:2017-07-06 05:22:17

标签: c# .net compact-framework windows-ce

如何从紧凑框架中的链接标签中删除下划线?由于标签和文本框没有点击事件,我必须使用linklabel作为其支持点击事件。

尝试this解决方案,但无法正常显示错误错误:运营商'!'不能应用于'System.Drawing.FontStyle'类型的操作数

有任何线索如何删除下划线并更改字体颜色?

1 个答案:

答案 0 :(得分:2)

一种简单的方法是从import java.io.IOException; import java.util.ArrayList; import javax.bluetooth.DeviceClass; import javax.bluetooth.DiscoveryAgent; import javax.bluetooth.DiscoveryListener; import javax.bluetooth.LocalDevice; import javax.bluetooth.RemoteDevice; import javax.bluetooth.ServiceRecord; /** * Class that discovers all bluetooth devices in the neighbourhood and displays * their name and bluetooth address. */ public class BluetoothDeviceDiscovery implements DiscoveryListener { // object used for waiting private static Object lock = new Object(); // vector containing the devices discovered public static ArrayList<RemoteDevice> devices; public BluetoothDeviceDiscovery() { devices = new ArrayList<RemoteDevice>(); } // main method of the application public static void main(String[] args) throws IOException { //create an instance of this class BluetoothDeviceDiscovery bluetoothDeviceDiscovery=new BluetoothDeviceDiscovery(); //display local device address and name LocalDevice localDevice = LocalDevice.getLocalDevice(); System.out.println("Address: "+localDevice.getBluetoothAddress()); System.out.println("Name: "+localDevice.getFriendlyName()); //find devices DiscoveryAgent agent = localDevice.getDiscoveryAgent(); System.out.println("Starting device inquiry…"); agent.startInquiry(DiscoveryAgent.GIAC, bluetoothDeviceDiscovery); try { synchronized(lock){ lock.wait(); } } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("Device Inquiry Completed. "); //print all devices in devices int deviceCount=devices.size(); System.out.println(deviceCount); if(deviceCount <= 0){ System.out.println("No Devices Found ."); } else{ //print bluetooth device addresses and names in the format [ No. address (name) ] System.out.println("Bluetooth Devices:" ); for (int i = 0; i < deviceCount; i++) { RemoteDevice remoteDevice=(RemoteDevice)devices.get(i); System.out.println((i+1)+". "+remoteDevice.getBluetoothAddress()+" ("+remoteDevice.getFriendlyName(true)+")"); } } } public void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod) { System.out.println("Device discovered: "+btDevice.getBluetoothAddress()); //add the device to the vector if(!devices.contains(btDevice)) { devices.add(btDevice); } } public void servicesDiscovered(int transID, ServiceRecord[] servRecord) { } public void serviceSearchCompleted(int transID, int respCode) { } public void inquiryCompleted(int discType) { synchronized(lock){ lock.notify(); } switch (discType) { case DiscoveryListener.INQUIRY_COMPLETED : System.out.println("INQUIRY_COMPLETED"); break; case DiscoveryListener.INQUIRY_TERMINATED : System.out.println("INQUIRY_TERMINATED"); break; case DiscoveryListener.INQUIRY_ERROR : System.out.println("INQUIRY_ERROR"); break; default : System.out.println("Unknown Response Code"); break; } } } 继承用户控件并覆盖LinkLabel。其中使用GDI +呈现LinkLabel的内容。您仍然可以使用LinkLabel的所有其他功能,但文本不会像您希望的那样有下划线。

以下几行:

OnPaint